summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2010-09-20 15:29:53 (GMT)
committerBarry Warsaw <barry@python.org>2010-09-20 15:29:53 (GMT)
commitebbef6fef2e1c70aaa23ee27dcfc237545dee5d5 (patch)
tree3db4f4633663af56b9db644cb4f7ff4830bbe42f
parent18cc344c0f98e6b2fe9d7181ae8f1aaa5bcca430 (diff)
downloadcpython-ebbef6fef2e1c70aaa23ee27dcfc237545dee5d5.zip
cpython-ebbef6fef2e1c70aaa23ee27dcfc237545dee5d5.tar.gz
cpython-ebbef6fef2e1c70aaa23ee27dcfc237545dee5d5.tar.bz2
Issue 9877: expose sysconfig.get_makefile_filename() in the public API.
-rw-r--r--Doc/library/sysconfig.rst4
-rw-r--r--Lib/sysconfig.py20
-rw-r--r--Lib/test/test_sysconfig.py4
-rw-r--r--Misc/NEWS2
4 files changed, 25 insertions, 5 deletions
diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst
index f3194f8..773480b 100644
--- a/Doc/library/sysconfig.rst
+++ b/Doc/library/sysconfig.rst
@@ -217,6 +217,10 @@ Other functions
Return the path of :file:`pyconfig.h`.
+.. function:: get_makefile_filename()
+
+ Return the path of :file:`Makefile`.
+
Using :mod:`sysconfig` as a script
----------------------------------
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index 147bd6d..730718a 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -5,9 +5,19 @@ import sys
import os
from os.path import pardir, realpath
-__all__ = ['parse_config_h', 'get_config_h_filename', 'get_scheme_names',
- 'get_path_names', 'get_paths', 'get_path', 'get_config_vars',
- 'get_config_var', 'get_platform', 'get_python_version']
+__all__ = [
+ 'get_config_h_filename',
+ 'get_config_var',
+ 'get_config_vars',
+ 'get_makefile_filename',
+ 'get_path',
+ 'get_path_names',
+ 'get_paths',
+ 'get_platform',
+ 'get_python_version',
+ 'get_scheme_names',
+ 'parse_config_h',
+ ]
_INSTALL_SCHEMES = {
'posix_prefix': {
@@ -291,7 +301,7 @@ def _parse_makefile(filename, vars=None):
return vars
-def _get_makefile_filename():
+def get_makefile_filename():
if _PYTHON_BUILD:
return os.path.join(_PROJECT_BASE, "Makefile")
return os.path.join(get_path('stdlib'), "config", "Makefile")
@@ -300,7 +310,7 @@ def _get_makefile_filename():
def _init_posix(vars):
"""Initialize the module as appropriate for POSIX systems."""
# load the installed Makefile:
- makefile = _get_makefile_filename()
+ makefile = get_makefile_filename()
try:
_parse_makefile(makefile, vars)
except IOError as e:
diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py
index 0538592..e509989 100644
--- a/Lib/test/test_sysconfig.py
+++ b/Lib/test/test_sysconfig.py
@@ -234,6 +234,10 @@ class TestSysConfig(unittest.TestCase):
config_h = sysconfig.get_config_h_filename()
self.assertTrue(os.path.isfile(config_h), config_h)
+ def test_get_makefile_filename(self):
+ makefile = sysconfig.get_makefile_filename()
+ self.assertTrue(os.path.isfile(makefile), makefile)
+
def test_get_scheme_names(self):
wanted = ('nt', 'nt_user', 'os2', 'os2_home', 'osx_framework_user',
'posix_home', 'posix_prefix', 'posix_user')
diff --git a/Misc/NEWS b/Misc/NEWS
index 5cac5dc..61279ec 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -55,6 +55,8 @@ Core and Builtins
Library
-------
+- Issue #9877: Expose sysconfig.get_makefile_filename()
+
- logging: Added hasHandlers() method to Logger and LoggerAdapter.
- Issue #1686: Fix string.Template when overriding the pattern attribute.