API Documentation

shrinkwrap.install

utilities for installing shrinkwrapped packages

shrinkwrap.install.SYSTEM_INCLUDE_PATHS = ['/usr/include', '/usr/local/include', '/opt/local/include', '/sw/include/']

Standard system-wide include paths

class shrinkwrap.install.ShrinkwrapInstall(dist)

Base class for a setup.py “install” command that wraps a generic tarball installation.

check_header(filename, extra_paths=[])

Search for a header by filename.

Searches in standard locations defined in SYSTEM_INCLUDE_PATHS as well as any paths provided in extra_paths, returning True if the file is found and False if not.

cmd_output(cmd, success_return_code=0)

Run command in the shell and return its output as a byte string.

If return code from command not equal to success_return_code, raises subprocess.CalledProcessError.

Based on implementation from: https://gist.github.com/1027906

download_and_unpack_tarball(url, to_src_dir=False)

Convenience method that downloads a tarball from the given URL and unpacks it. By default, the tarfile and uncompressed contents are placed in the current directory, but if to_src_dir is True, then both the tarfile and contents will be in the src/ directory under the virtualenv base.

Returns the full path to the downloaded tar file.

download_url(url, saveto=None)

Downloads a file. If no saveto is specified, the basename of the URL and the current directory will be used.

Returns the full path to the saved file on disk.

env_dir

Full path to shrinkwrap env directory inside virtualenv

install_env(filename, contents)

Create an environment shell script called filename in the shrinkwrap env directory and fill it with the string contents.

make(parallel=True, extra_opts=None)

Run make in current directory. If parallel is true, will run make with the -j option and the number of CPU cores. extra_opts is a list of additional options to be passed to make.

Remember to escape them for the shell, if needed!

ncpu

Number of CPU cores.

python_libdir

Location of python library.

run()

setuptools install command that install dependencies in before calling the installer function provided in the shrinkwrap_installer keyword argument to setup().

Disable installer skip functions by setting SHRINKWRAP_NEVER_SKIP to 1.

shell(cmd, success_return_code=0)

Runs cmd in a shell. Raises subprocess.CalledProcessError if the return code from cmd is not equal to success_return_code.

src_dir

Full path to source directory inside virtualenv

untar(source, target='.', makedir=False)

Unpack tar file with filename source to directory target. If makedir is true, then the target directory will be created first, including missing parent directories.

Default is to extract to current directory.

virtualenv

Full path to base of virtualenv directory.

shrinkwrap.install.assert_callable(dist, attr, value)

Verify that value is a callable function

shrinkwrap.install.assert_string(dist, attr, value)

Verify that value is a string

shrinkwrap.install.autoconf_install(self)

A convenience function to perform an autoconf-based installation.

Note: requires parameter “shrinkwrap_source_dir” to be set in setup() call.

shrinkwrap.install.validate_installer_option(dist, attr, value)

Verify that value is either an allowed string or a callable function

shrinkwrap.command

shrinkwrap command-line utility

shrinkwrap.command.activate()

Print the contents of scripts in $VIRTUAL_ENV/env.d.

shrinkwrap.command.createpkg(argv)

Take each listed file on the command line, copy to a temporary directory, rename to setup.py, run “python setup.py sdist”, and copy back the generated tar file.

Streamlines the creation of shrinkwrap packages which are entirely defined by a setup.py file.

shrinkwrap.command.help()

Print usage for the shrinkwrap command-line utility.

Project Versions

Table Of Contents

Previous topic

Creating Packages

Next topic

Release Notes

This Page