@@ -280,14 +280,24 @@ def get_config_h_filename():
280280 return os .path .join (inc_dir , 'pyconfig.h' )
281281
282282
283+ # Allow this value to be patched by pkgsrc. Ref pypa/distutils#16.
284+ _makefile_tmpl = 'config-{python_ver}{build_flags}{multiarch}'
285+
286+
283287def get_makefile_filename ():
284288 """Return full pathname of installed Makefile from the Python build."""
285289 if python_build :
286290 return os .path .join (_sys_home or project_base , "Makefile" )
287291 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+ )
291301 return os .path .join (lib_dir , config_file , 'Makefile' )
292302
293303
@@ -459,15 +469,21 @@ def expand_makefile_vars(s, vars):
459469
460470_config_vars = None
461471
472+
473+ _sysconfig_name_tmpl = '_sysconfigdata_{abi}_{platform}_{multiarch}'
474+
475+
462476def _init_posix ():
463477 """Initialize the module as appropriate for POSIX systems."""
464478 # _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+ )
471487 try :
472488 _temp = __import__ (name , globals (), locals (), ['build_time_vars' ], 0 )
473489 except ImportError :
0 commit comments