9This script writes the full path to the MacSDK that is being used
10by the clang_mac toolchain for builds within this workspace. This
11path is created by //toolchain/download_mac_toolchain.bzl when
12downloading the mac toolchain, and the MacSDK directory is populated
13with symlinks to XCode's MacSDK contents.
21from pathlib
import Path
25 """Return the workspace directory containing this script."""
26 this_script_path =
Path(os.path.realpath(__file__))
27 return str(this_script_path.parent.parent)
31 """Return the Bazel hash for this workspace.
33 This is the MD5 has of the full path to the workspace. See
34 https://bazel.build/remote/output-directories
36 return hashlib.md5(ws).hexdigest()
40 """Return the Bazel repository cache directory."""
42 prev_cwd = os.getcwd()
44 cmd = [
"bazelisk",
"info",
"repository_cache"]
45 output = subprocess.check_output(cmd)
46 decoded_output = codecs.decode(output,
"utf-8")
47 return decoded_output.strip()
51 """Return the Bazel output directory.
53 This is described
in https://bazel.build/remote/output-directories
"""
57 output_dir = repo_cache_dir.parent.parent.parent
58 return str(output_dir)
62 """Determine the output directory cache for this workspace.
64 Note: The Bazel docs(1) are very clear that the organization of the output
65 directory may change at any time.
67 (1) https://bazel.build/remote/output-directories
73 """Determine the MacSDK symlinks directory for this workspace."""
77if "__main__" == __name__:
static void encode(uint8_t output[16], const uint32_t input[4])
def print(*args, **kwargs)