diff options
author | Ned Deily <nad@acm.org> | 2014-08-22 20:48:06 (GMT) |
---|---|---|
committer | Ned Deily <nad@acm.org> | 2014-08-22 20:48:06 (GMT) |
commit | 9d6488a1f0c9fcc984757a94ba794ca8fd7bbf8f (patch) | |
tree | ab4a7852a5001c5a434bc7629f0cbf6603f45f04 | |
parent | 983df8688d6add6d7f35388eac97d5ecd1c8017f (diff) | |
download | cpython-9d6488a1f0c9fcc984757a94ba794ca8fd7bbf8f.zip cpython-9d6488a1f0c9fcc984757a94ba794ca8fd7bbf8f.tar.gz cpython-9d6488a1f0c9fcc984757a94ba794ca8fd7bbf8f.tar.bz2 |
Issue #22199: Make get_makefile_filename() available in Lib/sysconfig.py
for 2.7 to match other versions of sysconfig.
-rw-r--r-- | Doc/library/sysconfig.rst | 4 | ||||
-rw-r--r-- | Lib/sysconfig.py | 8 | ||||
-rw-r--r-- | Lib/test/test_sysconfig.py | 8 |
3 files changed, 18 insertions, 2 deletions
diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst index a745a3d..9dd0b1e 100644 --- a/Doc/library/sysconfig.rst +++ b/Doc/library/sysconfig.rst @@ -221,3 +221,7 @@ Other functions .. function:: get_config_h_filename() Return the path of :file:`pyconfig.h`. + +.. function:: get_makefile_filename() + + Return the path of :file:`Makefile`. diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py index aa69351..2a1da5a 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -273,17 +273,21 @@ def _parse_makefile(filename, vars=None): return vars -def _get_makefile_filename(): +def get_makefile_filename(): + """Return the path of the Makefile.""" if _PYTHON_BUILD: return os.path.join(_PROJECT_BASE, "Makefile") return os.path.join(get_path('platstdlib'), "config", "Makefile") +# Issue #22199: retain undocumented private name for compatibility +_get_makefile_filename = get_makefile_filename + def _generate_posix_vars(): """Generate the Python module containing build-time variables.""" import pprint vars = {} # load the installed Makefile: - makefile = _get_makefile_filename() + makefile = get_makefile_filename() try: _parse_makefile(makefile, vars) except IOError, e: diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index 755f35f..a0b65df 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -243,6 +243,14 @@ class TestSysConfig(unittest.TestCase): 'posix_home', 'posix_prefix', 'posix_user') self.assertEqual(get_scheme_names(), wanted) + @unittest.skipIf(sys.platform.startswith('win'), + 'Test is not Windows compatible') + def test_get_makefile_filename(self): + makefile = sysconfig.get_makefile_filename() + self.assertTrue(os.path.isfile(makefile), makefile) + # Issue 22199 + self.assertEqual(sysconfig._get_makefile_filename(), makefile) + def test_symlink(self): # Issue 7880 symlink = get_attribute(os, "symlink") |