LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
lsst.sconsUtils.dependencies.Configuration Class Reference

Base class for defining how to configure an LSST sconsUtils package. More...

Inheritance diagram for lsst.sconsUtils.dependencies.Configuration:
lsst.sconsUtils.dependencies.ExternalConfiguration

Public Member Functions

def __init__
 Initialize the configuration object. More...
 
def addCustomTests
 Add custom SCons configuration tests to the Configure Context passed to the configure() method. More...
 
def configure
 Update an SCons environment to make use of the package. More...
 

Static Public Member Functions

def parseFilename
 Parse the name of a .cfg file, returning the package name and root directory. More...
 
def getEupsData
 

Public Attributes

 root
 
 eupsProduct
 
 version
 
 doxygen
 
 libs
 
 paths
 
 provides
 

Detailed Description

Base class for defining how to configure an LSST sconsUtils package.

Aliased as lsst.sconsUtils.Configuration.

An ups/*.cfg file should contain an instance of this class called "config". Most LSST packages will be able to use this class directly instead of subclassing it.

The only important method is configure(), which modifies an SCons environment to use the package. If a subclass overrides configure, it may not need to call the base class init(), whose only purpose is to define a number of instance variables used by configure().

Definition at line 110 of file dependencies.py.

Constructor & Destructor Documentation

def lsst.sconsUtils.dependencies.Configuration.__init__ (   self,
  cfgFile,
  headers = (),
  libs = None,
  hasSwigFiles = True,
  includeFileDirs = ["include",
  libFileDirs = ["lib",
  hasDoxygenInclude = False,
  hasDoxygenTag = True,
  eupsProduct = None 
)

Initialize the configuration object.

Parameters
cfgFileThe name of the calling .cfg file, usually just passed in with the special variable file. This will be parsed to extract the package name and root.
headersA list of headers provided by the package, to be used in autoconf-style tests.
libsA list or dictionary of libraries provided by the package. If a dictionary is provided, libs["main"] should contain a list of regular libraries provided by the library. Other keys are "python" and "test", which refer to libraries that are only linked against compiled Python modules and unit tests, respectively. If a list is provided, the list is used as "main". These are used both for autoconf-style tests and to support env.getLibs(...), which recursively computes the libraries a package must be linked with.
hasSwigFilesIf True, the package provides SWIG interface files in "<root>/python".
hasDoxygenIncludeIf True, the package provides a Doxygen include file with the name "<root>/doc/<name>.inc".
hasDoxygenTagIf True, the package generates a Doxygen TAG file.
includeFileDirsList of directories that should be searched for include files
libFileDirsList of directories that should be searched for libraries
eupsProductName of the EUPS product for the package, if different from the name of the .cfg file.

Definition at line 154 of file dependencies.py.

155  hasDoxygenInclude=False, hasDoxygenTag=True, eupsProduct=None):
156  self.name, self.root = self.parseFilename(cfgFile)
157  if eupsProduct is None:
158  eupsProduct = self.name
159  self.eupsProduct = eupsProduct
160  version, productDir = self.getEupsData(self.eupsProduct)
161  if version is not None:
162  self.version = version
163  if productDir is None:
164  state.log.warn("Could not find EUPS product dir for '%s'; using %s."
165  % (self.eupsProduct, self.root))
166  else:
167  self.root = os.path.realpath(productDir)
168  self.doxygen = {
169  # Doxygen tag files generated by this package
170  "tags": ([os.path.join(self.root, "doc", "%s.tag" % self.name)]
171  if hasDoxygenTag else []),
172  # Doxygen include files to include in the configuration of dependent products
173  "includes": ([os.path.join(self.root, "doc", "%s.inc" % self.name)]
174  if hasDoxygenInclude else [])
175  }
176  if libs is None:
177  self.libs = {
178  # Normal libraries provided by this package
179  "main": [self.name],
180  # Libraries provided that should only be linked with Python modules
181  "python":[],
182  # Libraries provided that should only be linked with unit test code
183  "test":[],
184  }
185  elif "main" in libs:
186  self.libs = libs
187  else:
188  self.libs = {"main": libs, "python": [], "test": []}
189  self.paths = {}
190  if hasSwigFiles:
191  self.paths["SWIGPATH"] = [os.path.join(self.root, "python")]
192  else:
193  self.paths["SWIGPATH"] = []
194 
195  for pathName, subDirs in [("CPPPATH", includeFileDirs),
196  ("LIBPATH", libFileDirs),]:
197  self.paths[pathName] = []
198 
199  if state.env.linkFarmDir:
200  continue
201 
202  for subDir in subDirs:
203  pathDir = os.path.join(self.root, subDir)
204  if os.path.isdir(pathDir):
205  self.paths[pathName].append(pathDir)
207  self.provides = {
208  "headers": tuple(headers),
209  "libs": tuple(self.libs["main"])
210  }
def parseFilename
Parse the name of a .cfg file, returning the package name and root directory.

Member Function Documentation

def lsst.sconsUtils.dependencies.Configuration.addCustomTests (   self,
  tests 
)

Add custom SCons configuration tests to the Configure Context passed to the configure() method.

This needs to be done up-front so we can pass in a dictionary of custom tests when calling env.Configure(), and use the same configure context for all packages.

Parameters
testsA dictionary to add custom tests to. This will be passed as the custom_tests argument to env.Configure().

Definition at line 221 of file dependencies.py.

222  def addCustomTests(self, tests):
223  pass
def addCustomTests
Add custom SCons configuration tests to the Configure Context passed to the configure() method...
def lsst.sconsUtils.dependencies.Configuration.configure (   self,
  conf,
  packages,
  check = False,
  build = True 
)

Update an SCons environment to make use of the package.

Parameters
confAn SCons Configure context. The SCons Environment conf.env should be updated by the configure function.
packagesA dictionary containing the configuration modules of all dependencies (or None if the dependency was optional and was not found). The <module>.config.configure(...) method will have already been called on all dependencies.
checkIf True, perform autoconf-style tests to verify that key components are in fact in place.
buildIf True, this is the package currently being built, and packages in "buildRequired" and "buildOptional" dependencies will also be present in the packages dict.

Definition at line 238 of file dependencies.py.

239  def configure(self, conf, packages, check=False, build=True):
240  assert(not (check and build))
241  conf.env.PrependUnique(**self.paths)
242  state.log.info("Configuring package '%s'." % self.name)
243  conf.env.doxygen["includes"].extend(self.doxygen["includes"])
244  if not build:
245  conf.env.doxygen["tags"].extend(self.doxygen["tags"])
246  for target in self.libs:
247  if target not in conf.env.libs:
248  conf.env.libs[target] = lib[target].copy()
249  state.log.info("Adding '%s' libraries to target '%s'." % (self.libs[target], target))
250  else:
251  for lib in self.libs[target]:
252  if lib not in conf.env.libs[target]:
253  conf.env.libs[target].append(lib)
254  state.log.info("Adding '%s' library to target '%s'." % (lib, target))
255  if check:
256  for header in self.provides["headers"]:
257  if not conf.CheckCXXHeader(header): return False
258  for lib in self.libs["main"]:
259  if not conf.CheckLib(lib, autoadd=False, language="C++"): return False
260  return True
261 
262 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
SelectEigenView< T >::Type copy(Eigen::EigenBase< T > const &other)
Copy an arbitrary Eigen expression into a new EigenView.
Definition: eigen.h:390
def configure
Update an SCons environment to make use of the package.
def lsst.sconsUtils.dependencies.Configuration.getEupsData (   eupsProduct)
static

Definition at line 120 of file dependencies.py.

121  def getEupsData(eupsProduct):
122  version, eupsPathDir, productDir, table, flavor = eupsForScons.getEups().findSetupVersion(eupsProduct)
123  if productDir is None:
124  productDir = eupsForScons.productDir(eupsProduct)
125  return version, productDir
def lsst.sconsUtils.dependencies.Configuration.parseFilename (   cfgFile)
static

Parse the name of a .cfg file, returning the package name and root directory.

Definition at line 114 of file dependencies.py.

115  def parseFilename(cfgFile):
116  dir, file = os.path.split(cfgFile)
117  name, ext = os.path.splitext(file)
118  return name, os.path.abspath(os.path.join(dir, ".."))
def parseFilename
Parse the name of a .cfg file, returning the package name and root directory.

Member Data Documentation

lsst.sconsUtils.dependencies.Configuration.doxygen

Definition at line 167 of file dependencies.py.

lsst.sconsUtils.dependencies.Configuration.eupsProduct

Definition at line 158 of file dependencies.py.

lsst.sconsUtils.dependencies.Configuration.libs

Definition at line 176 of file dependencies.py.

lsst.sconsUtils.dependencies.Configuration.paths

Definition at line 188 of file dependencies.py.

lsst.sconsUtils.dependencies.Configuration.provides

Definition at line 206 of file dependencies.py.

lsst.sconsUtils.dependencies.Configuration.root

Definition at line 155 of file dependencies.py.

lsst.sconsUtils.dependencies.Configuration.version

Definition at line 161 of file dependencies.py.


The documentation for this class was generated from the following file: