BasicSConstruct

class lsst.sconsUtils.scripts.BasicSConstruct(packageName, versionString=None, eupsProduct=None, eupsProductPath=None, cleanExt=None, defaultTargets=('lib', 'python', 'shebang', 'tests', 'examples', 'doc'), subDirList=None, ignoreRegex=None, versionModuleName='python/lsst/%s/version.py', noCfgFile=False, sconscriptOrder=None, disableCc=False)

Bases: object

A scope-only class for SConstruct-replacement convenience functions.

The boilerplate for a standard LSST SConstruct file is replaced by two static methods: initialize() and finish(). The former configures dependencies, sets up package-dependent environment variables, and calls any SConscript files found in subdirectories, while the latter sets up installation paths, default targets, and explicit dependencies.

Calling BasicSConstruct as a function invokes its __new__ method, which calls both initialize and finish, and should be used when the SConstruct file doesn’t need to do anything other than what they provide. When called this way it returns the env Environment object rather than a BasicSConstruct instance (which would be useless).

Methods Summary

finish([defaultTargets, subDirList, ignoreRegex])

Convenience function to replace standard SConstruct boilerplate (step 2).

initialize(packageName[, versionString, ...])

Convenience function to replace standard SConstruct boilerplate (step 1).

Methods Documentation

static finish(defaultTargets=('lib', 'python', 'shebang', 'tests', 'examples', 'doc'), subDirList=None, ignoreRegex=None)

Convenience function to replace standard SConstruct boilerplate (step 2).

This function:

  • Sets up installation paths.

  • Tells SCons to only do MD5 checks when timestamps have changed.

  • Sets the “include”, “lib”, “python”, and “tests” targets as the defaults to be built when scons is run with no target arguments.

Parameters:
subDirListlist

An explicit list of subdirectories that should be installed. By default, all non-hidden subdirectories will be installed.

defaultTargetslist

A sequence of targets (see lsst.sconsUtils.state.targets) that should be built when scons is run with no arguments.

ignoreRegexstr

Regular expression that matches files that should not be installed.

Returns:
envlsst.sconsUtils.env

A SCons Environment.

classmethod initialize(packageName, versionString=None, eupsProduct=None, eupsProductPath=None, cleanExt=None, versionModuleName='python/lsst/%s/version.py', noCfgFile=False, sconscriptOrder=None, disableCc=False)

Convenience function to replace standard SConstruct boilerplate (step 1).

This function:

  • Calls all SConscript files found in subdirectories.

  • Configures dependencies.

  • Sets how the --clean option works.

Parameters:
packageNamestr

Name of the package being built; must correspond to a .cfg file in ups/.

versionStringstr, optional

Version-control system string to be parsed for version information ($HeadURL$ for SVN). Defaults to “git” if not set or None.

eupsProductstr, optional

Name of the EUPS product being built. Defaults to and is almost always the name of the package.

eupsProductPathstr, optional

An alternate directory where the package should be installed.

cleanExtlist, optional

Whitespace delimited sequence of globs for files to remove with --clean.

versionModuleNamestr, optional

If non-None, builds a version.py module as this file; '%s' is replaced with the name of the package.

noCfgFilebool, optional

If True, this package has no .cfg file

sconscriptOrderlist, optional

A sequence of directory names that set the order for processing SConscript files discovered in nested directories. Full directories need not be specified, but paths must begin at the root. For example, ["lib", "python"] will ensure that lib/SConscript is run before both python/foo/SConscript and python/bar/SConscript. The default order should work for most LSST SCons builds, as it provides the correct ordering for the lib, python, tests, examples, and doc targets. If this argument is provided, it must include the subset of that list that is valid for the package, in that order.

disableCCbool, optional

Should the C++ compiler check be disabled? Disabling this checks allows a faster startup and permits building on systems that don’t meet the requirements for the C++ compilter (e.g., for pure-python packages).

Returns:
envlsst.sconsUtils.env

A SCons Environment object.