From 8ee377d62ce3973fa16723fa72c3bf62c709a150 Mon Sep 17 00:00:00 2001 From: Aravinda Vishwanathapura Date: Wed, 8 Feb 2023 00:18:10 +0530 Subject: [PATCH] Python packaging added Signed-off-by: Aravinda Vishwanathapura --- .github/workflows/on-release-tag.yml | 16 +++++++++++++ .gitignore | 4 +++- extras/install.sh | 6 +++++ sdk/python/setup.py | 35 ++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 sdk/python/setup.py diff --git a/.github/workflows/on-release-tag.yml b/.github/workflows/on-release-tag.yml index 05a9ad6..4c8b2a7 100644 --- a/.github/workflows/on-release-tag.yml +++ b/.github/workflows/on-release-tag.yml @@ -44,3 +44,19 @@ jobs: tag: ${{ github.ref }} overwrite: true file_glob: true + - name: Upload Python files to the release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: sdk/python/kadalu_volgen/*.py + tag: ${{ github.ref }} + overwrite: true + file_glob: true + - name: Upload setup.py to the release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: sdk/python/setup.py + tag: ${{ github.ref }} + overwrite: true + file_glob: true diff --git a/.gitignore b/.gitignore index f9d54f3..9b3dedf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ bin lib -__pycache__ \ No newline at end of file +__pycache__ +*.egg-info +dist \ No newline at end of file diff --git a/extras/install.sh b/extras/install.sh index 585b8cb..72e8d13 100755 --- a/extras/install.sh +++ b/extras/install.sh @@ -5,9 +5,15 @@ curl -fsSL https://github.com/kadalu/volgen/releases/latest/download/disperse.vo curl -fsSL https://github.com/kadalu/volgen/releases/latest/download/replica2.vol.j2 -o /tmp/replica2.vol.j2 curl -fsSL https://github.com/kadalu/volgen/releases/latest/download/replica3.vol.j2 -o /tmp/replica3.vol.j2 curl -fsSL https://github.com/kadalu/volgen/releases/latest/download/storage_unit.vol.j2 -o /tmp/storage_unit.vol.j2 +curl -fsSL https://github.com/kadalu/volgen/releases/latest/download/__init__.py -o /tmp/__init__.py +curl -fsSL https://github.com/kadalu/volgen/releases/latest/download/setup.py -o /tmp/setup.py install -m 700 /tmp/disperse.vol.j2 /var/lib/kadalu/templates/ install -m 700 /tmp/replica2.vol.j2 /var/lib/kadalu/templates/ install -m 700 /tmp/replica3.vol.j2 /var/lib/kadalu/templates/ install -m 700 /tmp/storage_unit.vol.j2 /var/lib/kadalu/templates/ install /tmp/kadalu-volgen /usr/bin/kadalu-volgen +mkdir -p /tmp/python/kadalu_volgen +mv /tmp/__init__.py /tmp/python/kadalu_volgen/ +mv /tmp/setup.py /tmp/python/ +cd /tmp/python/ && python3 setup.py install diff --git a/sdk/python/setup.py b/sdk/python/setup.py new file mode 100644 index 0000000..8c40db6 --- /dev/null +++ b/sdk/python/setup.py @@ -0,0 +1,35 @@ +from setuptools import setup + +# def version(): +# with open("VERSION") as version_file: +# return version_file.read().strip() + +def version(): + return "v0.2.0" + +setup( + name="kadalu_volgen", + version=version(), + packages=["kadalu_volgen"], + include_package_data=True, + install_requires=[], + platforms="linux", + zip_safe=False, + author="Kadalu Authors", + author_email="maintainers@kadalu.tech", + description="Kadalu Volfile Generation", + license="GPL-3.0", + keywords="kadalu, volgen, volfile", + url="https://github.com/kadalu/volgen", + long_description=""" + Kadalu Volgen - CLI to generate Volfiles for + Kadalu Storage or GlusterFS + """, + classifiers=[ + "Topic :: Utilities", + "Environment :: Console", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + ], +)