-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
MAINT: use sysconfig not distutils.sysconfig where possible #17223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,7 +171,7 @@ | |
|
||
from distutils.errors import DistutilsError | ||
from distutils.dist import Distribution | ||
import distutils.sysconfig | ||
import sysconfig | ||
from numpy.distutils import log | ||
from distutils.util import get_platform | ||
|
||
|
@@ -187,6 +187,7 @@ | |
import tempfile | ||
import shutil | ||
|
||
__all__ = ['system_info'] | ||
|
||
# Determine number of bits | ||
import platform | ||
|
@@ -255,7 +256,7 @@ def libpaths(paths, bits): | |
|
||
if sys.platform == 'win32': | ||
default_lib_dirs = ['C:\\', | ||
os.path.join(distutils.sysconfig.EXEC_PREFIX, | ||
os.path.join(sysconfig.EXEC_PREFIX, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AttributeError: module 'sysconfig' has no attribute 'EXEC_PREFIX' |
||
'libs')] | ||
default_runtime_dirs = [] | ||
default_include_dirs = [] | ||
|
@@ -2498,13 +2499,13 @@ def __init__(self): | |
except AttributeError: | ||
pass | ||
|
||
include_dirs.append(distutils.sysconfig.get_python_inc( | ||
include_dirs.append(distutils.get_python_inc( | ||
prefix=os.sep.join(prefix))) | ||
except ImportError: | ||
pass | ||
py_incl_dir = distutils.sysconfig.get_python_inc() | ||
py_incl_dir = sysconfig.get_python_inc() | ||
include_dirs.append(py_incl_dir) | ||
< 8000 td class="blob-num blob-num-deletion empty-cell"> | py_pincl_dir = distutils.sysconfig.get_python_inc(plat_specific=True) | |
py_pincl_dir = sysconfig.get_python_inc(plat_specific=True) | ||
if py_pincl_dir not in include_dirs: | ||
include_dirs.append(py_pincl_dir) | ||
for d in default_include_dirs: | ||
|
@@ -2631,8 +2632,8 @@ def calc_info(self): | |
break | ||
if not src_dir: | ||
return | ||
py_incl_dirs = [distutils.sysconfig.get_python_inc()] | ||
py_pincl_dir = distutils.sysconfig.get_python_inc(plat_specific=True) | ||
py_incl_dirs = [sysconfig.get_python_inc()] | ||
py_pincl_dir = sysconfig.get_python_inc(plat_specific=True) | ||
if py_pincl_dir not in py_incl_dirs: | ||
py_incl_dirs.append(py_pincl_dir) | ||
srcs_dir = os.path.join(src_dir, 'libs', 'python', 'src') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,8 @@ def UnixCCompiler__compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts | |
self.compiler_so = ccomp | ||
# ensure OPT environment variable is read | ||
if 'OPT' in os.environ: | ||
from distutils.sysconfig import get_config_vars | ||
# XXX who uses this? | ||
from sysconfig import get_config_vars | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When is |
||
opt = " ".join(os.environ['OPT'].split()) | ||
gcv_opt = " ".join(get_config_vars('OPT')[0].split()) | ||
ccomp_s = " ".join(self.compiler_so) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -367,18 +367,6 @@ def test_all_modules_are_expected(): | |
SKIP_LIST_2 = [ | ||
'numpy.math', | ||
'numpy.distutils.log.sys', | ||
'numpy.distutils.system_info.copy', | ||
'numpy.distutils.system_info.distutils', | ||
'numpy.distutils.system_info.log', | ||
'numpy.distutils.system_info.os', | ||
'numpy.distutils.system_info.platform', | ||
'numpy.distutils.system_info.re', | ||
'numpy.distutils.system_info.shutil', | ||
'numpy.distutils.system_info.subprocess', | ||
'numpy.distutils.system_info.sys', | ||
'numpy.distutils.system_info.tempfile', | ||
'numpy.distutils.system_info.textwrap', | ||
'numpy.distutils.system_info.warnings', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that |
||
'numpy.doc.constants.re', | ||
'numpy.doc.constants.textwrap', | ||
'numpy.lib.emath', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -372,7 +372,7 @@ def build_project(args): | |
|
||
""" | ||
|
||
import distutils.sysconfig | ||
import sysconfig | ||
|
||
root_ok = [os.path.exists(os.path.join(ROOT_DIR, fn)) | ||
for fn in PROJECT_ROOT_FILES] | ||
|
@@ -388,7 +388,7 @@ def build_project(args): | |
|
||
# Always use ccache, if installed | ||
env['PATH'] = os.pathsep.join(EXTRA_PATH + env.get('PATH', '').split(os.pathsep)) | ||
cvars = distutils.sysconfig.get_config_vars() | ||
cvars = sysconfig.get_config_vars() | ||
compiler = env.get('CC') or cvars.get('CC', '') | ||
if 'gcc' in compiler: | ||
# Check that this isn't clang masquerading as gcc. | ||
|
@@ -445,7 +445,7 @@ def build_project(args): | |
os.makedirs(site_dir) | ||
if not os.path.exists(site_dir_noarch): | ||
os.makedirs(site_dir_noarch) | ||
env['PYTHONPATH'] = site_dir + ':' + site_dir_noarch | ||
env['PYTHONPATH'] = site_dir + os.pathsep + site_dir_noarch | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This mistake makes me suspicious - do we really need to set |
||
|
||
log_filename = os.path.join(ROOT_DIR, 'build.log') | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file was missing an
__all__
, so it was re-exporting imported modules.