Package distutils :: Package command :: Module build_ext :: Class build_ext
[hide private]
[frames] | no frames]

_ClassType build_ext

cmd.Command --+
              |
             build_ext

Instance Methods [hide private]
 
initialize_options(self)
Set default values for all the options that this command supports.
 
finalize_options(self)
Set final values for all the options that this command supports.
 
run(self)
A command's raison d'etre: carry out the action it exists to perform, controlled by the options initialized in 'initialize_options()', customized by other commands, the setup script, the command-line, and config files, and finalized in 'finalize_options()'.
 
check_extensions_list(self, extensions)
Ensure that the list of extensions (presumably provided as a command option 'extensions') is valid, i.e.
 
get_source_files(self)
 
get_outputs(self)
 
build_extensions(self)
 
build_extension(self, ext)
 
swig_sources(self, sources, extension)
Walk the list of source files in 'sources', looking for SWIG interface (.i) files.
 
find_swig(self)
Return the name of the SWIG executable.
 
get_ext_fullname(self, ext_name)
 
get_ext_filename(self, ext_name)
Convert the name of an extension (eg.
 
get_export_symbols(self, ext)
Return the list of symbols that a shared extension has to export.
 
get_libraries(self, ext)
Return the list of libraries to link against when building a shared extension.

Inherited from cmd.Command: __getattr__, __init__, announce, copy_file, copy_tree, debug_print, dump_options, ensure_dirname, ensure_filename, ensure_finalized, ensure_string, ensure_string_list, execute, get_command_name, get_finalized_command, get_sub_commands, make_archive, make_file, mkpath, move_file, reinitialize_command, run_command, set_undefined_options, spawn, warn

Class Variables [hide private]
  description = 'build C/C++ extensions (compile/link to build d...
  sep_by = ' (separated by \':\')'
  user_options = [('build-lib=', 'b', 'directory for compiled ex...
  boolean_options = ['inplace', 'debug', 'force', 'swig-cpp']
  help_options = [('help-compiler', None, 'list available compil...

Inherited from cmd.Command: sub_commands

Method Details [hide private]

initialize_options(self)

 

Set default values for all the options that this command supports. Note that these defaults may be overridden by other commands, by the setup script, by config files, or by the command-line. Thus, this is not the place to code dependencies between options; generally, 'initialize_options()' implementations are just a bunch of "self.foo = None" assignments.

This method must be implemented by all command classes.

Overrides: cmd.Command.initialize_options
(inherited documentation)

finalize_options(self)

 

Set final values for all the options that this command supports. This is always called as late as possible, ie. after any option assignments from the command-line or from other commands have been done. Thus, this is the place to code option dependencies: if 'foo' depends on 'bar', then it is safe to set 'foo' from 'bar' as long as 'foo' still has the same value it was assigned in 'initialize_options()'.

This method must be implemented by all command classes.

Overrides: cmd.Command.finalize_options
(inherited documentation)

run(self)

 

A command's raison d'etre: carry out the action it exists to perform, controlled by the options initialized in 'initialize_options()', customized by other commands, the setup script, the command-line, and config files, and finalized in 'finalize_options()'. All terminal output and filesystem interaction should be done by 'run()'.

This method must be implemented by all command classes.

Overrides: cmd.Command.run
(inherited documentation)

check_extensions_list(self, extensions)

 

Ensure that the list of extensions (presumably provided as a command option 'extensions') is valid, i.e. it is a list of Extension objects. We also support the old-style list of 2-tuples, where the tuples are (ext_name, build_info), which are converted to Extension instances here.

Raise DistutilsSetupError if the structure is invalid anywhere; just returns otherwise.

swig_sources(self, sources, extension)

 

Walk the list of source files in 'sources', looking for SWIG interface (.i) files. Run SWIG on all that are found, and return a modified 'sources' list with SWIG source files replaced by the generated C (or C++) files.

find_swig(self)

 

Return the name of the SWIG executable. On Unix, this is just "swig" -- it should be in the PATH. Tries a bit harder on Windows.

get_ext_filename(self, ext_name)

 

Convert the name of an extension (eg. "foo.bar") into the name of the file from which it will be loaded (eg. "foo/bar.so", or "foo\bar.pyd").

get_export_symbols(self, ext)

 

Return the list of symbols that a shared extension has to export. This either uses 'ext.export_symbols' or, if it's not provided, "init" + module_name. Only relevant on Windows, where the .pyd file (DLL) must export the module "init" function.

get_libraries(self, ext)

 

Return the list of libraries to link against when building a shared extension. On most platforms, this is just 'ext.libraries'; on Windows and OS/2, we add the Python library (eg. python20.dll).


Class Variable Details [hide private]

description

Value:
'build C/C++ extensions (compile/link to build directory)'

user_options

Value:
[('build-lib=', 'b', 'directory for compiled extension modules'),
 ('build-temp=',
  't',
  'directory for temporary files (build by-products)'),
 ('inplace',
  'i',
  'ignore build-lib and put compiled extensions into the source direct\
ory alongside your pure Python modules'),
...

help_options

Value:
[('help-compiler',
  None,
  'list available compilers',
  <function show_compilers at 0x41259e2c>)]