LSSTApplications  1.1.2+25,10.0+13,10.0+132,10.0+133,10.0+224,10.0+41,10.0+8,10.0-1-g0f53050+14,10.0-1-g4b7b172+19,10.0-1-g61a5bae+98,10.0-1-g7408a83+3,10.0-1-gc1e0f5a+19,10.0-1-gdb4482e+14,10.0-11-g3947115+2,10.0-12-g8719d8b+2,10.0-15-ga3f480f+1,10.0-2-g4f67435,10.0-2-gcb4bc6c+26,10.0-28-gf7f57a9+1,10.0-3-g1bbe32c+14,10.0-3-g5b46d21,10.0-4-g027f45f+5,10.0-4-g86f66b5+2,10.0-4-gc4fccf3+24,10.0-40-g4349866+2,10.0-5-g766159b,10.0-5-gca2295e+25,10.0-6-g462a451+1
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 38 of file dependencies.py.

38 
39 def configure(packageName, versionString=None, eupsProduct=None, eupsProductPath=None, noCfgFile=False):
40  if not state.env.GetOption("no_progress"):
41  state.log.info("Setting up environment to build package '%s'." % packageName)
42  if eupsProduct is None:
43  eupsProduct = packageName
44  if versionString is None:
45  versionString = "git"
46  state.env['eupsProduct'] = eupsProduct
47  state.env['packageName'] = packageName
48  #
49  # Setup installation directories and variables
50  #
51  SCons.Script.Help(state.opts.GenerateHelpText(state.env))
52  state.env.installing = filter(lambda t: t == "install", SCons.Script.BUILD_TARGETS)
53  state.env.declaring = filter(lambda t: t == "declare" or t == "current", SCons.Script.BUILD_TARGETS)
54  state.env.linkFarmDir = state.env.GetOption("linkFarmDir")
55  if state.env.linkFarmDir:
56  state.env.linkFarmDir = os.path.abspath(os.path.expanduser(state.env.linkFarmDir))
57  prefix = installation.setPrefix(state.env, versionString, eupsProductPath)
58  state.env['prefix'] = prefix
59  state.env["libDir"] = "%s/lib" % prefix
60  state.env["pythonDir"] = "%s/python" % prefix
61  #
62  # Process dependencies
63  #
64  state.log.traceback = state.env.GetOption("traceback")
65  state.log.verbose = state.env.GetOption("verbose")
66  packages = PackageTree(packageName, noCfgFile=noCfgFile)
67  state.log.flush() # if we've already hit a fatal error, die now.
68  state.env.libs = {"main":[], "python":[], "test":[]}
69  state.env.doxygen = {"tags":[], "includes":[]}
70  state.env['CPPPATH'] = []
71  state.env['LIBPATH'] = []
72 
73  # XCPPPATH is a new variable defined by sconsUtils - it's like CPPPATH, but the headers
74  # found there aren't treated as dependencies. This can make scons a lot faster.
75  state.env['XCPPPATH'] = []
76  state.env['_CPPINCFLAGS'] = \
77  "$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)}"\
78  " ${_concat(INCPREFIX, XCPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)"
79  state.env['_SWIGINCFLAGS'] = state.env['_CPPINCFLAGS'].replace("CPPPATH", "SWIGPATH")
80 
81  if state.env.linkFarmDir:
82  for d in [state.env.linkFarmDir, "#"]:
83  state.env.Append(CPPPATH=os.path.join(d, "include"))
84  state.env.Append(LIBPATH=os.path.join(d, "lib"))
85  state.env['SWIGPATH'] = state.env['CPPPATH']
86 
87  if not state.env.GetOption("clean") and not state.env.GetOption("help"):
88  packages.configure(state.env, check=state.env.GetOption("checkDependencies"))
89  for target in state.env.libs:
90  state.log.info("Libraries in target '%s': %s" % (target, state.env.libs[target]))
91  state.env.dependencies = packages
92  state.log.flush()
93 
94 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
def configure
Recursively configure a package using ups/.cfg files.
Definition: dependencies.py:38
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 305 of file dependencies.py.

306 def CustomCFlagCheck(context, flag, append=True):
307  context.Message("Checking if C compiler supports " + flag + " flag ")
308  ccflags = context.env["CCFLAGS"];
309  context.env.Append(CCFLAGS = flag)
310  result = context.TryCompile("int main(int argc, char **argv) { return 0; }", ".c")
311  context.Result(result)
312  if not append or not result:
313  context.env.Replace(CCFLAGS = ccflags)
314  return result
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 343 of file dependencies.py.

344 def CustomCompileCheck(context, message, source, extension=".cc"):
345  context.Message(message)
346 
347  env = context.env
348  if (env.GetOption("clean") or env.GetOption("help") or env.GetOption("no_exec")):
349  result = True
350  else:
351  result = context.TryCompile(source, extension)
352 
353  context.Result(result)
354 
355  return result
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 324 of file dependencies.py.

325 def CustomCppFlagCheck(context, flag, append=True):
326  context.Message("Checking if C++ compiler supports " + flag + " flag ")
327  cxxflags = context.env["CXXFLAGS"];
328  context.env.Append(CXXFLAGS = flag)
329  result = context.TryCompile("int main(int argc, char **argv) { return 0; }", ".cc")
330  context.Result(result)
331  if not append or not result:
332  context.env.Replace(CXXFLAGS = cxxflags)
333  return result
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 365 of file dependencies.py.

366 def CustomLinkCheck(context, message, source, extension=".cc"):
367  context.Message(message)
368  result = context.TryLink(source, extension)
369  context.Result(result)
370  return result
371 
372 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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 552 of file dependencies.py.

553 def getLibs(env, categories="main"):
554  libs = []
555  removeSelf = False
556  for category in categories.split():
557  if category == "self":
558  category = "main"
559  removeSelf = True
560  for lib in env.libs[category]:
561  if lib not in libs:
562  libs.append(lib)
563  if removeSelf:
564  try:
565  libs.remove(env["packageName"])
566  except ValueError:
567  pass
568  return libs
569 
570 SConsEnvironment.getLibs = getLibs
def getLibs
Get the libraries the package should be linked with.