builder.py

Build helper for setup script. It includes dependency checks and monkey-patch in order to extend or modify supporting system software locally (affecting only the running instance of the program).

Note

The original version of this script was adapted from NiPy project.

class builder.Clean(dist)[source]

Distutils command class to clean. Enhanced to clean also files generated during python setup.py build_ext –inplace process.

run()[source]

Run clean process recursively for directories: petgem, examples, utils, tests, doc and root directory.

class builder.NoOptionsDocs(dist)[source]

Handler class for no options docs

finalize_options()[source]

Finalize options for NoOptionsDocs class.

initialize_options()[source]

Init options for NoOptionsDocs class.

user_options = [('None', None, 'this command has no options')]
class builder.SphinxHTMLDocs(dist)[source]

Generate html docs by Sphinx.

run()[source]

Run SphinxHTMLDocs class.

class builder.SphinxPDFDocs(dist)[source]

Generate pdf docs by Sphinx

run()[source]

Run SphinxPDFDocs class.

builder.get_sphinx_make_command()[source]

Get make command for Sphinx documentation.

builder.package_check(pkg_name, version=None, optional=False, checker=<class 'distutils.version.LooseVersion'>, version_getter=None, messages=None, show_only=False)[source]

Check if package pkg_name is present, and in correct version.

Parameters:
  • pkg_name (str,list) – the name of the package as imported into python. Alternative names (e.g. for different versions) may be given in a list.
  • version (str) – the minimum version of the package that is required. If not given, the version is not checked.
  • optional (bool) – if False, raise error for absent package or wrong version, otherwise warning.
  • checker (callalble) – if given, the callable with which to return a comparable thing from a version string. The default is distutils.version.LooseVersion.
  • version_getter (callable) –

    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__
  • messages (dict) – if given, the dictionary providing (some of) output messages.
  • show_only (bool) – if True, do not raise exceptions, only show the package name and version information.
builder.recursive_glob(top_dir, pattern)[source]

Finds all the pathnames matching a specific pattern according to the rules used by Unix shell. recursive_glob works like glob.glob(), but in working recursively.

Parameters:
  • top_dir (str) – the top-level directory
  • pattern (str,list) – the pattern or list of patterns to match
builder.unitary_test()[source]

Unitary test for builder.py script. Check if version, top_dir and in_source are present in INFO PETGEM object.