lsst.base  13.0-5-g77abda3+1
LSST Data Management Base Package
 All Classes Namespaces Files Functions Variables Friends Macros Pages
Classes | Functions | Variables
lsst.base.packages Namespace Reference

Classes

class  Packages
 

Functions

def getVersionFromPythonModule
 
def getPythonPackages
 
def getEnvironmentPackages
 

Variables

list __all__ = ["getVersionFromPythonModule", "getPythonPackages", "getEnvironmentPackages", "Packages"]
 
tuple BUILDTIME = set(["boost", "eigen", "tmv"])
 
tuple PYTHON = set(["galsim"])
 
tuple ENVIRONMENT = set(["astrometry_net", "astrometry_net_data", "minuit2", "xpa"])
 
 _eups = None
 

Detailed Description

Determine which packages are being used in the system and their versions

There are a few different types of packages, and their versions are collected in different ways:
1. Run-time libraries (e.g., cfitsio, fftw): we get their version from interrogating the dynamic library
2. Python modules (e.g., afw, numpy; galsim is also in this group even though we only use it through the
   library, because no version information is currently provided through the library): we get their version
   from the __version__ module variable. Note that this means that we're only aware of modules that have
   already been imported.
3. Other packages provide no run-time accessible version information (e.g., astrometry_net): we get their
   version from interrogating the environment. Currently, that means EUPS; if EUPS is replaced or dropped then
   we'll need to consider an alternative means of getting this version information.
4. Local versions of packages (a non-installed EUPS package, selected with "setup -r /path/to/package"): we
   identify these through the environment (EUPS again) and use as a version the path supplemented with the
   git SHA and, if the git repo isn't clean, an MD5 of the diff.

These package versions are collected and stored in a Packages object, which provides useful comparison and
persistence features.

Example usage:

    from lsst.base import Packages
    pkgs = Packages.fromSystem()
    print "Current packages:", pkgs
    old = Packages.read("/path/to/packages.pickle")
    print "Old packages:", old
    print "Missing packages compared to before:", pkgs.missing(old)
    print "Extra packages compared to before:", pkgs.extra(old)
    print "Different packages: ", pkgs.difference(old)
    old.update(pkgs)  # Include any new packages in the old
    old.write("/path/to/packages.pickle")

Function Documentation

def lsst.base.packages.getEnvironmentPackages ( )
Provide a dict of products and their versions from the environment

We use EUPS to determine the version of certain products (those that don't provide
a means to determine the version any other way) and to check if uninstalled packages
are being used. We only report the product/version for these packages.

Definition at line 130 of file packages.py.

def lsst.base.packages.getPythonPackages ( )
Return a dict of imported python packages and their versions

We wade through sys.modules and attempt to determine the version for each
module.  Note, therefore, that we can only report on modules that have
*already* been imported.

We don't include any module for which we cannot determine a version.

Definition at line 82 of file packages.py.

def lsst.base.packages.getVersionFromPythonModule (   module)
Determine the version of a python module

Will raise AttributeError if the __version__ attribute is not set.

We supplement the version with information from the __dependency_versions__
(a specific variable set by LSST's sconsUtils at build time) only for packages
that are typically used only at build-time.

Definition at line 62 of file packages.py.

Variable Documentation

list lsst.base.packages.__all__ = ["getVersionFromPythonModule", "getPythonPackages", "getEnvironmentPackages", "Packages"]

Definition at line 47 of file packages.py.

lsst.base.packages._eups = None

Definition at line 129 of file packages.py.

tuple lsst.base.packages.BUILDTIME = set(["boost", "eigen", "tmv"])

Definition at line 51 of file packages.py.

tuple lsst.base.packages.ENVIRONMENT = set(["astrometry_net", "astrometry_net_data", "minuit2", "xpa"])

Definition at line 59 of file packages.py.

tuple lsst.base.packages.PYTHON = set(["galsim"])

Definition at line 55 of file packages.py.