Python API

This section includes information for using the Python API of bob.buildout.

Extension

A monkey patch to zc.buildout.easy_install.develop that takes into consideration eggs installed at both development and deployment directories.

bob.buildout.extension.logger = <Logger bob.buildout.extension (WARNING)>
bob.buildout.extension.runsetup_template = "\nimport os\nimport sys\nfor k in %(paths)r.split(os.pathsep): sys.path.insert(0, k)\nsys.path.insert(0, %(setupdir)r)\n\nimport os, setuptools\n\n__file__ = %(__file__)r\n\nos.chdir(%(setupdir)r)\nsys.argv[0] = %(setup)r\n\nexec(compile(open(%(setup)r).read(), %(setup)r, 'exec'))\n"
class bob.buildout.extension.Installer(buildout)[source]

Bases: object

class bob.buildout.extension.Extension(buildout)[source]

Bases: object

develop(setup, dest, build_ext=None, executable='/scratch/builds/bob/bob.buildout/miniconda/conda-bld/bob.buildout_1560946406682/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_place/bin/python3.6')[source]
bob.buildout.extension.extension(buildout)[source]

Monkey patches zc.buildout.easy_install.develop

Recipe

Builds custom interpreters with the right paths for external Bob

bob.buildout.scripts.version_is_lessthan(name, version)[source]

Checks if the version of a package is at least…

class bob.buildout.scripts.UserScripts(buildout, name, options)[source]

Bases: bob.buildout.script.Recipe

Installs all user scripts from the eggs

install()[source]
update()
class bob.buildout.scripts.IPythonInterpreter(buildout, name, options)[source]

Bases: bob.buildout.script.Recipe

Installs all user scripts from the eggs

install()[source]
update()
class bob.buildout.scripts.PyLint(buildout, name, options)[source]

Bases: bob.buildout.script.Recipe

Installs PyLint infrastructure

install()[source]
update()
class bob.buildout.scripts.NoseTests(buildout, name, options)[source]

Bases: bob.buildout.script.Recipe

Installs Nose infrastructure

install()[source]
update()
class bob.buildout.scripts.Coverage(buildout, name, options)[source]

Bases: bob.buildout.script.Recipe

Installs Coverage infrastructure

install()[source]
update()
class bob.buildout.scripts.Sphinx(buildout, name, options)[source]

Bases: bob.buildout.script.Recipe

Installs the Sphinx documentation generation infrastructure

install()[source]
update()
class bob.buildout.scripts.Recipe(buildout, name, options)[source]

Bases: object

Just creates a given script with the “correct” paths

install()[source]
update()

Other Modules

A wrapper for defining environment variables for the compilation

bob.buildout.envwrapper.substitute(value, d)[source]

Substitutes ${} expressions on value with values from d, using string.Template

class bob.buildout.envwrapper.EnvironmentWrapper(logger, debug=None, prefixes=None, environ=None)[source]

Bases: object

Provides methods for wrapping other install() methods with environment settings from initialization.

DEBUG_CFLAGS = '-O0 -g -DBOB_DEBUG -DBZ_DEBUG'
set()[source]

Sets the current environment for variables needed for the setup of the package to be compiled

unset()[source]

Resets the environment back to its previous state

Generic tools for Bob buildout recipes

bob.buildout.tools.logger = <Logger bob.buildout.tools (WARNING)>
bob.buildout.tools.site_paths(buildout, prefixes)[source]

Filters the site paths to make sure we don’t get mistaken when filtering user directories.

bob.buildout.tools.uniq(seq, idfun=None)[source]

Order preserving, fast de-duplication for lists

bob.buildout.tools.parse_list(l)[source]

Parses a ini-style list from buildout and solves complex nesting

bob.buildout.tools.add_eggs(eggs, l)[source]

Adds eggs from a list into the buildout option

bob.buildout.tools.prepend_path(path, paths)[source]

Prepends a path to the list of paths making sure it remains unique

bob.buildout.tools.is_directory(filename)[source]

Tells if the file is a directory

bob.buildout.tools.directory_readlines(package, filename)[source]

Read all lines of a given file in a directory

bob.buildout.tools.is_zipfile(filename)[source]

Tells if the file is a zip file

bob.buildout.tools.zipfile_readlines(package, filename)[source]

Read all lines of a given file in a tar ball

bob.buildout.tools.is_tarfile(filename)[source]

Tells if the file is a tar ball

bob.buildout.tools.tarfile_readlines(package, filename)[source]

Read all lines of a given file in tar ball

bob.buildout.tools.package_readlines(package, filename)[source]

Extracts a single file contents from a given package

bob.buildout.tools.requirement_is_satisfied(requirement, working_set, newest)[source]

Checks if the specifications for a requirement are satisfied by the current working set

bob.buildout.tools.unsatisfied_requirements(buildout, package, working_set)[source]

Reads and extracts the unsatisfied requirements from the package

bob.buildout.tools.merge_working_sets(self, other)[source]

Merge two working sets, results are put on the first one

bob.buildout.tools.install_package(buildout, specification, working_set)[source]

Installs a package on either the eggs directory or development-eggs directory. Updates the working set

bob.buildout.tools.satisfy_requirements(buildout, package, working_set)[source]

Makes sure all requirements from a given package are installed properly before we try to install the package itself.

bob.buildout.tools.get_pythonpath(working_set, buildout, prefixes)[source]

Returns the PYTHONPATH setting for a particular working set

bob.buildout.tools.get_prefixes(buildout)[source]

Returns a list of prefixes set on the buildout section

bob.buildout.tools.find_site_packages(prefixes)[source]

Finds python packages on prefixes

bob.buildout.tools.has_distribution(path)[source]

Tests if a given path really has installed python distributions

bob.buildout.tools.order_egg_dirs(buildout)[source]

Orders the egg directories and returns them newest first

bob.buildout.tools.working_set(buildout)[source]

Creates and returns a new working set based on user prefixes and existing packages already installed

bob.buildout.tools.filter_working_set_hard(working_set, requirements)[source]

Returns a new working set which contains only the paths to the required packages. Raises if a requirement cannot be met.

bob.buildout.tools.filter_working_set_soft(working_set, requirements)[source]

Returns a new working set which contains only the paths to the required packages. requirements that cannot be fulfilled are returned

bob.buildout.tools.newest(buildout)[source]
bob.buildout.tools.offline(buildout)[source]
bob.buildout.tools.debug(buildout)[source]
bob.buildout.tools.verbose(buildout)[source]
bob.buildout.tools.prefer_final(buildout)[source]
bob.buildout.tools.eggs(buildout, options, name)[source]

Builds custom scripts with the right paths for external dependencies installed on different prefixes.

class bob.buildout.script.ScriptGenerator(buildout, prefixes)[source]

Bases: object

Replaces the default script generator so paths are properly filtered

class bob.buildout.script.Recipe(buildout, name, options)[source]

Bases: zc.recipe.egg.egg.Scripts

Just creates a given script with the “correct” paths

working_set(extra=())[source]

Separate method to just get the working set - overriding zc.recipe.egg

This is intended for reuse by similar recipes.

install_on_wrapped_env()[source]
install()[source]
update()

Builds a custom python script interpreter

class bob.buildout.python.Recipe(buildout, name, options)[source]

Bases: bob.buildout.script.Recipe

Just creates a python interpreter with the “correct” paths

set_template(template)[source]
install_on_wrapped_env()[source]

Builds a custom python script interpreter that is executed inside gdb/lldb

class bob.buildout.dbpy.Recipe(buildout, name, options)[source]

Bases: bob.buildout.python.Recipe

Just creates a gdb/lldb executable running a python interpreter with the “correct” paths