Skip to content

Commit 0184295

Browse files
committed
Fix get_config_var('abiflags') in cross-builds
Signed-off-by: Filipe Laíns <lains@riseup.net>
1 parent cc4f57a commit 0184295

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Lib/sysconfig/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,11 @@ def _init_config_vars():
478478
base_prefix = _BASE_PREFIX
479479
base_exec_prefix = _BASE_EXEC_PREFIX
480480

481+
try:
482+
abiflags = sys.abiflags
483+
except AttributeError:
484+
abiflags = ''
485+
481486
if os.name == 'posix':
482487
_init_posix(_CONFIG_VARS)
483488
# If we are cross-compiling, load the prefixes from the Makefile instead.
@@ -486,6 +491,7 @@ def _init_config_vars():
486491
exec_prefix = _CONFIG_VARS['exec_prefix']
487492
base_prefix = _CONFIG_VARS['prefix']
488493
base_exec_prefix = _CONFIG_VARS['exec_prefix']
494+
abiflags = _CONFIG_VARS['ABIFLAGS']
489495

490496
# Normalized versions of prefix and exec_prefix are handy to have;
491497
# in fact, these are the standard versions used most places in the
@@ -503,11 +509,7 @@ def _init_config_vars():
503509
_CONFIG_VARS['platlibdir'] = sys.platlibdir
504510
_CONFIG_VARS['implementation'] = _get_implementation()
505511
_CONFIG_VARS['implementation_lower'] = _get_implementation().lower()
506-
try:
507-
_CONFIG_VARS['abiflags'] = sys.abiflags
508-
except AttributeError:
509-
# sys.abiflags may not be defined on all platforms.
510-
_CONFIG_VARS['abiflags'] = ''
512+
_CONFIG_VARS['abiflags'] = abiflags
511513
try:
512514
_CONFIG_VARS['py_version_nodot_plat'] = sys.winver.replace('.', '')
513515
except AttributeError:

0 commit comments

Comments
 (0)