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 | Public Attributes | Static Public Attributes | Properties | List of all members
lsst.sconsUtils.dependencies.PackageTree Class Reference

A class for loading and managing the dependency tree of a package, as defined by its configuration module (.cfg) file. More...

Public Member Functions

def __init__ (self, primaryName, noCfgFile=False)
 Recursively load *.cfg files for packageName and all its dependencies. More...
 
def configure (self, env, check=False)
 
def __contains__ (self, name)
 
def __getitem__ (self, name)
 
def get (self, name, default=None)
 
def keys (self)
 

Public Attributes

 cfgPath
 
 packages
 
 customTests
 
 primary
 

Static Public Attributes

def has_key = __contains__
 

Properties

 name = property(lambda self: self.primary.config.name)
 

Detailed Description

A class for loading and managing the dependency tree of a package, as defined by its configuration module (.cfg) file.

This tree isn't actually stored as a tree; it's flattened into an ordered dictionary as it is recursively loaded.

The main SCons produced by configure() and available as sconsUtils.env will contain an instance of this class as env.dependencies.

Its can be used like a read-only dictionary to check whether an optional package has been configured; a package that was not found will have a value of None, while a configured package's value will be its imported .cfg module.

Definition at line 407 of file dependencies.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.sconsUtils.dependencies.PackageTree.__init__ (   self,
  primaryName,
  noCfgFile = False 
)

Recursively load *.cfg files for packageName and all its dependencies.

Parameters
primaryNameThe name of the primary package being built.
noCfgFileIf True, this package has no .cfg file

After init, self.primary will be set to the configuration module for the primary package, and self.packages will be an OrderedDict of dependencies (excluding self.primary), ordered such that configuration can proceed in iteration order.

Definition at line 419 of file dependencies.py.

419  def __init__(self, primaryName, noCfgFile=False):
420  self.cfgPath = state.env.cfgPath
421  self.packages = collections.OrderedDict()
422  self.customTests = {
423  "CustomCFlagCheck": CustomCFlagCheck,
424  "CustomCppFlagCheck": CustomCppFlagCheck,
425  "CustomCompileCheck": CustomCompileCheck,
426  "CustomLinkCheck": CustomLinkCheck,
427  }
428  self._current = set([primaryName])
429  if noCfgFile:
430  self.primary = None
431  return
432 
433  self.primary = self._tryImport(primaryName)
434  if self.primary is None:
435  state.log.fail("Failed to load primary package configuration for %s." % primaryName)
436 
437  missingDeps = []
438  for dependency in self.primary.dependencies.get("required", ()):
439  if not self._recurse(dependency):
440  missingDeps.append(dependency)
441  if missingDeps:
442  state.log.fail("Failed to load required dependencies: \"%s\"" % '", "'.join(missingDeps))
443 
444  missingDeps = []
445  for dependency in self.primary.dependencies.get("buildRequired", ()):
446  if not self._recurse(dependency):
447  missingDeps.append(dependency)
448  if missingDeps:
449  state.log.fail("Failed to load required build dependencies: \"%s\"" % '", "'.join(missingDeps))
450 
451  for dependency in self.primary.dependencies.get("optional", ()):
452  self._recurse(dependency)
453 
454  for dependency in self.primary.dependencies.get("buildOptional", ()):
455  self._recurse(dependency)
456 
daf::base::PropertySet * set
Definition: fits.cc:832
def __init__(self, minimum, dataRange, Q)

Member Function Documentation

◆ __contains__()

def lsst.sconsUtils.dependencies.PackageTree.__contains__ (   self,
  name 
)

Definition at line 480 of file dependencies.py.

480  def __contains__(self, name):
481  return name == self.name or name in self.packages
482 

◆ __getitem__()

def lsst.sconsUtils.dependencies.PackageTree.__getitem__ (   self,
  name 
)

Definition at line 485 of file dependencies.py.

485  def __getitem__(self, name):
486  if name == self.name:
487  return self.primary
488  else:
489  return self.packages[name]
490 

◆ configure()

def lsst.sconsUtils.dependencies.PackageTree.configure (   self,
  env,
  check = False 
)

Definition at line 460 of file dependencies.py.

460  def configure(self, env, check=False):
461  conf = env.Configure(custom_tests=self.customTests)
462  for name, module in self.packages.items():
463  if module is None:
464  state.log.info("Skipping missing optional package %s." % name)
465  continue
466  if not module.config.configure(conf, packages=self.packages, check=check, build=False):
467  state.log.fail("%s was found but did not pass configuration checks." % name)
468  if self.primary:
469  self.primary.config.configure(conf, packages=self.packages, check=False, build=True)
470  env.AppendUnique(SWIGPATH=env["CPPPATH"])
471  env.AppendUnique(XSWIGPATH=env["XCPPPATH"])
472  # reverse the order of libraries in env.libs, so libraries that fulfill a dependency
473  # of another appear after it. required by the linker to successfully resolve symbols
474  # in static libraries.
475  for target in env.libs:
476  env.libs[target].reverse()
477  env = conf.Finish()
478  return env
479 
def configure(packageName, versionString=None, eupsProduct=None, eupsProductPath=None, noCfgFile=False)
Recursively configure a package using ups/.cfg files.
Definition: dependencies.py:38
std::vector< SchemaItem< Flag > > * items

◆ get()

def lsst.sconsUtils.dependencies.PackageTree.get (   self,
  name,
  default = None 
)

Definition at line 491 of file dependencies.py.

491  def get(self, name, default=None):
492  if name == self.name:
493  return self.primary
494  else:
495  return self.packages.get(name)
496 

◆ keys()

def lsst.sconsUtils.dependencies.PackageTree.keys (   self)

Definition at line 497 of file dependencies.py.

497  def keys(self):
498  k = list(self.packages.keys())
499  k.append(self.name)
500  return k
501 
daf::base::PropertyList * list
Definition: fits.cc:833

Member Data Documentation

◆ cfgPath

lsst.sconsUtils.dependencies.PackageTree.cfgPath

Definition at line 420 of file dependencies.py.

◆ customTests

lsst.sconsUtils.dependencies.PackageTree.customTests

Definition at line 422 of file dependencies.py.

◆ has_key

def lsst.sconsUtils.dependencies.PackageTree.has_key = __contains__
static

Definition at line 483 of file dependencies.py.

◆ packages

lsst.sconsUtils.dependencies.PackageTree.packages

Definition at line 421 of file dependencies.py.

◆ primary

lsst.sconsUtils.dependencies.PackageTree.primary

Definition at line 430 of file dependencies.py.

Property Documentation

◆ name

lsst.sconsUtils.dependencies.PackageTree.name = property(lambda self: self.primary.config.name)
static

Definition at line 457 of file dependencies.py.


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