rez.package_maker#

class rez.package_maker.PackageMaker#

Utility class for creating packages.

__init__(name, data=None, package_cls=None)#

Create a package maker.

Parameters:

name (str) – Package name.

get_package()#

Create the analogous package.

Returns:

Package object.

rez.package_maker.make_package(name, path, make_base=None, make_root=None, skip_existing=True, warn_on_skip=True)#

Make and install a package.

Example

>>> def make_root(variant, path):
>>>     os.symlink("/foo_payload/misc/python27", "ext")
>>>
>>> with make_package('foo', '/packages', make_root=make_root) as pkg:
>>>     pkg.version = '1.0.0'
>>>     pkg.description = 'does foo things'
>>>     pkg.requires = ['python-2.7']
Parameters:
  • name (str) – Package name.

  • path (str) – Package repository path to install package into.

  • make_base (callable) – Function that is used to create the package payload, if applicable.

  • make_root (callable) – Function that is used to create the package variant payloads, if applicable.

  • skip_existing (bool) – If True, detect if a variant already exists, and skip with a warning message if so.

  • warn_on_skip (bool) – If True, print warning when a variant is skipped.

Yields:

PackageMaker object.

Note

Both make_base and make_root are called once per variant install, and have the signature (variant, path).

Note

The ‘installed_variants’ attribute on the PackageMaker instance will be appended with variant(s) created by this function, if any.