summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2021-05-26 07:32:06 +0300
committerGitHub <noreply@github.com>2021-05-26 07:32:06 +0300
commit23cea5293f94478817c98aa820d771b54a416b80 (patch)
treea87a5b65a9de947d799005e60f15bae77ef4ab93
parente6557c284370d70fc8e5a3f4bf2280250eb42fd3 (diff)
parent9a37cd93d2e57bb8058921dbff52669365e2f3a8 (diff)
downloadnumpy-23cea5293f94478817c98aa820d771b54a416b80.tar.gz
Merge pull request #19096 from charris/fix-numpy-version
BUG: Fix setup.py to work in maintenance branches.
-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