Coverage for python/lsst/sconsUtils/__init__.py: 55%

18 statements  

« prev     ^ index     » next       coverage.py v7.17.5, created at 2026-11-26 06:02 +0000

1# Explain what happens when you try to import outside scons 

2# When building documentation you want to force a SCons import 

3import os 

4import sys 

5 

6if ("pydoc" in sys.modules or "sphinx" in sys.modules) and "SCONS_DIR" in os.environ: 6 ↛ 7line 6 didn't jump to line 7 because the condition on line 6 was never true

7 scons_path = os.path.join(os.environ["SCONS_DIR"], "lib", "scons") 

8 if scons_path not in sys.path: 

9 sys.path.append(scons_path) 

10 

11try: 

12 import SCons.Script 

13except ImportError: 

14 raise ImportError("lsst.sconsUtils cannot be imported outside an scons script.") 

15 

16# Try to import the generated version module. 

17try: 

18 from .version import * 

19except Exception: 

20 __version__ = "unknown" 

21 

22# These should remain in their own namespaces 

23# These inject methods into SConsEnviroment 

24from . import builders, installation, scripts, tests 

25 

26# Pull some names into the package namespace 

27from .builders import ProductDir 

28from .dependencies import Configuration, ExternalConfiguration, configure 

29from .state import env, log, opts, targets