From 9b10a9f8b16314cddf8411ef3a88860a4faef64a Mon Sep 17 00:00:00 2001 From: Tetrergeru <41305740+Tetrergeru@users.noreply.github.com> Date: Fri, 22 Sep 2023 11:22:26 +0200 Subject: [PATCH 1/2] Read version from file --- .github/workflows/publish-to-test-pypi.yml | 2 +- VERSION | 1 + setup.py | 5 ++++- version.py | 1 - 4 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 VERSION delete mode 100644 version.py diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index 52740b2..3c3942a 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -31,7 +31,7 @@ jobs: | sed 's#[^a-zA-Z0-9_\.\-]#_#g'` echo "tag version = $VERSION_TAG" - VERSION_FILE=$(echo 'import version; print(version.VERSION)' | python -) + VERSION_FILE=$(cat VERSION) echo "file version = $VERSION_FILE" if [ "$VERSION_TAG" != "$VERSION_FILE" ]; then diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..8c7fafd --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +4.1.3 \ No newline at end of file diff --git a/setup.py b/setup.py index 5c6f230..5de3e0b 100644 --- a/setup.py +++ b/setup.py @@ -4,9 +4,12 @@ with open('requirements.txt') as f: required = f.read().splitlines() +with open("VERSION", "r") as file: + version = file.readline() + setup( name='moira-python-client', - version=VERSION, + version=version, description='Client for Moira - Alerting system based on Graphite data', keywords='moira monitoring client metrics alerting', long_description=""" diff --git a/version.py b/version.py deleted file mode 100644 index 09c37f6..0000000 --- a/version.py +++ /dev/null @@ -1 +0,0 @@ -VERSION='4.1.2' \ No newline at end of file From 5476dbf3263cb544223bfc2c2fa26087d68919ba Mon Sep 17 00:00:00 2001 From: Tetrergeru <41305740+Tetrergeru@users.noreply.github.com> Date: Fri, 22 Sep 2023 11:33:25 +0200 Subject: [PATCH 2/2] Remove version import --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 5de3e0b..8e3934d 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ from distutils.core import setup -from version import VERSION with open('requirements.txt') as f: required = f.read().splitlines()