LSSTApplications  11.0-13-gbb96280,12.1+18,12.1+7,12.1-1-g14f38d3+72,12.1-1-g16c0db7+5,12.1-1-g5961e7a+84,12.1-1-ge22e12b+23,12.1-11-g06625e2+4,12.1-11-g0d7f63b+4,12.1-19-gd507bfc,12.1-2-g7dda0ab+38,12.1-2-gc0bc6ab+81,12.1-21-g6ffe579+2,12.1-21-gbdb6c2a+4,12.1-24-g941c398+5,12.1-3-g57f6835+7,12.1-3-gf0736f3,12.1-37-g3ddd237,12.1-4-gf46015e+5,12.1-5-g06c326c+20,12.1-5-g648ee80+3,12.1-5-gc2189d7+4,12.1-6-ga608fc0+1,12.1-7-g3349e2a+5,12.1-7-gfd75620+9,12.1-9-g577b946+5,12.1-9-gc4df26a+10
LSSTDataManagementBasePackage
Classes | Functions
Dependencies and Configuration

Classes

class  lsst.sconsUtils.dependencies.Configuration
 Base class for defining how to configure an LSST sconsUtils package. More...
 
class  lsst.sconsUtils.dependencies.ExternalConfiguration
 A Configuration subclass for external (third-party) packages. More...
 
class  lsst.sconsUtils.dependencies.PackageTree
 A class for loading and managing the dependency tree of a package, as defined by its configuration module (.cfg) file. More...
 

Functions

def lsst.sconsUtils.dependencies.configure
 Recursively configure a package using ups/.cfg files. More...
 
def lsst.sconsUtils.dependencies.CustomCFlagCheck
 A configuration test that checks whether a C compiler supports a particular flag. More...
 
def lsst.sconsUtils.dependencies.CustomCppFlagCheck
 A configuration test that checks whether a C++ compiler supports a particular flag. More...
 
def lsst.sconsUtils.dependencies.CustomCompileCheck
 A configuration test that checks whether the given source code compiles. More...
 
def lsst.sconsUtils.dependencies.CustomLinkCheck
 A configuration test that checks whether the given source code compiles and links. More...
 
def lsst.sconsUtils.dependencies.getLibs
 Get the libraries the package should be linked with. More...
 

Detailed Description

Function Documentation

def lsst.sconsUtils.dependencies.configure (   packageName,
  versionString = None,
  eupsProduct = None,
  eupsProductPath = None,
  noCfgFile = False 
)

Recursively configure a package using ups/.cfg files.

Aliased as lsst.sconsUtils.configure().

Usually, LSST packages will call this function through scripts.BasicSConstruct.

Parameters
packageNameName of the package being built; must correspond to a .cfg file in ups/.
versionStringVersion-control system string to be parsed for version information ($HeadURL$ for SVN).
eupsProductName of the EUPS product being built. Defaults to and is almost always the name of the package.
eupsProductPathAn alternate directory where the package should be installed.
noCfgFileIf True, this package has no .cfg file
Returns
an SCons Environment object (which is also available as lsst.sconsUtils.env).

Definition at line 39 of file dependencies.py.

39 
40 def configure(packageName, versionString=None, eupsProduct=None, eupsProductPath=None, noCfgFile=False):
41  if not state.env.GetOption("no_progress"):
42  state.log.info("Setting up environment to build package '%s'." % packageName)
43  if eupsProduct is None:
44  eupsProduct = packageName
45  if versionString is None:
46  versionString = "git"
47  state.env['eupsProduct'] = eupsProduct
48  state.env['packageName'] = packageName
49  #
50  # Setup installation directories and variables
51  #
52  SCons.Script.Help(state.opts.GenerateHelpText(state.env))
53  state.env.installing = [t for t in SCons.Script.BUILD_TARGETS if t == "install"]
54  state.env.declaring = [t for t in SCons.Script.BUILD_TARGETS if t == "declare" or t == "current"]
55  state.env.linkFarmDir = state.env.GetOption("linkFarmDir")
56  if state.env.linkFarmDir:
57  state.env.linkFarmDir = os.path.abspath(os.path.expanduser(state.env.linkFarmDir))
58  prefix = installation.setPrefix(state.env, versionString, eupsProductPath)
59  state.env['prefix'] = prefix
60  state.env["libDir"] = "%s/lib" % prefix
61  state.env["pythonDir"] = "%s/python" % prefix
62  #
63  # Process dependencies
64  #
65  state.log.traceback = state.env.GetOption("traceback")
66  state.log.verbose = state.env.GetOption("verbose")
67  packages = PackageTree(packageName, noCfgFile=noCfgFile)
68  state.log.flush() # if we've already hit a fatal error, die now.
69  state.env.libs = {"main": [], "python": [], "test": []}
70  state.env.doxygen = {"tags": [], "includes": []}
71  state.env['CPPPATH'] = []
72  state.env['LIBPATH'] = []
73 
74  # XCPPPATH is a new variable defined by sconsUtils - it's like CPPPATH, but the headers
75  # found there aren't treated as dependencies. This can make scons a lot faster.
76  state.env['XCPPPATH'] = []
77 
78  # XCPPPPREFIX is a replacement for SCons' built-in INCPREFIX. It is used
79  # when compiling headers in XCPPPATH directories. Here, we set it to
80  # `-isystem`, so that those are regarded as "system headers" and warnings
81  # are suppressed.
82  state.env['XCPPPREFIX'] = "-isystem "
83 
84  state.env['_CPPINCFLAGS'] = \
85  "$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)}"\
86  " ${_concat(XCPPPREFIX, XCPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)"
87  state.env['_SWIGINCFLAGS'] = state.env['_CPPINCFLAGS'] \
88  .replace("CPPPATH", "SWIGPATH") \
89  .replace("XCPPPREFIX", "SWIGINCPREFIX")
90 
91  if state.env.linkFarmDir:
92  for d in [state.env.linkFarmDir, "#"]:
93  state.env.Append(CPPPATH=os.path.join(d, "include"))
94  state.env.Append(LIBPATH=os.path.join(d, "lib"))
95  state.env['SWIGPATH'] = state.env['CPPPATH']
96 
97  if not state.env.GetOption("clean") and not state.env.GetOption("help"):
98  packages.configure(state.env, check=state.env.GetOption("checkDependencies"))
99  for target in state.env.libs:
100  state.log.info("Libraries in target '%s': %s" % (target, state.env.libs[target]))
101  state.env.dependencies = packages
102  state.log.flush()
103 
104 
105 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
def configure
Recursively configure a package using ups/.cfg files.
Definition: dependencies.py:39
A class for loading and managing the dependency tree of a package, as defined by its configuration mo...
def lsst.sconsUtils.dependencies.CustomCFlagCheck (   context,
  flag,
  append = True 
)

A configuration test that checks whether a C compiler supports a particular flag.

Parameters
contextConfiguration context.
flagFlag to test, e.g. "-fvisibility-inlines-hidden".
appendAutomatically append the flag to context.env["CCFLAGS"] if the compiler supports it?

Definition at line 322 of file dependencies.py.

323 def CustomCFlagCheck(context, flag, append=True):
324  context.Message("Checking if C compiler supports " + flag + " flag ")
325  ccflags = context.env["CCFLAGS"]
326  context.env.Append(CCFLAGS=flag)
327  result = context.TryCompile("int main(int argc, char **argv) { return 0; }", ".c")
328  context.Result(result)
329  if not append or not result:
330  context.env.Replace(CCFLAGS=ccflags)
331  return result
332 
def CustomCFlagCheck
A configuration test that checks whether a C compiler supports a particular flag. ...
def lsst.sconsUtils.dependencies.CustomCompileCheck (   context,
  message,
  source,
  extension = ".cc" 
)

A configuration test that checks whether the given source code compiles.

Parameters
contextConfiguration context.
messageMessage disaplyed on console prior to running the test.
sourceSource code to compile. param extension Identifies the language of the source code. Use ".c" for C, and ".cc" for C++ (the default).

Definition at line 362 of file dependencies.py.

363 def CustomCompileCheck(context, message, source, extension=".cc"):
364  context.Message(message)
365 
366  env = context.env
367  if (env.GetOption("clean") or env.GetOption("help") or env.GetOption("no_exec")):
368  result = True
369  else:
370  result = context.TryCompile(source, extension)
371 
372  context.Result(result)
373 
374  return result
375 
def CustomCompileCheck
A configuration test that checks whether the given source code compiles.
def lsst.sconsUtils.dependencies.CustomCppFlagCheck (   context,
  flag,
  append = True 
)

A configuration test that checks whether a C++ compiler supports a particular flag.

Parameters
contextConfiguration context.
flagFlag to test, e.g. "-fvisibility-inlines-hidden".
appendAutomatically append the flag to context.env["CXXFLAGS"] if the compiler supports it?

Definition at line 342 of file dependencies.py.

343 def CustomCppFlagCheck(context, flag, append=True):
344  context.Message("Checking if C++ compiler supports " + flag + " flag ")
345  cxxflags = context.env["CXXFLAGS"]
346  context.env.Append(CXXFLAGS=flag)
347  result = context.TryCompile("int main(int argc, char **argv) { return 0; }", ".cc")
348  context.Result(result)
349  if not append or not result:
350  context.env.Replace(CXXFLAGS=cxxflags)
351  return result
352 
def CustomCppFlagCheck
A configuration test that checks whether a C++ compiler supports a particular flag.
def lsst.sconsUtils.dependencies.CustomLinkCheck (   context,
  message,
  source,
  extension = ".cc" 
)

A configuration test that checks whether the given source code compiles and links.

Parameters
contextConfiguration context.
messageMessage disaplyed on console prior to running the test.
sourceSource code to compile. param extension Identifies the language of the source code. Use ".c" for C, and ".cc" for C++ (the default).

Definition at line 385 of file dependencies.py.

386 def CustomLinkCheck(context, message, source, extension=".cc"):
387  context.Message(message)
388  result = context.TryLink(source, extension)
389  context.Result(result)
390  return result
391 
392 
393 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
def CustomLinkCheck
A configuration test that checks whether the given source code compiles and links.
def lsst.sconsUtils.dependencies.getLibs (   env,
  categories = "main" 
)

Get the libraries the package should be linked with.

Parameters
categoriesA string containing whitespace-delimited categories. Standard categories are "main", "python", and "test". Default is "main". A special virtual category "self" can be provided, returning the results of targets="main" with the env["packageName"] removed.

Typically, main libraries will be linked with LIBS=getLibs("self"), Python modules will be linked with LIBS=getLibs("main python") and C++-coded test programs will be linked with LIBS=getLibs("main test"). """

Definition at line 570 of file dependencies.py.

571 def getLibs(env, categories="main"):
572  libs = []
573  removeSelf = False
574  for category in categories.split():
575  if category == "self":
576  category = "main"
577  removeSelf = True
578  for lib in env.libs[category]:
579  if lib not in libs:
580  libs.append(lib)
581  if removeSelf:
582  try:
583  libs.remove(env["packageName"])
584  except ValueError:
585  pass
586  return libs
587 
588 SConsEnvironment.getLibs = getLibs
def getLibs
Get the libraries the package should be linked with.