@@ -280,14 +280,24 @@ def get_config_h_filename():
280
280
return os .path .join (inc_dir , 'pyconfig.h' )
281
281
282
282
283
+ # Allow this value to be patched by pkgsrc. Ref pypa/distutils#16.
284
+ _makefile_tmpl = 'config-{python_ver}{build_flags}{multiarch}'
285
+
286
+
283
287
def get_makefile_filename ():
284
288
"""Return full pathname of installed Makefile from the Python build."""
285
289
if python_build :
286
290
return os .path .join (_sys_home or project_base , "Makefile" )
287
291
lib_dir = get_python_lib (plat_specific = 0 , standard_lib = 1 )
288
- config_file = 'config-{}{}' .format (get_python_version (), build_flags )
289
- if hasattr (sys .implementation , '_multiarch' ):
290
- config_file += '-%s' % sys .implementation ._multiarch
292
+ multiarch = (
293
+ '-%s' % sys .implementation ._multiarch
294
+ if hasattr (sys .implementation , '_multiarch' ) else ''
295
+ )
296
+ config_file = _makefile_tmpl .format (
297
+ python_ver = get_python_version (),
298
+ build_flags = build_flags ,
299
+ multiarch = multiarch ,
300
+ )
291
301
return os .path .join (lib_dir , config_file , 'Makefile' )
292
302
293
303
@@ -459,15 +469,21 @@ def expand_makefile_vars(s, vars):
459
469
460
470
_config_vars = None
461
471
472
+
473
+ _sysconfig_name_tmpl = '_sysconfigdata_{abi}_{platform}_{multiarch}'
474
+
475
+
462
476
def _init_posix ():
463
477
"""Initialize the module as appropriate for POSIX systems."""
464
478
# _sysconfigdata is generated at build time, see the sysconfig module
465
- name = os .environ .get ('_PYTHON_SYSCONFIGDATA_NAME' ,
466
- '_sysconfigdata_{abi}_{platform}_{multiarch}' .format (
467
- abi = sys .abiflags ,
468
- platform = sys .platform ,
469
- multiarch = getattr (sys .implementation , '_multiarch' , '' ),
470
- ))
479
+ name = os .environ .get (
480
+ '_PYTHON_SYSCONFIGDATA_NAME' ,
481
+ _sysconfig_name_tmpl .format (
482
+ abi = sys .abiflags ,
483
+ platform = sys .platform ,
484
+ multiarch = getattr (sys .implementation , '_multiarch' , '' ),
485
+ ),
486
+ )
471
487
try :
472
488
_temp = __import__ (name , globals (), locals (), ['build_time_vars' ], 0 )
473
489
except ImportError :
0 commit comments