summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2021-05-25 13:35:42 -0600
committerCharles Harris <charlesr.harris@gmail.com>2021-05-25 16:17:28 -0600
commit9a37cd93d2e57bb8058921dbff52669365e2f3a8 (patch)
treea34ae3bee2881f6011270bcdffe4ffdd175a6492
parentfe3d717080e812383900507168a6bd7093c4e434 (diff)
downloadnumpy-9a37cd93d2e57bb8058921dbff52669365e2f3a8.tar.gz
BUG: Fix setup.py to work in maintenance branches.
This fixes setup.py to correctly detect the release status and base version from the full version string provided by versioneer. Before this fix, versions like '1.22.0.dev0+...' were correctly handled, but versions like '1.21.0rc1+...' were not.
-rwxr-xr-xsetup.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index 247dc512a..826610466 100755
--- a/setup.py
+++ b/setup.py
@@ -25,6 +25,7 @@ import subprocess
import textwrap
import warnings
import builtins
+import re
# Python supported version checks. Keep right after stdlib imports to ensure we
@@ -46,8 +47,14 @@ builtins.__NUMPY_SETUP__ = True
# The version components are changed from ints to strings, but only VERSION
# seems to matter outside of this module and it was already a str.
FULLVERSION = versioneer.get_version()
-ISRELEASED = 'dev' not in FULLVERSION
-MAJOR, MINOR, MICRO = FULLVERSION.split('.')[:3]
+
+# Capture the version string:
+# 1.22.0.dev0+ ... -> ISRELEASED == False, VERSION == 1.22.0
+# 1.22.0rc1+ ... -> ISRELEASED == False, VERSION == 1.22.0
+# 1.22.0 ... -> ISRELEASED == True, VERSION == 1.22.0
+# 1.22.0rc1 ... -> ISRELEASED == True, VERSION == 1.22.0
+ISRELEASED = re.search(r'(dev|\+)', FULLVERSION) is None
+MAJOR, MINOR, MICRO = re.match(r'(\d+)\.(\d+)\.(\d+)', FULLVERSION).groups()
VERSION = '{}.{}.{}'.format(MAJOR, MINOR, MICRO)
# The first version not in the `Programming Language :: Python :: ...` classifiers above