omni.repo.build.build#
- exception omni.repo.build.build.BuildError(message: str, emit_stack: bool = False)#
Bases:
RepoToolErrorA high level build failure exception class. Something unexpected happened with repo_build.
- class omni.repo.build.build.Path(*args, **kwargs)#
Bases:
PurePathPurePath subclass that can make system calls.
Path represents a filesystem path but unlike PurePath, also offers methods to do system calls on path objects. Depending on your system, instantiating a Path will return either a PosixPath or a WindowsPath object. You can also instantiate a PosixPath or WindowsPath directly, but cannot instantiate a WindowsPath on a POSIX system or vice versa.
- absolute()#
Return an absolute version of this path. This function works even if the path doesn’t point to anything.
No normalization is done, i.e. all ‘.’ and ‘..’ will be kept along. Use resolve() to get the canonical path to a file.
- chmod(mode, *, follow_symlinks=True)#
Change the permissions of the path, like os.chmod().
- classmethod cwd()#
Return a new path pointing to the current working directory (as returned by os.getcwd()).
- exists()#
Whether this path exists.
- expanduser()#
Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser)
- glob(pattern)#
Iterate over this subtree and yield all existing files (of any kind, including directories) matching the given relative pattern.
- group()#
Return the group name of the file gid.
- hardlink_to(target)#
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link’s.
- classmethod home()#
Return a new path pointing to the user’s home directory (as returned by os.path.expanduser(‘~’)).
- is_block_device()#
Whether this path is a block device.
- is_char_device()#
Whether this path is a character device.
- is_dir()#
Whether this path is a directory.
- is_fifo()#
Whether this path is a FIFO.
- is_file()#
Whether this path is a regular file (also True for symlinks pointing to regular files).
- is_mount()#
Check if this path is a POSIX mount point
- is_socket()#
Whether this path is a socket.
- is_symlink()#
Whether this path is a symbolic link.
- iterdir()#
Iterate over the files in this directory. Does not yield any result for the special paths ‘.’ and ‘..’.
- lchmod(mode)#
Like chmod(), except if the path points to a symlink, the symlink’s permissions are changed, rather than its target’s.
- link_to(target)#
Make the target path a hard link pointing to this path.
Note this function does not make this path a hard link to target, despite the implication of the function and argument names. The order of arguments (target, link) is the reverse of Path.symlink_to, but matches that of os.link.
Deprecated since Python 3.10 and scheduled for removal in Python 3.12. Use hardlink_to() instead.
- lstat()#
Like stat(), except if the path points to a symlink, the symlink’s status information is returned, rather than its target’s.
- mkdir(mode=511, parents=False, exist_ok=False)#
Create a new directory at this given path.
- open(
- mode='r',
- buffering=-1,
- encoding=None,
- errors=None,
- newline=None,
Open the file pointed by this path and return a file object, as the built-in open() function does.
- owner()#
Return the login name of the file owner.
- read_bytes()#
Open the file in bytes mode, read it, and close the file.
- read_text(encoding=None, errors=None)#
Open the file in text mode, read it, and close the file.
- readlink()#
Return the path to which the symbolic link points.
- rename(target)#
Rename this path to the target path.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
- replace(target)#
Rename this path to the target path, overwriting if that path exists.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
- resolve(strict=False)#
Make the path absolute, resolving all symlinks on the way and also normalizing it (for example turning slashes into backslashes under Windows).
- rglob(pattern)#
Recursively yield all existing files (of any kind, including directories) matching the given relative pattern, anywhere in this subtree.
- rmdir()#
Remove this directory. The directory must be empty.
- samefile(other_path)#
Return whether other_path is the same or not as this file (as returned by os.path.samefile()).
- stat(*, follow_symlinks=True)#
Return the result of the stat() system call on this path, like os.stat() does.
- symlink_to(target, target_is_directory=False)#
Make this path a symlink pointing to the target path. Note the order of arguments (link, target) is the reverse of os.symlink.
- touch(mode=438, exist_ok=True)#
Create this file with the given access mode, if it doesn’t exist.
- unlink(missing_ok=False)#
Remove this file or link. If the path is a directory, use rmdir() instead.
- write_bytes(data)#
Open the file in bytes mode, write to it, and close the file.
- write_text(data, encoding=None, errors=None, newline=None)#
Open the file in text mode, write to it, and close the file.
- omni.repo.build.build.build_with_make(
- make_dir: str,
- platform_target: str,
- configs: List[str],
- verbose: bool = False,
- jobs: int | str = -1,
- extra_args: List[str] = [],
- build_target: str | None = None,
- error_processing: Mapping[str, bool | List[str] | List[int]] = {},
- build_metadata: dict = {},
Generate projects using premake tool and then build using make.
Supported platforms: linux-x86_64, linux-aarch64, macos-universal
- Parameters:
make_dir (str) – Dir with makefile.
platform_target (str) – Targeted platform (e.g. “linux-x86_64”, “linux-aarch64”, “macos-universal”).
configs (List[str]) – List of configurations to build.
verbose (bool, optional) – Verbose build.
jobs (int, optional) – Number of parallel build jobs. Defaults to CPU cores number.
extra_args (List, optional) – Extra args to pass to Make.
error_processing – (Dict, optional): enable stdout/stderr scanning for errors
build_metadata – (Dict, optional): metadata related to the build like desired glibc version and metadata file.
- omni.repo.build.build.build_with_msbuild(
- msbuild_tool: str,
- sln: str,
- configs: List[str],
- verbose: bool = False,
- jobs: int | str = -1,
- mttask: bool = False,
- rebuild: bool = False,
- extra_args: List[str] = [],
- prefer_devenv: bool = False,
- vs_version: str = '2017',
- build_target: str | None = None,
- error_processing: Mapping[str, bool | List[str] | List[int]] = {},
- msbuild_renice: bool = False,
- **kwargs,
Generate projects using premake tool and then build using msbuild.
Supported platforms: windows-x86_64
- Parameters:
msbuild_tool (str) – Path to msbuild tool.
sln (str) – Path to solution file.
configs (List[str]) – List of configurations to build.
verbose (bool, optional) – Verbose build.
jobs (int, optional) – Number of parallel build jobs. Defaults to CPU cores number.
mttask (bool, optional) – Use multi tool tasking.
build (bool, optional) – Do actual build step.
rebuild (bool, optional) – Rebuild project. (MsBuild flag).
extra_args (List, optional) – Extra args to pass to MsBuild.
prefer_devenv (bool) – Attempt to search for devenv installation and prefer it over MsBuild.
error_processing – (Dict, optional): enable stdout/stderr scanning for errors
- class omni.repo.build.build.datetime(
- year,
- month,
- day[,
- hour[,
- minute[,
- second[,
- microsecond[,
- tzinfo,]]]]]
Bases:
dateThe year, month and day arguments are required. tzinfo may be None, or an instance of a tzinfo subclass. The remaining arguments may be ints.
- astimezone()#
tz -> convert to local time in new timezone tz
- combine()#
date, time -> datetime with same date and time fields
- ctime()#
Return ctime() style string.
- date()#
Return date object with same year, month and day.
- dst()#
Return self.tzinfo.dst(self).
- fold#
- fromisoformat()#
string -> datetime from datetime.isoformat() output
- fromtimestamp()#
timestamp[, tz] -> tz’s local time from POSIX timestamp.
- hour#
- isoformat()#
[sep] -> string in ISO 8601 format, YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM]. sep is used to separate the year from the time, and defaults to ‘T’. The optional argument timespec specifies the number of additional terms of the time to include. Valid options are ‘auto’, ‘hours’, ‘minutes’, ‘seconds’, ‘milliseconds’ and ‘microseconds’.
- max = datetime.datetime(9999, 12, 31, 23, 59, 59, 999999)#
- microsecond#
- min = datetime.datetime(1, 1, 1, 0, 0)#
- minute#
- now()#
Returns new datetime object representing current time local to tz.
- tz
Timezone object.
If no tz is specified, uses local timezone.
- replace()#
Return datetime with new specified fields.
- resolution = datetime.timedelta(microseconds=1)#
- second#
- strptime()#
string, format -> new datetime parsed from a string (like time.strptime()).
- time()#
Return time object with same time but with tzinfo=None.
- timestamp()#
Return POSIX timestamp as float.
- timetuple()#
Return time tuple, compatible with time.localtime().
- timetz()#
Return time object with same time and tzinfo.
- tzinfo#
- tzname()#
Return self.tzinfo.tzname(self).
- utcfromtimestamp()#
Construct a naive UTC datetime from a POSIX timestamp.
- utcnow()#
Return a new datetime representing UTC day and time.
- utcoffset()#
Return self.tzinfo.utcoffset(self).
- utctimetuple()#
Return UTC time tuple, compatible with time.localtime().
- omni.repo.build.build.do_build(
- args,
- config,
- error_processing: Mapping[str, str | bool] = {},
- omni.repo.build.build.generate_build_metadata(build_metadata: dict)#
Write out a build metadata file to enable easy communication of build environment information to package and test tooling.
- Parameters:
build_metadata (dict) – dict that includes the metadata output file and the user’s desired glibc version.
- omni.repo.build.build.generate_details_rc(
- rc_file_path: str,
- product_name: str,
- file_description: str,
- **kwargs,
- omni.repo.build.build.generate_projects(
- premake_file: str,
- premake_tool: str,
- premake_action: str = 'vs2017',
- extra_args: List[str] = [],
- platform_target: str | None = None,
- linux_x86_64_cxx_abi: bool | None = None,
- verbose: bool = False,
- compiler: str = None,
- visual_cxx_version: str = None,
- winsdk_version: str = None,
- proj_compiler_dir: str = None,
- **kwargs,
Generate projects using premake tool.
- Parameters:
premake_file (str) – Path to premake file.
premake_tool (str) – Path to premake tool.
premake_action (str) – Premake action. E.g. “vs2017”, “gmake2” etc.
extra_args (List[str]) – Any extra premake args you want to give.
compiler (str) – For special compilers, like clang, beyond the default.
visual_cxx_version (str) – The Microsoft Visual C++ tools version e.g. 14.29.30133
winsdk_version (str) – The Microsoft Windows SDK version e.g. 10.0.17763.0
proj_compiler_dir (str) – The project’s _compiler directory.
- omni.repo.build.build.glob(pathname, *, root_dir=None, dir_fd=None, recursive=False)#
Return a list of paths matching a pathname pattern.
The pattern may contain simple shell-style wildcards a la fnmatch. However, unlike fnmatch, filenames starting with a dot are special cases that are not matched by ‘*’ and ‘?’ patterns.
If recursive is true, the pattern ‘**’ will match any files and zero or more directories and subdirectories.
- omni.repo.build.build.is_linux() bool#
Return True if on Linux.
- Returns:
True if on Linux, False otherwise.
- Return type:
bool
- omni.repo.build.build.msbuild_job_args(
- desired_job_count: int | str = -1,
- mttask: bool = False,
msbuild’s default-parallel-compute-management has some quirks to account for. This addresses that via some experimental msbuild flags.
UseMultiToolTask + EnforceProcessCountAcrossBuilds use a more modern/gcc-like compilation scheduler that limits total parallel compilation processes to the provided value. This avoids the horrendous default thrashing that msbuild was performing by trying to build maximum parallel projects with each project compiling as many parallel jobs as the host has cores.
- Parameters:
desired_job_count – An int or string. An int is a concrete core count/job count. A string should include a % symbol.
mttask (bool, optional) – Whether or not to use the MultiToolTasking feature
- Returns:
An array of msbuild argument flags to limit compilation settings to something sane.
- omni.repo.build.build.renice_windows_processes(enabled: bool = False)#
This coordination context manager spins up several threads for msbuild compiler process discovery and priority + affinity adjustments.
If enabled it will setup the necessary finder and setter threads and then yield.
Upon exit of the context manager it will stop the looping thread that triggers new finder work, and then trigger all of the finders and setters to exit. This has typically added 1s-2s to the shutdown of repo_build via a KeyboardInterrupt.
- Parameters:
enabled (bool, optional) – If enabled kick off several threads to priority + core affinity manage msbuild. Defaults to False.
- Yields:
None
- omni.repo.build.build.report_errors(
- output: List[str],
- match_indices: List[int],
- error_context: List[int],
Create a new TeamCity message block and report build errors with context.
Prints a block like the following: ############################## Error Encountered: ############################## In file included from ../../../source/plugins/ex.sample/SuperSpecialHashRayVis.cpp:16:0: ../Scene.h: In member function ‘bool rtx::scenedb::Scene::isAllInstancesInvisibleToSecondaryRay() const’: ../Scene.h:146:64: error: comparison between signed and unsigned integer expressions ################################################################################
- Parameters:
output – A list of strings containing the stdout/stderr coming out of the build tools.
match_indices – A list of ints containing matches where an error has been flagged.
error_context – Two-value list providing number of context lines for a match.
- omni.repo.build.build.resolve_tokens(
- value: str | list | dict | tuple,
- platform: str | None = None,
- extra_tokens: dict | None = None,
- source_debug: str = '',
Resolve tokens like ${root} or ${platform} in string, dict, list, tuple recursively.
Unknown tokens are left as is.
If str is passed - new string is returned, otherwise tokens are replaced in-place.
- Parameters:
value (Union[str, list, dict, tuple]) – Value to resolve tokens in.
platform (str, optional) – Platform to resolve tokens for. If None defaults to host platform.
extra_tokens (dict, optional) – Extra tokens to resolve. Defaults to None.
source_debug (str, optional) – Debug info about who called that. For logging and error messages.
- Returns:
Resolved string or same object with tokens replaced in-place.
- Return type:
Union[str, list, dict, tuple]
- omni.repo.build.build.run_process_return_output(
- args: List,
- exit_on_error=False,
- print_stdout=True,
- print_stderr=True,
- return_stderr=True,
- quiet=False,
- **kwargs,
Run system process and capture stdout/stderr as a list.
- Parameters:
args (List) – List of arguments.
exit_on_error (bool, optional) – Exit if return code is non zero.
print_stdout (bool, optional) – Print process stdout to stdout.
print_stderr (bool, optional) – Print process stderr to stderr. This is only relevant if return_stderr is False. If return_stderr is True, stderr is redirected into stdout. Note that if return_stderr is False and you print both stdout and stderr, all of stdout will be printed before stderr.
return_stderr (bool, optional) – Return stdout and stderr together.
quiet (bool, optional) – Print stdout/stderr to stdout on non-zero exit.
- Returns:
A tuple with return code and a list of strings containing stdout/stderr from run process.
- omni.repo.build.build.scan_for_errors(
- output: List[str],
- error_patterns: List[str],
Scan output for specified regexes in error_patterns
- Parameters:
output – A list of strings containing the stdout/stderr coming out of the build tools.
error_patterns – List of regexes for matching various error patterns.
- Returns:
A list of ints that are indices of regex matches on flagged errors.
- omni.repo.build.build.search_for_denvenv(vs_version: str = '2017', **kwargs) str | None#
- omni.repo.build.build.translated_arch() str#
Get host architecture, translate AMD64 -> x86_64.
- Returns:
Host CPU architecture
- Return type:
str