| This is like python-2.7.10-cross-distutils.patch, but we update the sysconfig |
| module instead of the distutils.sysconfig module. Python ships two different |
| modules with strong overlap in functionality. |
| |
| --- a/Lib/sysconfig.py |
| +++ b/Lib/sysconfig.py |
| @@ -7,10 +7,10 @@ from os.path import pardir, realpath |
| |
| _INSTALL_SCHEMES = { |
| 'posix_prefix': { |
| - 'stdlib': '{base}/@@GENTOO_LIBDIR@@/python{py_version_short}', |
| - 'platstdlib': '{platbase}/@@GENTOO_LIBDIR@@/python{py_version_short}', |
| - 'purelib': '{base}/@@GENTOO_LIBDIR@@/python{py_version_short}/site-packages', |
| - 'platlib': '{platbase}/@@GENTOO_LIBDIR@@/python{py_version_short}/site-packages', |
| + 'stdlib': '{base}/{libdirname}/python{py_version_short}', |
| + 'platstdlib': '{platbase}/{libdirname}/python{py_version_short}', |
| + 'purelib': '{base}/{libdirname}/python{py_version_short}/site-packages', |
| + 'platlib': '{platbase}/{libdirname}/python{py_version_short}/site-packages', |
| 'include': '{base}/include/python{py_version_short}', |
| 'platinclude': '{platbase}/include/python{py_version_short}', |
| 'scripts': '{base}/bin', |
| @@ -65,10 +65,10 @@ _INSTALL_SCHEMES = { |
| 'data' : '{userbase}', |
| }, |
| 'posix_user': { |
| - 'stdlib': '{userbase}/@@GENTOO_LIBDIR@@/python{py_version_short}', |
| - 'platstdlib': '{userbase}/@@GENTOO_LIBDIR@@/python{py_version_short}', |
| - 'purelib': '{userbase}/@@GENTOO_LIBDIR@@/python{py_version_short}/site-packages', |
| - 'platlib': '{userbase}/@@GENTOO_LIBDIR@@/python{py_version_short}/site-packages', |
| + 'stdlib': '{userbase}/{libdirname}/python{py_version_short}', |
| + 'platstdlib': '{userbase}/{libdirname}/python{py_version_short}', |
| + 'purelib': '{userbase}/{libdirname}/python{py_version_short}/site-packages', |
| + 'platlib': '{userbase}/{libdirname}/python{py_version_short}/site-packages', |
| 'include': '{userbase}/include/python{py_version_short}', |
| 'scripts': '{userbase}/bin', |
| 'data' : '{userbase}', |
| @@ -358,7 +358,16 @@ 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() |
| - from _sysconfigdata import build_time_vars |
| + if '_PYTHON_PROJECT_BASE' not in os.environ and os.getenv('SYSROOT'): |
| + lib_dir = get_path('platstdlib') |
| + sysconfig_path = os.path.join(lib_dir, '_sysconfigdata.py') |
| + import imp |
| + if not os.path.exists(sysconfig_path): |
| + _, sysconfig_path, _ = imp.find_module('_sysconfigdata') |
| + sysconfig_module = imp.load_source('_sysconfigdata', sysconfig_path) |
| + build_time_vars = sysconfig_module.build_time_vars |
| + else: |
| + from _sysconfigdata import build_time_vars |
| vars.update(build_time_vars) |
| |
| def _init_non_posix(vars): |
| @@ -471,7 +480,16 @@ def get_config_vars(*args): |
| _CONFIG_VARS['base'] = _PREFIX |
| _CONFIG_VARS['platbase'] = _EXEC_PREFIX |
| _CONFIG_VARS['projectbase'] = _PROJECT_BASE |
| + _CONFIG_VARS['srcdir'] = _PROJECT_BASE |
| |
| + libdir = None |
| + if '_PYTHON_PROJECT_BASE' not in os.environ and os.getenv('SYSROOT'): |
| + abi = os.getenv('ABI') |
| + libdir = os.getenv('LIBDIR_%s' % abi) |
| + if not libdir: |
| + libdir = '@@GENTOO_LIBDIR@@' |
| + _CONFIG_VARS['libdirname'] = libdir |
| + |
| if os.name in ('nt', 'os2'): |
| _init_non_posix(_CONFIG_VARS) |
| if os.name == 'posix': |
| @@ -495,9 +513,6 @@ |
| # the init-function. |
| _CONFIG_VARS['userbase'] = _getuserbase() |
| |
| - if 'srcdir' not in _CONFIG_VARS: |
| - _CONFIG_VARS['srcdir'] = _PROJECT_BASE |
| - |
| # Convert srcdir into an absolute path if it appears necessary. |
| # Normally it is relative to the build directory. However, during |
| # testing, for example, we might be running a non-installed python |