summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@gmail.com>2020-12-22 21:11:50 +0100
committerRalf Gommers <ralf.gommers@gmail.com>2020-12-22 21:11:50 +0100
commitf66d5dbb02f576541133f1108d73ae81f8a8f42f (patch)
tree8e361a3a45088c93e8bd8bcc7356b041ecca929f /setup.py
parente393b066cbf09d982c44063e051341dd061a1b82 (diff)
downloadnumpy-f66d5dbb02f576541133f1108d73ae81f8a8f42f.tar.gz
BLD: ensure we give the right error message for old Python versions
Before this change, it would give a random syntax error somewhere in `versioneer`.
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/setup.py b/setup.py
index e54328e06..5f4b553c9 100755
--- a/setup.py
+++ b/setup.py
@@ -24,9 +24,18 @@ import sys
import subprocess
import textwrap
import warnings
-import versioneer
import builtins
+
+# Python supported version checks. Keep right after stdlib imports to ensure we
+# get a sensible error for older Python versions
+if sys.version_info[:2] < (3, 7):
+ raise RuntimeError("Python version >= 3.7 required.")
+
+
+import versioneer
+
+
# This is a bit hackish: we are setting a global variable so that the main
# numpy __init__ can detect if it is being loaded by the setup routine, to
# avoid attempting to load components that aren't built yet. While ugly, it's
@@ -41,10 +50,6 @@ ISRELEASED = 'dev' not in FULLVERSION
MAJOR, MINOR, MICRO = FULLVERSION.split('.')[:3]
VERSION = '{}.{}.{}'.format(MAJOR, MINOR, MICRO)
-# Python supported version checks
-if sys.version_info[:2] < (3, 7):
- raise RuntimeError("Python version >= 3.7 required.")
-
# The first version not in the `Programming Language :: Python :: ...` classifiers above
if sys.version_info >= (3, 10):
fmt = "NumPy {} may not yet support Python {}.{}."