Skip to content

Commit

Permalink
make compiler check fire only when needed
Browse files Browse the repository at this point in the history
The compiler check in lsst.sconsUtils.state._configureCommon
fires whenever you import lsst.sconsUtils, even if you don't
have any C++ code and all you want out of lsst.sconsUtils is
some utility completely unrelated to C++. Besides just wasting
time, this makes it difficult to run ci_hsc on a cluster nodes
that don't have the latest gcc installed.

Instead, have the compiler check only fire when we need it, as
defined by instantiating BasicSConstruct. The compiler check
can also be disabled when using BasicSConstruct by instantiating
it with disableCc=True.
  • Loading branch information
PaulPrice committed Mar 28, 2018
1 parent 79b7e05 commit 0d2ae6b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 7 additions & 3 deletions python/lsst/sconsUtils/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ def __new__(cls, packageName, versionString=None, eupsProduct=None, eupsProductP
defaultTargets=DEFAULT_TARGETS,
subDirList=None, ignoreRegex=None,
versionModuleName="python/lsst/%s/version.py", noCfgFile=False,
sconscriptOrder=None):
sconscriptOrder=None, disableCc=False):
cls.initialize(packageName, versionString, eupsProduct, eupsProductPath, cleanExt,
versionModuleName, noCfgFile=noCfgFile, sconscriptOrder=sconscriptOrder)
versionModuleName, noCfgFile=noCfgFile, sconscriptOrder=sconscriptOrder,
disableCc=disableCc)
cls.finish(defaultTargets, subDirList, ignoreRegex)
return state.env

Expand Down Expand Up @@ -99,7 +100,10 @@ def __new__(cls, packageName, versionString=None, eupsProduct=None, eupsProductP
@classmethod
def initialize(cls, packageName, versionString=None, eupsProduct=None, eupsProductPath=None,
cleanExt=None, versionModuleName="python/lsst/%s/version.py", noCfgFile=False,
sconscriptOrder=None):
sconscriptOrder=None, disableCc=False):
if not disableCc:
state._configureCommon()
state._saveState()
if cls._initializing:
state.log.fail("Recursion detected; an SConscript file should not call BasicSConstruct.")
cls._initializing = True
Expand Down
10 changes: 8 additions & 2 deletions python/lsst/sconsUtils/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,16 @@ def _initEnvironment():
env['eupsFlavor'] = eupsForScons.flavor()


_configured = False


def _configureCommon():
"""Configuration checks for the compiler, platform, and standard libraries."""
global _configured
if _configured:
return
_configured = True

#
# Is the C compiler really gcc/g++?
#
Expand Down Expand Up @@ -503,7 +511,5 @@ def _saveState():
_initLog()
_initVariables()
_initEnvironment()
_configureCommon()
_saveState()

# @endcond

0 comments on commit 0d2ae6b

Please sign in to comment.