in python/runfiles/runfiles.py [0:0]
def Rlocation(self, path):
"""Returns the runtime path of a runfile.
Runfiles are data-dependencies of Bazel-built binaries and tests.
The returned path may not be valid. The caller should check the path's
validity and that the path exists.
The function may return None. In that case the caller can be sure that the
rule does not know about this data-dependency.
Args:
path: string; runfiles-root-relative path of the runfile
Returns:
the path to the runfile, which the caller should check for existence, or
None if the method doesn't know about this runfile
Raises:
TypeError: if `path` is not a string
ValueError: if `path` is None or empty, or it's absolute or not normalized
"""
if not path:
raise ValueError()
if not isinstance(path, str):
raise TypeError()
if (
path.startswith("../")
or "/.." in path
or path.startswith("./")
or "/./" in path
or path.endswith("/.")
or "//" in path
):
raise ValueError('path is not normalized: "%s"' % path)
if path[0] == "\\":
raise ValueError('path is absolute without a drive letter: "%s"' % path)
if os.path.isabs(path):
return path
return self._strategy.RlocationChecked(path)