Parcourir la source

Add VERSION for PyPI

Valentin Niess il y a 4 ans
Parent
commit
6d308d3c30
3 fichiers modifiés avec 10 ajouts et 25 suppressions
  1. 1 5
      .github/workflows/pypi.yml
  2. 1 0
      VERSION
  3. 8 20
      setup.py

+ 1 - 5
.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:

+ 1 - 0
VERSION

@@ -0,0 +1 @@
+1.0.0

+ 8 - 20
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
-
-        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)
+    with open('VERSION') as f:
+        version = f.read().strip()
+
+    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()