module documentation

Undocumented

Function ​CCompiler_compile Compile one or more source files.
Function ​CCompiler_customize Do any platform-specific customization of a compiler instance.
Function ​CCompiler_customize_cmd Customize compiler using distutils command.
Function ​CCompiler_cxx_compiler Return the C++ compiler.
Function ​CCompiler_find_executables Does nothing here, but is called by the get_version method and can be overridden by subclasses. In particular it is redefined in the FCompiler class where more documentation can be found.
Function ​CCompiler_get_version Return compiler version, or None if compiler is not available.
Function ​CCompiler_object_filenames Return the name of the object files for the given source files.
Function ​CCompiler_show_customization Print the compiler customizations to stdout.
Function ​CCompiler_spawn Execute a command in a sub-process.
Function gen​_lib​_options Undocumented
Function new​_compiler Undocumented
Function replace​_method Undocumented
Function simple​_version​_match Simple matching of version numbers, for use in CCompiler and FCompiler.
Function ​_compiler​_to​_string Undocumented
Function ​_needs​_build Check if an objects needs to be rebuild based on its dependencies
Variable ​_global​_lock Undocumented
Variable ​_job​_semaphore Undocumented
Variable ​_m Undocumented
Variable ​_processing​_files Undocumented
def CCompiler_compile(self, sources, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, depends=None):

Compile one or more source files.

Please refer to the Python distutils API reference for more details.

Parameters

sources : list of str
A list of filenames
output_dir : str, optional
Path to the output directory.
macros : list of tuples
A list of macro definitions.
include_dirs : list of str, optional
The directories to add to the default include file search path for this compilation only.
debug : bool, optional
Whether or not to output debug symbols in or alongside the object file(s).
extra_preargs, extra_postargs : ?
Extra pre- and post-arguments.
depends : list of str, optional
A list of file names that all targets depend on.

Returns

objects : list of str
A list of object file names, one per source file sources.

Raises

CompileError
If compilation fails.
def CCompiler_customize(self, dist, need_cxx=0):

Do any platform-specific customization of a compiler instance.

This method calls distutils.sysconfig.customize_compiler for platform-specific customization, as well as optionally remove a flag to suppress spurious warnings in case C++ code is being compiled.

Parameters

dist : object
This parameter is not used for anything.
need_cxx : bool, optional
Whether or not C++ has to be compiled. If so (True), the "-Wstrict-prototypes" option is removed to prevent spurious warnings. Default is False.

Returns

None

Notes

All the default options used by distutils can be extracted with:

from distutils import sysconfig
sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'BASECFLAGS',
                          'CCSHARED', 'LDSHARED', 'SO')
def CCompiler_customize_cmd(self, cmd, ignore=()):

Customize compiler using distutils command.

Parameters

cmd : class instance
An instance inheriting from distutils.cmd.Command.
ignore : sequence of str, optional
List of CCompiler commands (without 'set_') that should not be altered. Strings that are checked for are: ('include_dirs', 'define', 'undef', 'libraries', 'library_dirs', 'rpath', 'link_objects').

Returns

None

def CCompiler_cxx_compiler(self):

Return the C++ compiler.

Parameters

None

Returns

cxx : class instance
The C++ compiler, as a CCompiler instance.
def CCompiler_find_executables(self):
Does nothing here, but is called by the get_version method and can be overridden by subclasses. In particular it is redefined in the FCompiler class where more documentation can be found.
def CCompiler_get_version(self, force=False, ok_status=[0]):

Return compiler version, or None if compiler is not available.

Parameters

force : bool, optional
If True, force a new determination of the version, even if the compiler already has a version attribute. Default is False.
ok_status : list of int, optional
The list of status values returned by the version look-up process for which a version string is returned. If the status value is not in ok_status, None is returned. Default is [0].

Returns

version : str or None
Version string, in the format of distutils.version.LooseVersion.
def CCompiler_object_filenames(self, source_filenames, strip_dir=0, output_dir=''):

Return the name of the object files for the given source files.

Parameters

source_filenames : list of str
The list of paths to source files. Paths can be either relative or absolute, this is handled transparently.
strip_dir : bool, optional
Whether to strip the directory from the returned paths. If True, the file name prepended by output_dir is returned. Default is False.
output_dir : str, optional
If given, this path is prepended to the returned paths to the object files.

Returns

obj_names : list of str
The list of paths to the object files corresponding to the source files in source_filenames.
def CCompiler_show_customization(self):

Print the compiler customizations to stdout.

Parameters

None

Returns

None

Notes

Printing is only done if the distutils log threshold is < 2.

def CCompiler_spawn(self, cmd, display=None, env=None):

Execute a command in a sub-process.

Parameters

cmd : str
The command to execute.
display : str or sequence of str, optional
The text to add to the log file kept by numpy.distutils. If not given, display is equal to cmd.

env: a dictionary for environment variables, optional

Returns

None

Raises

DistutilsExecError
If the command failed, i.e. the exit status was not 0.
def gen_lib_options(compiler, library_dirs, runtime_library_dirs, libraries):

Undocumented

def new_compiler(plat=None, compiler=None, verbose=None, dry_run=0, force=0):

Undocumented

def replace_method(klass, method_name, func):

Undocumented

def simple_version_match(pat='[-.\\d]+', ignore='', start=''):

Simple matching of version numbers, for use in CCompiler and FCompiler.

Parameters

pat : str, optional
A regular expression matching version numbers. Default is r'[-.\d]+'.
ignore : str, optional
A regular expression matching patterns to skip. Default is '', in which case nothing is skipped.
start : str, optional
A regular expression matching the start of where to start looking for version numbers. Default is '', in which case searching is started at the beginning of the version string given to matcher.

Returns

matcher : callable
A function that is appropriate to use as the .version_match attribute of a CCompiler class. matcher takes a single parameter, a version string.
def _compiler_to_string(compiler):

Undocumented

def _needs_build(obj, cc_args, extra_postargs, pp_opts):

Check if an objects needs to be rebuild based on its dependencies

Parameters

obj : str
object file

Returns

bool

_global_lock =

Undocumented

_job_semaphore =

Undocumented

_m =

Undocumented

_processing_files: set =

Undocumented