LSSTApplications  16.0-10-g0ee56ad+4,16.0-11-ga33d1f2+4,16.0-12-g3ef5c14+2,16.0-12-g71e5ef5+17,16.0-12-gbdf3636+2,16.0-13-g118c103+2,16.0-13-g8f68b0a+2,16.0-15-gbf5c1cb+3,16.0-16-gfd17674+2,16.0-17-g7c01f5c+2,16.0-18-g0a50484,16.0-20-ga20f992+7,16.0-21-g0e05fd4+5,16.0-21-g15e2d33+3,16.0-22-g62d8060+3,16.0-22-g847a80f+3,16.0-25-gf00d9b8,16.0-28-g3990c221+3,16.0-3-gf928089+2,16.0-32-g88a4f23+4,16.0-34-gd7987ad+2,16.0-37-gc7333cb+1,16.0-4-g10fc685+1,16.0-4-g18f3627+25,16.0-4-g5f3a788+25,16.0-5-gaf5c3d7+3,16.0-5-gcc1f4bb,16.0-6-g3b92700+3,16.0-6-g4412fcd+2,16.0-6-g7235603+3,16.0-69-g2562ce1b+1,16.0-7-g0913a87,16.0-8-g14ebd58+3,16.0-8-g2df868b,16.0-8-g4cec79c+5,16.0-8-gadf6c7a,16.0-82-g59ec2a54a,16.0-9-g5400cdc+1,16.0-9-ge6233d7+4,master-g2880f2d8cf+2,v17.0.rc1
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 (packageName, versionString=None, eupsProduct=None, eupsProductPath=None, noCfgFile=False)
 Recursively configure a package using ups/.cfg files. More...
 
def lsst.sconsUtils.dependencies.CustomCFlagCheck (context, flag, append=True)
 A configuration test that checks whether a C compiler supports a particular flag. More...
 
def lsst.sconsUtils.dependencies.CustomCppFlagCheck (context, flag, append=True)
 A configuration test that checks whether a C++ compiler supports a particular flag. More...
 
def lsst.sconsUtils.dependencies.CustomCompileCheck (context, message, source, extension=".cc")
 A configuration test that checks whether the given source code compiles. More...
 
def lsst.sconsUtils.dependencies.CustomLinkCheck (context, message, source, extension=".cc")
 A configuration test that checks whether the given source code compiles and links. More...
 
def lsst.sconsUtils.dependencies.getLibs (env, categories="main")
 Get the libraries the package should be linked with. More...
 

Detailed Description

Function Documentation

◆ configure()

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

◆ CustomCFlagCheck()

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 321 of file dependencies.py.

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

◆ CustomCompileCheck()

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 361 of file dependencies.py.

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

◆ CustomCppFlagCheck()

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 341 of file dependencies.py.

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

◆ CustomLinkCheck()

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 384 of file dependencies.py.

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

◆ getLibs()

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 569 of file dependencies.py.

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