module documentation

Provide access to Python's configuration information. The specific configuration variables available depend heavily on the platform and configuration. The values may be retrieved using get_config_var(name), and the list of variables is available via get_config_vars().keys(). Additional convenience functions are also available. Written by: Fred L. Drake, Jr. Email: <fdrake@acm.org>

Function customize_compiler Do any platform-specific customization of a CCompiler instance.
Function expand_makefile_vars Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in 'string' according to 'vars' (a dictionary mapping variable names to values). Variables not present in 'vars' are silently expanded to the empty string...
Function get_config_h_filename Return full pathname of installed pyconfig.h file.
Function get_config_var Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name)
Function get_config_vars With no arguments, return a dictionary of all configuration variables relevant for the current platform. Generally this includes everything needed to build extensions and install both pure modules and extensions...
Function get_makefile_filename Return full pathname of installed Makefile from the Python build.
Function get_python_inc Return the directory containing installed Python header files.
Function get_python_lib Return the directory containing the Python library (standard or site additions).
Function get_python_version Return a string containing the major and minor Python version, leaving off the patchlevel. Sample return values could be '1.5' or '2.2'.
Function parse_config_h Parse a config.h-style file.
Function parse_makefile Parse a Makefile-style file.
Constant BASE_EXEC_PREFIX Undocumented
Constant BASE_PREFIX Undocumented
Constant EXEC_PREFIX Undocumented
Constant IS_PYPY Undocumented
Constant PREFIX Undocumented
Variable build_flags Undocumented
Variable project_base Undocumented
Variable python_build Undocumented
Function _extant Replace path with None if it doesn't exist.
Function _fix_pcbuild Undocumented
Function _get_python_inc_from_config If no prefix was explicitly specified, provide the include directory from the config vars. Useful when cross-compiling, since the config vars may come from the host platform Python installation, while the current Python executable is from the build platform installation.
Function _get_python_inc_nt Undocumented
Function _get_python_inc_posix Undocumented
Function _get_python_inc_posix_prefix Undocumented
Function _get_python_inc_posix_python Assume the executable is in the build directory. The pyconfig.h file should be in the same directory. Since the build directory may not be the source directory, use "srcdir" from the makefile to find the "Include" directory.
Function _is_parent Return True if a is a parent of b.
Function _is_python_source_dir Return True if the target directory appears to point to an un-installed Python.
Function _posix_lib Undocumented
Function _python_build Undocumented
Variable _config_vars Undocumented
Variable _findvar1_rx Undocumented
Variable _findvar2_rx Undocumented
Variable _sys_home Undocumented
Variable _variable_rx Undocumented
def customize_compiler(compiler): (source)

Do any platform-specific customization of a CCompiler instance. Mainly needed on Unix, so we can plug in the information that varies across Unices and is stored in Python's Makefile.

def expand_makefile_vars(s, vars): (source)

Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in 'string' according to 'vars' (a dictionary mapping variable names to values). Variables not present in 'vars' are silently expanded to the empty string. The variable values in 'vars' should not contain further variable expansions; if 'vars' is the output of 'parse_makefile()', you're fine. Returns a variable-expanded version of 's'.

def get_config_h_filename(): (source)

Return full pathname of installed pyconfig.h file.

def get_config_var(name): (source)

Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name)

def get_config_vars(*args): (source)

With no arguments, return a dictionary of all configuration variables relevant for the current platform. Generally this includes everything needed to build extensions and install both pure modules and extensions. On Unix, this means every variable defined in Python's installed Makefile; on Windows it's a much smaller set. With arguments, return a list of values that result from looking up each argument in the configuration variable dictionary.

def get_makefile_filename(): (source)

Return full pathname of installed Makefile from the Python build.

def get_python_inc(plat_specific=0, prefix=None): (source)

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 pyconfig.h). If 'prefix' is supplied, use it instead of sys.base_prefix or sys.base_exec_prefix -- i.e., ignore 'plat_specific'.

def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): (source)

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. If 'prefix' is supplied, use it instead of sys.base_prefix or sys.base_exec_prefix -- i.e., ignore 'plat_specific'.

def get_python_version(): (source)

Return a string containing the major and minor Python version, leaving off the patchlevel. Sample return values could be '1.5' or '2.2'.

def parse_config_h(fp, g=None): (source)

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.

def parse_makefile(fn, g=None): (source)

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.

BASE_EXEC_PREFIX = (source)
BASE_PREFIX = (source)

Undocumented

Value
os.path.normpath(sys.base_prefix)
EXEC_PREFIX = (source)

Undocumented

Value
os.path.normpath(sys.exec_prefix)

Undocumented

Value
('__pypy__' in sys.builtin_module_names)
build_flags = (source)

Undocumented

project_base = (source)

Undocumented

python_build = (source)

Undocumented

@pass_none
def _extant(path): (source)

Replace path with None if it doesn't exist.

@pass_none
def _fix_pcbuild(d): (source)

Undocumented

def _get_python_inc_from_config(plat_specific, spec_prefix): (source)

If no prefix was explicitly specified, provide the include directory from the config vars. Useful when cross-compiling, since the config vars may come from the host platform Python installation, while the current Python executable is from the build platform installation. >>> monkeypatch = getfixture('monkeypatch') >>> gpifc = _get_python_inc_from_config >>> monkeypatch.setitem(gpifc.__globals__, 'get_config_var', str.lower) >>> gpifc(False, '/usr/bin/') >>> gpifc(False, '') >>> gpifc(False, None) 'includepy' >>> gpifc(True, None) 'confincludepy'

def _get_python_inc_nt(prefix, spec_prefix, plat_specific): (source)

Undocumented

def _get_python_inc_posix(prefix, spec_prefix, plat_specific): (source)

Undocumented

def _get_python_inc_posix_prefix(prefix): (source)

Undocumented

def _get_python_inc_posix_python(plat_specific): (source)

Assume the executable is in the build directory. The pyconfig.h file should be in the same directory. Since the build directory may not be the source directory, use "srcdir" from the makefile to find the "Include" directory.

def _is_parent(dir_a, dir_b): (source)

Return True if a is a parent of b.

def _is_python_source_dir(d): (source)

Return True if the target directory appears to point to an un-installed Python.

def _posix_lib(standard_lib, libpython, early_prefix, prefix): (source)

Undocumented

def _python_build(): (source)

Undocumented

_config_vars = (source)

Undocumented

_findvar1_rx = (source)

Undocumented

_findvar2_rx = (source)

Undocumented

_sys_home = (source)

Undocumented

_variable_rx = (source)

Undocumented