Package distutils :: Module sysconfig
[hide private]
[frames] | no frames]

Module sysconfig

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>

Functions [hide private]
 
get_python_version()
Return a string containing the major and minor Python version, leaving off the patchlevel.
 
get_python_inc(plat_specific=0, prefix=None)
Return the directory containing installed Python header files.
 
get_python_lib(plat_specific=0, standard_lib=0, prefix=None)
Return the directory containing the Python library (standard or site additions).
 
customize_compiler(compiler)
Do any platform-specific customization of a CCompiler instance.
 
get_config_h_filename()
Return full pathname of installed pyconfig.h file.
 
get_makefile_filename()
Return full pathname of installed Makefile from the Python build.
 
parse_config_h(fp, g=None)
Parse a config.h-style file.
 
parse_makefile(fn, g=None)
Parse a Makefile-style file.
 
expand_makefile_vars(s, vars)
Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in 'string' according to 'vars' (a dictionary mapping variable names to values).
 
_init_posix()
Initialize the module as appropriate for POSIX systems.
 
_init_nt()
Initialize the module as appropriate for NT
 
_init_mac()
Initialize the module as appropriate for Macintosh systems
 
_init_os2()
Initialize the module as appropriate for OS/2
 
get_config_vars(*args)
With no arguments, return a dictionary of all configuration variables relevant for the current platform.
 
get_config_var(name)
Return the value of a single variable using the dictionary returned by 'get_config_vars()'.
Variables [hide private]
  __revision__ = '$Id: sysconfig.py 47123 2006-06-27 10:08:25Z r...
  PREFIX = '/usr'
  EXEC_PREFIX = '/usr'
  argv0_path = '/usr/bin'
  python_build = False
  _variable_rx = re.compile(r'([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)')
  _findvar1_rx = re.compile(r'\$\(([A-Za-z][A-Za-z0-9_]*)\)')
  _findvar2_rx = re.compile(r'\$\{([A-Za-z][A-Za-z0-9_]*)\}')
  _config_vars = None

Imports: os, re, string, sys, DistutilsPlatformError


Function Details [hide private]

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'.

get_python_inc(plat_specific=0, prefix=None)

 

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.prefix or sys.exec_prefix -- i.e., ignore 'plat_specific'.

get_python_lib(plat_specific=0, standard_lib=0, prefix=None)

 

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.prefix or sys.exec_prefix -- i.e., ignore 'plat_specific'.

customize_compiler(compiler)

 

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.

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_makefile(fn, 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.

expand_makefile_vars(s, 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. 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'.

get_config_vars(*args)

 

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 and Mac OS 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.

get_config_var(name)

 

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


Variables Details [hide private]

__revision__

Value:
'$Id: sysconfig.py 47123 2006-06-27 10:08:25Z ronald.oussoren $'