mongo/bazel/wrapper_hook/post_bazel_hook.py
Daniel Moody 670f1f2eb5 SERVER-124059 fix nested bazel wrapper python installs (#51811)
GitOrigin-RevId: 6c8022df8625f61340036f7db6b4e1fbbb9ae7e1
2026-04-15 19:15:04 +00:00

34 lines
1009 B
Python

# Hook to be called around bazel invocation time. Does not run on Windows.
import os
import pathlib
import sys
REPO_ROOT = pathlib.Path(__file__).parent.parent.parent
sys.path.append(str(REPO_ROOT))
from bazel.wrapper_hook.install_modules import bootstrap_modules
BAZEL_USER_NAMESPACE = "user-prod"
BAZEL_CI_NAMESPACE = "ci-prod"
def main():
bootstrap_modules(sys.argv[1], sys.argv[1:])
from bazel.wrapper_hook.compiledb import finalize_compiledb_posthook
from bazel.wrapper_hook.flag_sync import sync_flags
if os.environ.get("NO_FLAG_SYNC") is None:
if os.environ.get("CI") is None:
sync_flags(BAZEL_USER_NAMESPACE)
else:
sync_flags(BAZEL_CI_NAMESPACE)
enterprise = (REPO_ROOT / "src" / "mongo" / "db" / "modules" / "enterprise").exists()
atlas = (REPO_ROOT / "src" / "mongo" / "db" / "modules" / "atlas").exists()
finalize_compiledb_posthook(sys.argv[1], enterprise=enterprise, atlas=atlas)
if __name__ == "__main__":
main()