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

21 statements  

« prev     ^ index     » next       coverage.py v6.4.2, created at 2022-08-01 00:45 -0700

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: 

20 __version__ = "unknown" 

21 

22# Pull some names into the package namespace 

23from .dependencies import configure, Configuration, ExternalConfiguration 

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

25from .builders import ProductDir 

26 

27# These inject methods into SConsEnviroment 

28from . import installation 

29from . import builders 

30 

31# These should remain in their own namespaces 

32from . import scripts 

33from . import tests