LSSTApplications  11.0-13-gbb96280,12.1.rc1,12.1.rc1+1,12.1.rc1+2,12.1.rc1+5,12.1.rc1+8,12.1.rc1-1-g06d7636+1,12.1.rc1-1-g253890b+5,12.1.rc1-1-g3d31b68+7,12.1.rc1-1-g3db6b75+1,12.1.rc1-1-g5c1385a+3,12.1.rc1-1-g83b2247,12.1.rc1-1-g90cb4cf+6,12.1.rc1-1-g91da24b+3,12.1.rc1-2-g3521f8a,12.1.rc1-2-g39433dd+4,12.1.rc1-2-g486411b+2,12.1.rc1-2-g4c2be76,12.1.rc1-2-gc9c0491,12.1.rc1-2-gda2cd4f+6,12.1.rc1-3-g3391c73+2,12.1.rc1-3-g8c1bd6c+1,12.1.rc1-3-gcf4b6cb+2,12.1.rc1-4-g057223e+1,12.1.rc1-4-g19ed13b+2,12.1.rc1-4-g30492a7
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  state.env['_CPPINCFLAGS'] = \
78  "$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)}"\
79  " ${_concat(INCPREFIX, XCPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)"
80  state.env['_SWIGINCFLAGS'] = state.env['_CPPINCFLAGS'].replace("CPPPATH", "SWIGPATH")
81 
82  if state.env.linkFarmDir:
83  for d in [state.env.linkFarmDir, "#"]:
84  state.env.Append(CPPPATH=os.path.join(d, "include"))
85  state.env.Append(LIBPATH=os.path.join(d, "lib"))
86  state.env['SWIGPATH'] = state.env['CPPPATH']
87 
88  if not state.env.GetOption("clean") and not state.env.GetOption("help"):
89  packages.configure(state.env, check=state.env.GetOption("checkDependencies"))
90  for target in state.env.libs:
91  state.log.info("Libraries in target '%s': %s" % (target, state.env.libs[target]))
92  state.env.dependencies = packages
93  state.log.flush()
94 
95 
96 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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 311 of file dependencies.py.

312 def CustomCFlagCheck(context, flag, append=True):
313  context.Message("Checking if C compiler supports " + flag + " flag ")
314  ccflags = context.env["CCFLAGS"]
315  context.env.Append(CCFLAGS=flag)
316  result = context.TryCompile("int main(int argc, char **argv) { return 0; }", ".c")
317  context.Result(result)
318  if not append or not result:
319  context.env.Replace(CCFLAGS=ccflags)
320  return result
321 
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 351 of file dependencies.py.

352 def CustomCompileCheck(context, message, source, extension=".cc"):
353  context.Message(message)
354 
355  env = context.env
356  if (env.GetOption("clean") or env.GetOption("help") or env.GetOption("no_exec")):
357  result = True
358  else:
359  result = context.TryCompile(source, extension)
360 
361  context.Result(result)
362 
363  return result
364 
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 331 of file dependencies.py.

332 def CustomCppFlagCheck(context, flag, append=True):
333  context.Message("Checking if C++ compiler supports " + flag + " flag ")
334  cxxflags = context.env["CXXFLAGS"]
335  context.env.Append(CXXFLAGS=flag)
336  result = context.TryCompile("int main(int argc, char **argv) { return 0; }", ".cc")
337  context.Result(result)
338  if not append or not result:
339  context.env.Replace(CXXFLAGS=cxxflags)
340  return result
341 
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 374 of file dependencies.py.

375 def CustomLinkCheck(context, message, source, extension=".cc"):
376  context.Message(message)
377  result = context.TryLink(source, extension)
378  context.Result(result)
379  return result
380 
381 
382 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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 559 of file dependencies.py.

560 def getLibs(env, categories="main"):
561  libs = []
562  removeSelf = False
563  for category in categories.split():
564  if category == "self":
565  category = "main"
566  removeSelf = True
567  for lib in env.libs[category]:
568  if lib not in libs:
569  libs.append(lib)
570  if removeSelf:
571  try:
572  libs.remove(env["packageName"])
573  except ValueError:
574  pass
575  return libs
576 
577 SConsEnvironment.getLibs = getLibs
def getLibs
Get the libraries the package should be linked with.