summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1999-01-06 16:28:34 (GMT)
committerFred Drake <fdrake@acm.org>1999-01-06 16:28:34 (GMT)
commit522af3a126b2dcd0fa7c04d1fabfe7b231a452bb (patch)
treeec2865a7565fd8cc4c490517499feedc1abfb962 /Lib
parentc553358c63b0acdbe2433033d36f1fd7b7ac5e04 (diff)
downloadcpython-522af3a126b2dcd0fa7c04d1fabfe7b231a452bb.zip
cpython-522af3a126b2dcd0fa7c04d1fabfe7b231a452bb.tar.gz
cpython-522af3a126b2dcd0fa7c04d1fabfe7b231a452bb.tar.bz2
Update and add docstrings.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/sysconfig.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 1d8231a..04551a7 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -1,8 +1,5 @@
-"""Prototype sysconfig module that loads information when run as a script,
-but only defines constants when imported.
-
-This should be run as a script as one of the last steps of the Python
-installation process.
+"""Provide access to Python's configuration information. The specific names
+defined in the module depend heavily on the platform and configuration.
Written by: Fred L. Drake, Jr.
Email: <fdrake@acm.org>
@@ -18,14 +15,20 @@ import sys
def get_config_h_filename():
+ """Return full pathname of installed config.h file."""
return os.path.join(sys.exec_prefix, "lib", "python" + sys.version[:3],
"config", "config.h")
def get_makefile_filename():
+ """Return full pathname of installed Makefile from the Python build."""
return os.path.join(sys.exec_prefix, "lib", "python" + sys.version[:3],
"config", "Makefile")
def parse_config_h(fp, g=None):
+ """Parse a config.h-style file. A dictionary containing name/value
+ pairs is returned. If an optional dictionary is passed in as the second
+ argument, it is used instead of a new dictionary.
+ """
if g is None:
g = {}
define_rx = re.compile("#define ([A-Z][A-Z0-9_]+) (.*)\n")
@@ -48,6 +51,10 @@ def parse_config_h(fp, g=None):
return g
def parse_makefile(fp, g=None):
+ """Parse a Makefile-style file. A dictionary containing name/value
+ pairs is returned. If an optional dictionary is passed in as the second
+ argument, it is used instead of a new dictionary.
+ """
if g is None:
g = {}
variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)\n")
@@ -114,6 +121,7 @@ def parse_makefile(fp, g=None):
def _init_posix():
+ """Initialize the module as appropriate for POSIX systems."""
g = globals()
# load the installed config.h:
parse_config_h(open(get_config_h_filename()), g)