0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-24 00:17:37 +01:00
mongodb/buildscripts/scons.py
Juan Gu 855dfadef0 SERVER-94077 Use isort in Ruff configs (#27865)
GitOrigin-RevId: e793d662774ccd3ab6c3f356c2287cf1f7ff9805
2024-10-10 19:33:49 +00:00

45 lines
1006 B
Python
Executable File

#!/usr/bin/env python3
"""Scons module."""
import os
import sys
SCONS_VERSION = os.environ.get("SCONS_VERSION", "3.1.2")
MONGODB_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
SCONS_DIR = os.path.join(
MONGODB_ROOT, "src", "third_party", "scons-" + SCONS_VERSION, "scons-local-" + SCONS_VERSION
)
if not os.path.exists(SCONS_DIR):
print("Could not find SCons in '%s'" % (SCONS_DIR))
sys.exit(1)
SITE_TOOLS_DIR = os.path.join(MONGODB_ROOT, "site_scons")
sys.path = [SCONS_DIR, SITE_TOOLS_DIR] + sys.path
# pylint: disable=C0413
from mongo.pip_requirements import MissingRequirements, verify_requirements
try:
verify_requirements()
except MissingRequirements as ex:
print(ex)
sys.exit(1)
try:
import SCons.Script
except ImportError as import_err:
print("Could not import SCons from '%s'" % (SCONS_DIR))
print("ImportError:", import_err)
sys.exit(1)
def entrypoint():
SCons.Script.main()
if __name__ == "__main__":
entrypoint()