mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
Issue #28046: Remove platform-specific directories from sys.path
This commit is contained in:
parent
b44acebc7b
commit
c4b53afce4
10 changed files with 24 additions and 37 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue