diff options
author | Andrew J. Hesford <ajh@sideband.org> | 2022-02-01 10:34:26 -0500 |
---|---|---|
committer | Andrew J. Hesford <ajh@sideband.org> | 2022-02-01 10:34:26 -0500 |
commit | dedc0954e7fabd6059b4c3e233ddc1028e4d7361 (patch) | |
tree | 42037c54350409f417932a378581654ec9678c66 | |
parent | c65bc212ec1987caefba0ea7efe6a55803318de9 (diff) | |
download | numpy-dedc0954e7fabd6059b4c3e233ddc1028e4d7361.tar.gz |
MAINT: be more tolerant of setuptools>=60
NumPy may fail to build with the default vendored distutils in
setuptools>=60. Rather than panic and die when new setuptools is found,
let's check (or set, if possible) the SETUPTOOLS_USE_DISTUTILS
environment variable that restores "proper" setuptools behavior.
-rwxr-xr-x | setup.py | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -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 |