Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

GH-127429: fix sysconfig data generation on cross-builds #127430

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

Merged
merged 12 commits into from
Dec 2, 2024
Prev Previous commit
Next Next commit
Load the prefixes for sysconfig data from the Makefile when cross-com…
…piling

Signed-off-by: Filipe Laíns <lains@riseup.net>
  • Loading branch information
FFY00 committed Nov 30, 2024
commit 53dbc14432ebbd1b2fd4a454d95e4c31ef1bbeb3
37 changes: 26 additions & 11 deletions 37 Lib/sysconfig/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,18 +472,38 @@ def get_path(name, scheme=get_default_scheme(), vars=None, expand=True):
def _init_config_vars():
global _CONFIG_VARS
_CONFIG_VARS = {}

if os.name == 'nt':
_init_non_posix(_CONFIG_VARS)
_CONFIG_VARS['VPATH'] = sys._vpath
if os.name == 'posix':
_init_posix(_CONFIG_VARS)

# If we are cross-compiling, load the prefixes from the Makefile instead.
# (only available on POSIX)
if '_PYTHON_PROJECT_BASE' in os.environ and os.name == 'posix':
prefix = _CONFIG_VARS['prefix']
exec_prefix = _CONFIG_VARS['exec_prefix']
base_prefix = _CONFIG_VARS['prefix']
base_exec_prefix = _CONFIG_VARS['exec_prefix']
else:
prefix = _PREFIX
exec_prefix = _EXEC_PREFIX
base_prefix = _BASE_PREFIX
base_exec_prefix = _BASE_EXEC_PREFIX

# Normalized versions of prefix and exec_prefix are handy to have;
# in fact, these are the standard versions used most places in the
# Distutils.
_CONFIG_VARS['prefix'] = _PREFIX
_CONFIG_VARS['exec_prefix'] = _EXEC_PREFIX
_CONFIG_VARS['prefix'] = prefix
_CONFIG_VARS['exec_prefix'] = exec_prefix
_CONFIG_VARS['py_version'] = _PY_VERSION
_CONFIG_VARS['py_version_short'] = _PY_VERSION_SHORT
_CONFIG_VARS['py_version_nodot'] = _PY_VERSION_SHORT_NO_DOT
_CONFIG_VARS['installed_base'] = _BASE_PREFIX
_CONFIG_VARS['base'] = _PREFIX
_CONFIG_VARS['installed_platbase'] = _BASE_EXEC_PREFIX
_CONFIG_VARS['platbase'] = _EXEC_PREFIX
_CONFIG_VARS['installed_base'] = base_prefix
_CONFIG_VARS['base'] = prefix
_CONFIG_VARS['installed_platbase'] = base_exec_prefix
_CONFIG_VARS['platbase'] = exec_prefix
_CONFIG_VARS['projectbase'] = _PROJECT_BASE
_CONFIG_VARS['platlibdir'] = sys.platlibdir
_CONFIG_VARS['implementation'] = _get_implementation()
Expand All @@ -498,11 +518,6 @@ def _init_config_vars():
except AttributeError:
_CONFIG_VARS['py_version_nodot_plat'] = ''

if os.name == 'nt':
_init_non_posix(_CONFIG_VARS)
_CONFIG_VARS['VPATH'] = sys._vpath
if os.name == 'posix':
_init_posix(_CONFIG_VARS)
if _HAS_USER_BASE:
# Setting 'userbase' is done below the call to the
# init function to enable using 'get_config_var' in
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.