_io#

rezbuild_utils._io.clear_build_dir()#

Remove the content of the build installation directory.

rezbuild_utils._io.copy_and_install_zip(zip_path: Path, dir_name: str | None, show_progress: bool = True, use_cache: bool = True) Path#

Copy the given zip to the build directory and extract it to the given directory name.

A progress bar can be displayed for the copy operation (and not the extraction).

Parameters:
  • zip_path – filesystem path to an existing .zip file

  • dir_name – name of the directory to extract the zip content in. If None just extracts at the root of the build dir.

  • show_progress – True to show a progress bar in the console.

  • use_cache – True to cache the source zip locally. This might reduce build time when the zip is stored on slow network drives and you need to trigger the build multiple times in a short period.

Returns:

the path of the directory that contain the extracted zip content filesystem path to an existing directory.

rezbuild_utils._io.copy_build_files(files: List[Path], target_directory: list[str] | None = None)#

Copy individual file/directories from the source build directory to the build install path.

Each path in file is copied individually so hierachy are not preserved.

Examples

The following:

(file=["./python/myModule.py"], sub_directories=None)

correspond to:

{REZ_BUILD_SOURCE_PATH}/python/myModule.py > {REZ_BUILD_INSTALL_PATH}/myModule.py

The following:

(file=["./python/myModule.py"], sub_directories=["src", "demo"])

correspond to:

{REZ_BUILD_SOURCE_PATH}/python/myModule.py > {REZ_BUILD_INSTALL_PATH}/src/demo/myModule.py
Parameters:
  • files – list of absolute paths or paths relative to the build source directory, to copy. can be files or directory

  • target_directory – destination directory to copy the file to relative to the build directory. Expressed as list of directory names combined to a single path where the root is the left-most name in the list.

rezbuild_utils._io.copytree_to_build(src_dir: Path, show_progress: bool = True)#

Recursively copy the src_dir to the rez build directory.

Parameters:
  • src_dir – filesystem path to an existing directory

  • show_progress – True to display a progress bar in the console.

rezbuild_utils._io.set_installed_path_read_only() list[Path]#

Set recursively all path in the rez build install dir to read-only (including directories).

Returns:

list of path that have been set to read-only