0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
mongodb/buildscripts/scons.py

39 lines
1021 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 verify_requirements, MissingRequirements
try:
verify_requirements('etc/pip/compile-requirements.txt')
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)
if __name__ == '__main__':
SCons.Script.main()