summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2021-10-23 12:54:12 -0600
committerGitHub <noreply@github.com>2021-10-23 12:54:12 -0600
commit7cc966bb0542b378cac095fbfbd3916240e0f293 (patch)
tree764597576d37b7ece9660ae3d49ee6a6170be866
parentbede698337b0b55115c2e06444828de1da59484e (diff)
parent9db73b58df62f54521bbbb8addafc7b0d5e61d1f (diff)
downloadnumpy-7cc966bb0542b378cac095fbfbd3916240e0f293.tar.gz
Merge pull request #20170 from matthew-brett/better-error-version-fail
More informative error for unparsable version
-rwxr-xr-xsetup.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/setup.py b/setup.py
index 6fdd3b77e..6cb37d291 100755
--- a/setup.py
+++ b/setup.py
@@ -55,7 +55,10 @@ FULLVERSION = versioneer.get_version()
# 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()
+_V_MATCH = re.match(r'(\d+)\.(\d+)\.(\d+)', FULLVERSION)
+if _V_MATCH is None:
+ raise RuntimeError(f'Cannot parse version {FULLVERSION}')
+MAJOR, MINOR, MICRO = _V_MATCH.groups()
VERSION = '{}.{}.{}'.format(MAJOR, MINOR, MICRO)
# The first version not in the `Programming Language :: Python :: ...` classifiers above