rez.build_system¶
- class rez.build_system.BuildResult¶
Bases:
TypedDict- __init__(*args, **kwargs)¶
- classmethod __new__(*args, **kwargs)¶
- clear()¶
Remove all items from the dict.
- copy()¶
Return a shallow copy of the dict.
- classmethod fromkeys(iterable, value=None, /)¶
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)¶
Return the value for key if key is in the dictionary, else default.
- items()¶
Return a set-like object providing a view on the dict’s items.
- keys()¶
Return a set-like object providing a view on the dict’s keys.
- pop(k[, d]) v, remove specified key and return the corresponding value.¶
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()¶
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault(key, default=None, /)¶
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update([E, ]**F) None. Update D from mapping/iterable E and F.¶
If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values()¶
Return an object providing a view on the dict’s values.
- rez.build_system.get_buildsys_types() list[str]¶
Returns the available build system implementations - cmake, make etc.
- rez.build_system.get_valid_build_systems(working_dir: str, package: DeveloperPackage | None = None) list[type[BuildSystem]]¶
Returns the build system classes that could build the source in given dir.
- Parameters:
working_dir (str) – Dir containing the package definition and potentially build files.
package (Package) – Package to be built. This may or may not be needed to determine the build system. For eg, cmake just has to look for a CMakeLists.txt file, whereas the ‘build_command’ package field must be present for the ‘custom’ build system type.
- Returns:
Valid build system class types.
- Return type:
- rez.build_system.create_build_system(working_dir: str, buildsys_type: str | None = None, package: DeveloperPackage | None = None, opts: argparse.Namespace | None = None, write_build_scripts: bool = False, verbose: bool = False, build_args=[], child_build_args=[]) BuildSystem¶
Return a new build system that can build the source in working_dir.
- class rez.build_system.BuildSystem¶
Bases:
objectA build system, such as cmake, make, Scons etc.
- __init__(working_dir: str, opts: argparse.Namespace | None = None, package: DeveloperPackage | None = None, write_build_scripts: bool = False, verbose: bool = False, build_args: Sequence[str] = [], child_build_args: list[str] = []) None¶
Create a build system instance.
- Parameters:
working_dir – Directory to build source from.
opts – argparse.Namespace object which may contain constructor params, as set by our bind_cli() classmethod.
package (DeveloperPackage) – Package to build. If None, defaults to the package in the working directory.
write_build_scripts – If True, create build scripts rather than perform the full build. The user can then run these scripts to place themselves into a build environment and invoke the build system directly.
build_args – Extra cli build arguments.
child_build_args – Extra cli args for child build system, ignored if there is no child build system.
- classmethod is_valid_root(path: str, package=None) bool¶
Return True if this build system can build the source in path.
- classmethod child_build_system() str | None¶
Returns the child build system.
Some build systems, such as cmake, don’t build the source directly. Instead, they build an interim set of build scripts that are then consumed by a second build system (such as make). You should implement this method if that’s the case.
- Returns:
Name of build system (corresponding to the plugin name) if this system has a child system, or None otherwise.
- classmethod bind_cli(parser: ArgumentParser, group: _ArgumentGroup) None¶
Expose parameters to an argparse.ArgumentParser that are specific to this build system.
- Parameters:
parser (ArgumentParser) – Arg parser.
group (_ArgumentGroup) – Arg parser group - you should add args to this, NOT to parser.
- build(context: ResolvedContext, variant: Variant, build_path: str, install_path: str, install: bool = False, build_type=BuildType.local) BuildResult¶
Implement this method to perform the actual build.
- Parameters:
context – A ResolvedContext object that the build process must be executed within.
variant (Variant) – The variant being built.
build_path – Where to write temporary build files. May be absolute or relative to working_dir.
install_path (str) – The package repository path to install the package to, if installing. If None, defaults to config.local_packages_path.
install – If True, install the build.
build_type – A BuildType (i.e local or central).
- Returns:
A dict containing the following information:
success: Bool indicating if the build was successful.
extra_files: List of created files of interest, not including build targets. A good example is the interpreted context file, usually named ‘build.rxt.sh’ or similar. These files should be located under build_path. Rez may install them for debugging purposes.
build_env_script: If this instance was created with write_build_scripts as True, then the build should generate a script which, when run by the user, places them in the build environment.
- Return type:
- classmethod set_standard_vars(executor: RexExecutor, context: ResolvedContext, variant: Variant, build_type: BuildType, install: bool, build_path: str, install_path: str | None = None) None¶
Set some standard env vars that all build systems can rely on.
- classmethod add_pre_build_commands(executor, variant, build_type, install, build_path, install_path=None) None¶
Execute pre_build_commands function if present.
- classmethod add_standard_build_actions(executor: RexExecutor, context: ResolvedContext, variant: Variant, build_type: BuildType, install: bool, build_path: str, install_path: str | None = None) None¶
Perform build actions common to every build system.