Skip to content

Commit 0045308

Browse files
authored
Merge pull request #20985 from charris/backport-20963
MAINT: be more tolerant of setuptools >= 60
2 parents c12001c + f30858a commit 0045308

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

‎setup.py‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,16 @@
8181
import numpy.distutils.command.sdist
8282
import setuptools
8383
if int(setuptools.__version__.split('.')[0]) >= 60:
84-
raise RuntimeError(
85-
"Setuptools version is '{}', version < '60.0.0' is required. "
86-
"See pyproject.toml".format(setuptools.__version__))
84+
# setuptools >= 60 switches to vendored distutils by default; this
85+
# may break the numpy build, so make sure the stdlib version is used
86+
try:
87+
setuptools_use_distutils = os.environ['SETUPTOOLS_USE_DISTUTILS']
88+
except KeyError:
89+
os.environ['SETUPTOOLS_USE_DISTUTILS'] = "stdlib"
90+
else:
91+
if setuptools_use_distutils != "stdlib":
92+
raise RuntimeError("setuptools versions >= '60.0.0' require "
93+
"SETUPTOOLS_USE_DISTUTILS=stdlib in the environment")
8794

8895
# Initialize cmdclass from versioneer
8996
from numpy.distutils.core import numpy_cmdclass

0 commit comments

Comments
 (0)