[Python-checkins] cpython (2.7): Issue #22199: Make get_makefile_filename() available in Lib/sysconfig.py

ned.deily python-checkins at python.org
Fri Aug 22 22:49:42 CEST 2014


http://hg.python.org/cpython/rev/c57cf191e759
changeset:   92198:c57cf191e759
branch:      2.7
parent:      92195:edb6b282469e
user:        Ned Deily <nad at acm.org>
date:        Fri Aug 22 13:48:06 2014 -0700
summary:
  Issue #22199: Make get_makefile_filename() available in Lib/sysconfig.py
for 2.7 to match other versions of sysconfig.

files:
  Doc/library/sysconfig.rst  |  4 ++++
  Lib/sysconfig.py           |  8 ++++++--
  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
--- a/Doc/library/sysconfig.rst
+++ b/Doc/library/sysconfig.rst
@@ -221,3 +221,7 @@
 .. 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
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -273,17 +273,21 @@
     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
--- a/Lib/test/test_sysconfig.py
+++ b/Lib/test/test_sysconfig.py
@@ -243,6 +243,14 @@
                   '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")

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list