rez.package_maker#
- class rez.package_maker.PackageMaker#
Bases:
AttrDictWrapper
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.
- clear() None. Remove all items from D. #
- copy()#
- get(k[, d]) D[k] if k in D, else d. d defaults to None. #
- items() a set-like object providing a view on D's items #
- keys() a set-like object providing a view on D's keys #
- pop(k[, d]) v, remove specified key and return the corresponding value. #
If key is not found, d is returned if given, otherwise KeyError is raised.
- popitem() (k, v), remove and return some (key, value) pair #
as a 2-tuple; but raise KeyError if D is empty.
- setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D #
- update([E, ]**F) None. Update D from mapping/iterable E and F. #
If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
- values() an object providing a view on D's values #
- 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.