Skip to content

Commit 2def21c

Browse files
authored
Merge pull request #92 from lazka/use-stdlib-get_makefile_filename
sysconfig: use get_makefile_filename() from stdlib sysconfig
2 parents fd06c22 + 62ed952 commit 2def21c

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

distutils/sysconfig.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -281,25 +281,9 @@ def get_config_h_filename():
281281

282282

283283

284-
# Allow this value to be patched by pkgsrc. Ref pypa/distutils#16.
285-
_makefile_tmpl = 'config-{python_ver}{build_flags}{multiarch}'
286-
287-
288284
def get_makefile_filename():
289285
"""Return full pathname of installed Makefile from the Python build."""
290-
if python_build:
291-
return os.path.join(_sys_home or project_base, "Makefile")
292-
lib_dir = get_python_lib(plat_specific=0, standard_lib=1)
293-
multiarch = (
294-
'-%s' % sys.implementation._multiarch
295-
if hasattr(sys.implementation, '_multiarch') else ''
296-
)
297-
config_file = _makefile_tmpl.format(
298-
python_ver=get_python_version(),
299-
build_flags=build_flags,
300-
multiarch=multiarch,
301-
)
302-
return os.path.join(lib_dir, config_file, 'Makefile')
286+
return sysconfig.get_makefile_filename()
303287

304288

305289
def parse_config_h(fp, g=None):

distutils/tests/test_sysconfig.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ def test_get_config_h_filename(self):
3838
config_h = sysconfig.get_config_h_filename()
3939
self.assertTrue(os.path.isfile(config_h), config_h)
4040

41+
@unittest.skipIf(sys.platform == 'win32',
42+
'Makefile only exists on Unix like systems')
43+
def test_get_makefile_filename(self):
44+
makefile = sysconfig.get_makefile_filename()
45+
self.assertTrue(os.path.isfile(makefile), makefile)
46+
4147
def test_get_python_lib(self):
4248
# XXX doesn't work on Linux when Python was never installed before
4349
#self.assertTrue(os.path.isdir(lib_dir), lib_dir)

0 commit comments

Comments
 (0)