build_helpers.py script

Build helpers for setup.py.

Includes package dependency checks and monkey-patch to numpy.distutils to work with Cython.

Notes

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

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

class build_helpers.Clean(dist)[source]

Distutils Command class to clean, enhanced to clean also files generated during python setup.py build_ext –inplace.

run()[source]
class build_helpers.DoxygenDocs(dist)[source]
description = 'generate docs by Doxygen'
run()[source]
class build_helpers.NoOptionsDocs(dist)[source]
finalize_options()[source]
initialize_options()[source]
user_options = [('None', None, 'this command has no options')]
class build_helpers.SphinxHTMLDocs(dist)[source]
description = 'generate html docs by Sphinx'
run()[source]
class build_helpers.SphinxPDFDocs(dist)[source]
description = 'generate pdf docs by Sphinx'
run()[source]
build_helpers.generate_a_pyrex_source(self, base, ext_name, source, extension)[source]

Monkey patch for numpy build_src.build_src method

Uses Cython instead of Pyrex.

build_helpers.get_sphinx_make_command()[source]
build_helpers.have_good_cython()[source]
build_helpers.package_check(pkg_name, version=None, optional=False, checker=<class distutils.version.LooseVersion>, version_getter=None, messages=None)[source]

Check if package pkg_name is present, and correct version

Parameters:

pkg_name : str or sequence of str

name of package as imported into python. Alternative names (e.g. for different versions) may be given in a list.

version : {None, str}, optional

minimum version of the package that we require. If None, we don’t check the version. Default is None

optional : {False, True}, optional

If False, raise error for absent package or wrong version; otherwise warn

checker : callable, optional

callable with which to return comparable thing from version string. Default is distutils.version.LooseVersion

version_getter : {None, callable}:

Callable that takes pkg_name as argument, and returns the package version string - as in:

``version = version_getter(pkg_name)``

If None, equivalent to:

mod = __import__(pkg_name); version = mod.__version__``

messages : None or dict, optional

dictionary giving output messages

build_helpers.recursive_glob(top_dir, pattern)[source]

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

Parameters:

topdir : str

The top-level directory.

pattern : str or list of str

The pattern or list of patterns to match.