summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2022-02-01 11:50:57 -0700
committerGitHub <noreply@github.com>2022-02-01 11:50:57 -0700
commitb6e6b838f1dd5f689ef8bac7a40ee814be7cd362 (patch)
tree0dcedb9777ac5187807d255a163a6448b3081f38
parent5e2c1e8afcc446bc17e78f4ead1d9bd03e841ef9 (diff)
parentdedc0954e7fabd6059b4c3e233ddc1028e4d7361 (diff)
downloadnumpy-b6e6b838f1dd5f689ef8bac7a40ee814be7cd362.tar.gz
Merge pull request #20963 from ahesford/its-a-setup
MAINT: be more tolerant of setuptools>=60
-rwxr-xr-xsetup.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/setup.py b/setup.py
index c520ed69e..085b158ed 100755
--- a/setup.py
+++ b/setup.py
@@ -86,9 +86,16 @@ if os.path.exists('MANIFEST'):
import numpy.distutils.command.sdist
import setuptools
if int(setuptools.__version__.split('.')[0]) >= 60:
- raise RuntimeError(
- "Setuptools version is '{}', version < '60.0.0' is required. "
- "See pyproject.toml".format(setuptools.__version__))
+ # setuptools >= 60 switches to vendored distutils by default; this
+ # may break the numpy build, so make sure the stdlib version is used
+ try:
+ setuptools_use_distutils = os.environ['SETUPTOOLS_USE_DISTUTILS']
+ except KeyError:
+ os.environ['SETUPTOOLS_USE_DISTUTILS'] = "stdlib"
+ else:
+ if setuptools_use_distutils != "stdlib":
+ raise RuntimeError("setuptools versions >= '60.0.0' require "
+ "SETUPTOOLS_USE_DISTUTILS=stdlib in the environment")
# Initialize cmdclass from versioneer
from numpy.distutils.core import numpy_cmdclass