tools/build_helpers.py script

Build helpers for setup.py.

Notes

The original version of this file was adapted from NiPy project [1].

[1] http://nipy.sourceforge.net/

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.

run()[source]

After calling the super class implementation, this function removes the directories specific to scikit-build.

class build_helpers.DoxygenDocs(dist: Distribution, **kw)[source]
description = 'generate docs by Doxygen'
run()[source]

Execute the actions intended by the command. (Side effects SHOULD only take place when run() is executed, for example, creating new files or writing to the terminal output).

class build_helpers.NoOptionsDocs(dist: Distribution, **kw)[source]
finalize_options()[source]

Set final values for all options/attributes used by the command. Most of the time, each option/attribute/cache should only be set if it does not have any value yet (e.g. if self.attr is None: self.attr = val).

initialize_options()[source]

Set or (reset) all options/attributes/caches used by the command to their default values. Note that these values may be overwritten during the build.

user_options: ClassVar[list[tuple[str, str, str]] | list[tuple[str, str | None, str]]] = [('None', None, 'this command has no options')]
class build_helpers.SphinxHTMLDocs(dist: Distribution, **kw)[source]
description = 'generate html docs by Sphinx'
run()[source]

Execute the actions intended by the command. (Side effects SHOULD only take place when run() is executed, for example, creating new files or writing to the terminal output).

class build_helpers.SphinxPDFDocs(dist: Distribution, **kw)[source]
description = 'generate pdf docs by Sphinx'
run()[source]

Execute the actions intended by the command. (Side effects SHOULD only take place when run() is executed, for example, creating new files or writing to the terminal output).

build_helpers.get_sphinx_make_command()[source]
build_helpers.have_good_cython()[source]
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.

build_helpers.recursive_glob(top_dir, pattern)[source]

Utility function working like glob.glob(), but working recursively and returning generator.

Parameters:
topdirstr

The top-level directory.

patternstr or list of str

The pattern or list of patterns to match.