There are a few places which can raise DistutilsPlatformError; make

sure it's imported!  ;)

Re-wrap the docstrings on get_python_inc() and get_python_lib() to be
closer to the "normal" Python style.  See GvR's "style guide" on the
essays page (http://www.python.org/doc/essays/).

There should never be a space between a function name and the '(' that
opens the argument list (see the style guide again).
This commit is contained in:
Fred Drake 2000-03-09 15:54:52 +00:00
parent 7d73b9eb18
commit c1ee39a99e

View file

@ -13,17 +13,22 @@ import re
import string
import sys
from errors import DistutilsPlatformError
prefix = os.path.normpath(sys.prefix)
exec_prefix = os.path.normpath(sys.exec_prefix)
def get_python_inc(plat_specific=0):
"""Return the directory containing installed Python header files.
If 'plat_specific' is false (the default), this is the path to the
non-platform-specific header files, i.e. Python.h and so on;
otherwise, this is the path to platform-specific header files
(namely config.h)."""
(namely config.h).
"""
the_prefix = (plat_specific and exec_prefix or prefix)
if os.name == "posix":
return os.path.join(the_prefix, "include", "python" + sys.version[:3])
@ -39,13 +44,16 @@ def get_python_inc (plat_specific=0):
def get_python_lib(plat_specific=0, standard_lib=0):
"""Return the directory containing the Python library (standard or
site additions). If 'plat_specific' is true, return the directory
containing platform-specific modules, i.e. any module from a
non-pure-Python module distribution; otherwise, return the
platform-shared library directory. If 'standard_lib' is true,
return the directory containing standard Python library modules;
otherwise, return the directory for site-specific modules."""
site additions).
If 'plat_specific' is true, return the directory containing
platform-specific modules, i.e. any module from a non-pure-Python
module distribution; otherwise, return the platform-shared library
directory. If 'standard_lib' is true, return the directory
containing standard Python library modules; otherwise, return the
directory for site-specific modules.
"""
the_prefix = (plat_specific and exec_prefix or prefix)
if os.name == "posix":
@ -96,9 +104,11 @@ def get_makefile_filename():
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.
"""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 = {}
@ -122,9 +132,12 @@ 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.
"""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 = {}