tools/build_helpers.py script¶
Build helpers for setup.py.
Notes¶
The original version of this file was adapted from NiPy project [1].
- class build_helpers.Clean(dist: Distribution, **kw)[source]¶
Command class to clean, enhanced to clean also files generated during python setup.py build_ext –inplace.
- class build_helpers.DoxygenDocs(dist: Distribution, **kw)[source]¶
- description = 'generate docs by Doxygen'¶
- run()[source]¶
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.
- class build_helpers.NoOptionsDocs(dist: Distribution, **kw)[source]¶
- finalize_options()[source]¶
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.
- initialize_options()[source]¶
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.
- user_options = [('None', None, 'this command has no options')]¶
- class build_helpers.SphinxHTMLDocs(dist: Distribution, **kw)[source]¶
- description = 'generate html docs by Sphinx'¶
- run()[source]¶
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.
- class build_helpers.SphinxPDFDocs(dist: Distribution, **kw)[source]¶
- description = 'generate pdf docs by Sphinx'¶
- run()[source]¶
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.
- build_helpers.package_check(pkg_name, version=None, optional=False, checker=<function parse>, version_getter=None, messages=None, show_only=False)[source]¶
Check if package pkg_name is present, and in correct version.
- Parameters:
- pkg_namestr or sequence of str
The name of the package as imported into python. Alternative names (e.g. for different versions) may be given in a list.
- versionstr, optional
The minimum version of the package that is required. If not given, the version is not checked.
- optionalbool, optional
If False, raise error for absent package or wrong version; otherwise warn
- checkercallable, optional
If given, the callable with which to return a comparable thing from a version string. The default is
packaging.version.parse()
.- version_gettercallable, optional:
If given, the callable that takes pkg_name as argument, and returns the package version string - as in:
``version = version_getter(pkg_name)``
The default is equivalent to:
mod = __import__(pkg_name); version = mod.__version__``
- messagesdict, optional
If given, the dictionary providing (some of) output messages.
- show_onlybool
If True, do not raise exceptions, only show the package name and version information.