Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@cached_property
def tools_path(self):
"""Get the path that should be added to $PATH to expose this suite's
tools.
Returns:
Absolute path as a string, or None if this suite was not loaded
from disk.
"""
return os.path.join(self.load_path, "bin") if self.load_path else None
@cached_property
def hostname(self):
"""
@returns The machine hostname, eg 'somesvr'
"""
import socket
return socket.gethostname()
@cached_property
def post_commands(self):
return self._convert_to_rex(self._post_commands)
@cached_property
@platform_mapped
def arch(self):
"""Returns the name of the architecture."""
return self._arch()
@cached_property
def logical_cores(self):
"""Return the number of cpu cores as reported to the os.
May be different from physical_cores if, ie, intel's hyperthreading is
enabled.
"""
try:
return self._logical_cores()
except Exception as e:
from rez.utils.logging_ import print_error
print_error("Error detecting logical core count, defaulting to 1: %s"
% str(e))
return 1
@cached_property
def tmpdir(self):
"""Return system default temporary directory path."""
return self._tmpdir()
@cached_property
def variant(self):
"""Returns a list of the form ["platform-X", "arch-X", "os-X"] suitable
for use as a variant in a system-dependent package."""
return ["platform-%s" % self.platform,
"arch-%s" % self.arch,
"os-%s" % self.os]
@cached_property
def active_suite_context_name(self):
"""Get the name of the currently active context in a parent suite.
If a parent suite exists, then an active context exists - this is the
context that a tool in the suite is currently running in.
Returns:
(str) Context name, or None if there is no parent suite (and thus
no active context).
"""
if self.context:
return self.context.suite_context_name
return None
@cached_property
def physical_cores(self):
"""Return the number of physical cpu cores on the system."""
try:
return self._physical_cores_base()
except Exception as e:
from rez.utils.logging_ import print_error
print_error("Error detecting physical core count, defaulting to 1: %s"
% str(e))
return 1
@cached_property
def difftool(self):
"""Return the system default file diff tool."""
return self._difftool()