Mike Frysinger | 935ee6f | 2019-09-06 14:38:15 -0400 | [diff] [blame^] | 1 | This is like python-2.7.10-cross-distutils.patch, but we update the sysconfig |
| 2 | module instead of the distutils.sysconfig module. Python ships two different |
| 3 | modules with strong overlap in functionality. |
| 4 | |
| 5 | --- a/Lib/sysconfig.py |
| 6 | +++ b/Lib/sysconfig.py |
| 7 | @@ -7,10 +7,10 @@ from os.path import pardir, realpath |
| 8 | |
| 9 | _INSTALL_SCHEMES = { |
| 10 | 'posix_prefix': { |
| 11 | - 'stdlib': '{base}/@@GENTOO_LIBDIR@@/python{py_version_short}', |
| 12 | - 'platstdlib': '{platbase}/@@GENTOO_LIBDIR@@/python{py_version_short}', |
| 13 | - 'purelib': '{base}/@@GENTOO_LIBDIR@@/python{py_version_short}/site-packages', |
| 14 | - 'platlib': '{platbase}/@@GENTOO_LIBDIR@@/python{py_version_short}/site-packages', |
| 15 | + 'stdlib': '{base}/{libdirname}/python{py_version_short}', |
| 16 | + 'platstdlib': '{platbase}/{libdirname}/python{py_version_short}', |
| 17 | + 'purelib': '{base}/{libdirname}/python{py_version_short}/site-packages', |
| 18 | + 'platlib': '{platbase}/{libdirname}/python{py_version_short}/site-packages', |
| 19 | 'include': '{base}/include/python{py_version_short}', |
| 20 | 'platinclude': '{platbase}/include/python{py_version_short}', |
| 21 | 'scripts': '{base}/bin', |
| 22 | @@ -65,10 +65,10 @@ _INSTALL_SCHEMES = { |
| 23 | 'data' : '{userbase}', |
| 24 | }, |
| 25 | 'posix_user': { |
| 26 | - 'stdlib': '{userbase}/@@GENTOO_LIBDIR@@/python{py_version_short}', |
| 27 | - 'platstdlib': '{userbase}/@@GENTOO_LIBDIR@@/python{py_version_short}', |
| 28 | - 'purelib': '{userbase}/@@GENTOO_LIBDIR@@/python{py_version_short}/site-packages', |
| 29 | - 'platlib': '{userbase}/@@GENTOO_LIBDIR@@/python{py_version_short}/site-packages', |
| 30 | + 'stdlib': '{userbase}/{libdirname}/python{py_version_short}', |
| 31 | + 'platstdlib': '{userbase}/{libdirname}/python{py_version_short}', |
| 32 | + 'purelib': '{userbase}/{libdirname}/python{py_version_short}/site-packages', |
| 33 | + 'platlib': '{userbase}/{libdirname}/python{py_version_short}/site-packages', |
| 34 | 'include': '{userbase}/include/python{py_version_short}', |
| 35 | 'scripts': '{userbase}/bin', |
| 36 | 'data' : '{userbase}', |
| 37 | @@ -358,7 +358,16 @@ def _generate_posix_vars(): |
| 38 | def _init_posix(vars): |
| 39 | """Initialize the module as appropriate for POSIX systems.""" |
| 40 | # _sysconfigdata is generated at build time, see _generate_posix_vars() |
| 41 | - from _sysconfigdata import build_time_vars |
| 42 | + if '_PYTHON_PROJECT_BASE' not in os.environ and os.getenv('SYSROOT'): |
| 43 | + lib_dir = get_path('platstdlib') |
| 44 | + sysconfig_path = os.path.join(lib_dir, '_sysconfigdata.py') |
| 45 | + import imp |
| 46 | + if not os.path.exists(sysconfig_path): |
| 47 | + _, sysconfig_path, _ = imp.find_module('_sysconfigdata') |
| 48 | + sysconfig_module = imp.load_source('_sysconfigdata', sysconfig_path) |
| 49 | + build_time_vars = sysconfig_module.build_time_vars |
| 50 | + else: |
| 51 | + from _sysconfigdata import build_time_vars |
| 52 | vars.update(build_time_vars) |
| 53 | |
| 54 | def _init_non_posix(vars): |
| 55 | @@ -471,7 +480,16 @@ def get_config_vars(*args): |
| 56 | _CONFIG_VARS['base'] = _PREFIX |
| 57 | _CONFIG_VARS['platbase'] = _EXEC_PREFIX |
| 58 | _CONFIG_VARS['projectbase'] = _PROJECT_BASE |
| 59 | + _CONFIG_VARS['srcdir'] = _PROJECT_BASE |
| 60 | |
| 61 | + libdir = None |
| 62 | + if '_PYTHON_PROJECT_BASE' not in os.environ and os.getenv('SYSROOT'): |
| 63 | + abi = os.getenv('ABI') |
| 64 | + libdir = os.getenv('LIBDIR_%s' % abi) |
| 65 | + if not libdir: |
| 66 | + libdir = '@@GENTOO_LIBDIR@@' |
| 67 | + _CONFIG_VARS['libdirname'] = libdir |
| 68 | + |
| 69 | if os.name in ('nt', 'os2'): |
| 70 | _init_non_posix(_CONFIG_VARS) |
| 71 | if os.name == 'posix': |
| 72 | @@ -495,9 +513,6 @@ |
| 73 | # the init-function. |
| 74 | _CONFIG_VARS['userbase'] = _getuserbase() |
| 75 | |
| 76 | - if 'srcdir' not in _CONFIG_VARS: |
| 77 | - _CONFIG_VARS['srcdir'] = _PROJECT_BASE |
| 78 | - |
| 79 | # Convert srcdir into an absolute path if it appears necessary. |
| 80 | # Normally it is relative to the build directory. However, during |
| 81 | # testing, for example, we might be running a non-installed python |