diff --git a/distutils/sysconfig.py b/distutils/sysconfig.py index d36d94f7..2bd18aff 100644 --- a/distutils/sysconfig.py +++ b/distutils/sysconfig.py @@ -13,6 +13,7 @@ import os import re import sys +import sysconfig from .errors import DistutilsPlatformError @@ -280,25 +281,11 @@ def get_config_h_filename(): return os.path.join(inc_dir, 'pyconfig.h') -# Allow this value to be patched by pkgsrc. Ref pypa/distutils#16. -_makefile_tmpl = 'config-{python_ver}{build_flags}{multiarch}' - - def get_makefile_filename(): """Return full pathname of installed Makefile from the Python build.""" if python_build: return os.path.join(_sys_home or project_base, "Makefile") - lib_dir = get_python_lib(plat_specific=0, standard_lib=1) - multiarch = ( - '-%s' % sys.implementation._multiarch - if hasattr(sys.implementation, '_multiarch') else '' - ) - config_file = _makefile_tmpl.format( - python_ver=get_python_version(), - build_flags=build_flags, - multiarch=multiarch, - ) - return os.path.join(lib_dir, config_file, 'Makefile') + return sysconfig.get_makefile_filename() def parse_config_h(fp, g=None): diff --git a/distutils/tests/test_sysconfig.py b/distutils/tests/test_sysconfig.py index 80cd1599..7adff227 100644 --- a/distutils/tests/test_sysconfig.py +++ b/distutils/tests/test_sysconfig.py @@ -38,6 +38,12 @@ def test_get_config_h_filename(self): config_h = sysconfig.get_config_h_filename() self.assertTrue(os.path.isfile(config_h), config_h) + @unittest.skipIf(sys.platform == 'win32', + 'Makefile only exists on Unix like systems') + def test_get_makefile_filename(self): + makefile = sysconfig.get_makefile_filename() + self.assertTrue(os.path.isfile(makefile), makefile) + def test_get_python_lib(self): # XXX doesn't work on Linux when Python was never installed before #self.assertTrue(os.path.isdir(lib_dir), lib_dir)