From 6d308d3c302d4b48a81f96d5cbb72fb6961ee2c1 Mon Sep 17 00:00:00 2001 From: Valentin Niess Date: Mon, 14 Feb 2022 16:07:13 +0100 Subject: [PATCH] Add VERSION for PyPI --- .github/workflows/pypi.yml | 6 +----- VERSION | 1 + setup.py | 26 +++++++------------------- 3 files changed, 9 insertions(+), 24 deletions(-) create mode 100644 VERSION diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index fbd4982..9c9e2d8 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -2,11 +2,7 @@ name: PyPI on: push: paths: - - '.github/workflows/pypi.yml' - - 'LICENSE' - - 'python_appimage/**' - - 'README.md' - - 'setup.py' + - 'VERSION' jobs: Test: diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..3eefcb9 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.0.0 diff --git a/setup.py b/setup.py index 8fc66a1..5bc733f 100644 --- a/setup.py +++ b/setup.py @@ -25,26 +25,14 @@ with open('README.md') as f: def get_version(): '''Get the next version number from PyPI ''' - version = os.getenv('PYTHON_APPIMAGE_VERSION') - if not version: - try: - _create_unverified_https_context = ssl._create_unverified_context - except AttributeError: - pass - else: - ssl._create_default_https_context = _create_unverified_https_context + with open('VERSION') as f: + version = f.read().strip() - meta = json.load( - urlopen('https://pypi.org/pypi/python-appimage/json')) - - version = meta['info']['version'] - numbers = version.split('.') - numbers[-1] = str(int(numbers[-1]) + 1) - version = '.'.join(numbers) - - p = subprocess.Popen('git describe --match=NeVeRmAtCh --always --dirty', - shell=True, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) + p = subprocess.Popen( + 'git describe --match=NeVeRmAtCh --always --dirty 2> /dev/null || ' + 'echo unknown', + shell=True, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) stdout, _ = p.communicate() try: stdout = stdout.decode()