summaryrefslogtreecommitdiffstats
path: root/Lib/sysconfig.py
diff options
context:
space:
mode:
authorZachary Ware <zachary.ware@gmail.com>2016-09-10 00:59:49 (GMT)
committerZachary Ware <zachary.ware@gmail.com>2016-09-10 00:59:49 (GMT)
commitc4b53afce491142b80b228a21a05de5dcfd8d36f (patch)
tree4fd78ef4e4fcabc46bbff33825cf7ffba4c64e58 /Lib/sysconfig.py
parentb44acebc7bdde44dc1f952a8fa498a155a35e509 (diff)
downloadcpython-c4b53afce491142b80b228a21a05de5dcfd8d36f.zip
cpython-c4b53afce491142b80b228a21a05de5dcfd8d36f.tar.gz
cpython-c4b53afce491142b80b228a21a05de5dcfd8d36f.tar.bz2
Issue #28046: Remove platform-specific directories from sys.path
Diffstat (limited to 'Lib/sysconfig.py')
-rw-r--r--Lib/sysconfig.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index 7b78440..c2f28f5 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -341,6 +341,15 @@ def get_makefile_filename():
config_dir_name += '-%s' % sys.implementation._multiarch
return os.path.join(get_path('stdlib'), config_dir_name, 'Makefile')
+
+def _get_sysconfigdata_name():
+ return '_sysconfigdata_{abi}_{platform}_{multiarch}'.format(
+ abi=sys.abiflags,
+ platform=sys.platform,
+ multiarch=getattr(sys.implementation, '_multiarch', ''),
+ )
+
+
def _generate_posix_vars():
"""Generate the Python module containing build-time variables."""
import pprint
@@ -381,7 +390,7 @@ def _generate_posix_vars():
# _sysconfigdata module manually and populate it with the build vars.
# This is more than sufficient for ensuring the subsequent call to
# get_platform() succeeds.
- name = '_sysconfigdata_' + sys.abiflags
+ name = _get_sysconfigdata_name()
if 'darwin' in sys.platform:
import types
module = types.ModuleType(name)
@@ -407,7 +416,7 @@ def _generate_posix_vars():
def _init_posix(vars):
"""Initialize the module as appropriate for POSIX systems."""
# _sysconfigdata is generated at build time, see _generate_posix_vars()
- name = '_sysconfigdata_' + sys.abiflags
+ name = _get_sysconfigdata_name()
_temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
build_time_vars = _temp.build_time_vars
vars.update(build_time_vars)