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
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__ (self, cfgFile, headers=(), libs=None, hasSwigFiles=True, includeFileDirs=["include"], libFileDirs=["lib"], hasDoxygenInclude=False, hasDoxygenTag=True, eupsProduct=None)
 Initialize the configuration object. More...
 
def addCustomTests (self, tests)
 Add custom SCons configuration tests to the Configure Context passed to the configure() method. More...
 
def configure (self, conf, packages, check=False, build=True)
 Update an SCons environment to make use of the package. More...
 

Static Public Member Functions

def parseFilename (cfgFile)
 
def getEupsData (eupsProduct)
 

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

Constructor & Destructor Documentation

◆ __init__()

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

163  hasDoxygenInclude=False, hasDoxygenTag=True, eupsProduct=None):
164  self.name, self.root = self.parseFilename(cfgFile)
165  if eupsProduct is None:
166  eupsProduct = self.name
167  self.eupsProduct = eupsProduct
168  version, productDir = self.getEupsData(self.eupsProduct)
169  if version is not None:
170  self.version = version
171  if productDir is None:
172  state.log.warn("Could not find EUPS product dir for '%s'; using %s."
173  % (self.eupsProduct, self.root))
174  else:
175  self.root = os.path.realpath(productDir)
176  self.doxygen = {
177  # Doxygen tag files generated by this package
178  "tags": ([os.path.join(self.root, "doc", "%s.tag" % self.name)]
179  if hasDoxygenTag else []),
180  # Doxygen include files to include in the configuration of dependent products
181  "includes": ([os.path.join(self.root, "doc", "%s.inc" % self.name)]
182  if hasDoxygenInclude else [])
183  }
184  if libs is None:
185  self.libs = {
186  # Normal libraries provided by this package
187  "main": [self.name],
188  # Libraries provided that should only be linked with Python modules
189  "python": [],
190  # Libraries provided that should only be linked with unit test code
191  "test": [],
192  }
193  elif "main" in libs:
194  self.libs = libs
195  else:
196  self.libs = {"main": libs, "python": [], "test": []}
197  self.paths = {}
198  if hasSwigFiles:
199  self.paths["SWIGPATH"] = [os.path.join(self.root, "python")]
200  else:
201  self.paths["SWIGPATH"] = []
202 
203  for pathName, subDirs in [("CPPPATH", includeFileDirs),
204  ("LIBPATH", libFileDirs)]:
205  self.paths[pathName] = []
206 
207  if state.env.linkFarmDir:
208  continue
209 
210  for subDir in subDirs:
211  pathDir = os.path.join(self.root, subDir)
212  if os.path.isdir(pathDir):
213  self.paths[pathName].append(pathDir)
214 
215  self.provides = {
216  "headers": tuple(headers),
217  "libs": tuple(self.libs["main"])
218  }
219 
std::shared_ptr< FrameSet > append(FrameSet const &first, FrameSet const &second)
Construct a FrameSet that performs two transformations in series.
Definition: functional.cc:33

Member Function Documentation

◆ addCustomTests()

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

230  def addCustomTests(self, tests):
231  pass
232 

◆ configure()

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

247  def configure(self, conf, packages, check=False, build=True):
248  assert(not (check and build))
249  conf.env.PrependUnique(**self.paths)
250  state.log.info("Configuring package '%s'." % self.name)
251  conf.env.doxygen["includes"].extend(self.doxygen["includes"])
252  if not build:
253  conf.env.doxygen["tags"].extend(self.doxygen["tags"])
254  for target in self.libs:
255  if target not in conf.env.libs:
256  conf.env.libs[target] = self.libs[target].copy()
257  state.log.info("Adding '%s' libraries to target '%s'." % (self.libs[target], target))
258  else:
259  for lib in self.libs[target]:
260  if lib not in conf.env.libs[target]:
261  conf.env.libs[target].append(lib)
262  state.log.info("Adding '%s' library to target '%s'." % (lib, target))
263  if check:
264  for header in self.provides["headers"]:
265  if not conf.CheckCXXHeader(header):
266  return False
267  for lib in self.libs["main"]:
268  if not conf.CheckLib(lib, autoadd=False, language="C++"):
269  return False
270  return True
271 
272 
273 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
274 
std::shared_ptr< FrameSet > append(FrameSet const &first, FrameSet const &second)
Construct a FrameSet that performs two transformations in series.
Definition: functional.cc:33
def configure(packageName, versionString=None, eupsProduct=None, eupsProductPath=None, noCfgFile=False)
Recursively configure a package using ups/.cfg files.
Definition: dependencies.py:38

◆ getEupsData()

def lsst.sconsUtils.dependencies.Configuration.getEupsData (   eupsProduct)
static

Definition at line 129 of file dependencies.py.

129  def getEupsData(eupsProduct):
130  version, eupsPathDir, productDir, table, flavor = eupsForScons.getEups().findSetupVersion(eupsProduct)
131  if productDir is None:
132  productDir = eupsForScons.productDir(eupsProduct)
133  return version, productDir
134 

◆ parseFilename()

def lsst.sconsUtils.dependencies.Configuration.parseFilename (   cfgFile)
static

Definition at line 123 of file dependencies.py.

123  def parseFilename(cfgFile):
124  dir, file = os.path.split(cfgFile)
125  name, ext = os.path.splitext(file)
126  return name, os.path.abspath(os.path.join(dir, ".."))
127 

Member Data Documentation

◆ doxygen

lsst.sconsUtils.dependencies.Configuration.doxygen

Definition at line 176 of file dependencies.py.

◆ eupsProduct

lsst.sconsUtils.dependencies.Configuration.eupsProduct

Definition at line 167 of file dependencies.py.

◆ libs

lsst.sconsUtils.dependencies.Configuration.libs

Definition at line 185 of file dependencies.py.

◆ paths

lsst.sconsUtils.dependencies.Configuration.paths

Definition at line 197 of file dependencies.py.

◆ provides

lsst.sconsUtils.dependencies.Configuration.provides

Definition at line 215 of file dependencies.py.

◆ root

lsst.sconsUtils.dependencies.Configuration.root

Definition at line 164 of file dependencies.py.

◆ version

lsst.sconsUtils.dependencies.Configuration.version

Definition at line 170 of file dependencies.py.


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