BasicSConscript

class lsst.sconsUtils.scripts.BasicSConscript

Bases: object

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

All methods of BasicSConscript are static. All of these functions update the targets dictionary of targets used to set default targets and fix build dependencies; if you build anything without using BasicSConscript methods, be sure to manually add it to the targets dict.

Methods Summary

doc([config, projectName, projectNumber])

Convenience function to replace standard doc/SConscript boilerplate.

examples([ccList, swigNameList, swigSrc])

Convenience function to replace standard examples/SConscript boilerplate.

lib([libName, src, libs, noBuildList])

Convenience function to replace standard lib/SConscript boilerplate.

pybind11([nameList, libs, extraSrc, ...])

Convenience function to replace standard python/*/SConscript boilerplate.

python([module, src, extra, libs])

Convenience function to replace standard python/*/SConscript boilerplate.

shebang([src])

Handles shebang rewriting.

tests([pyList, ccList, swigNameList, ...])

Convenience function to replace standard tests/SConscript boilerplate.

Methods Documentation

static doc(config='doxygen.conf.in', projectName=None, projectNumber=None, **kwargs)

Convenience function to replace standard doc/SConscript boilerplate.

With no arguments, this will generate a Doxygen config file and run Doxygen with lsst.sconsUtils.env.Doxygen, using the projectName and projectNumber from env["packageName"] and env["version"], respectively.

This essentially just forwards all arguments (which should be passed as keyword arguments) to lsst.sconsUtils.env.Doxygen()`.

Parameters:
configstr, optional

Configuration .in file to use.

projectNamestr, optional

Project name.

projectNumberstr, optional

Project version number.

kwargs
Returns:
result???

???

static examples(ccList=None, swigNameList=None, swigSrc=None)

Convenience function to replace standard examples/SConscript boilerplate.

Parameters:
ccListlist, optional

A sequence of C++ examples to build (including .cc extensions). Defaults to a *.cc glob of the examples directory, minus any files that end with *_wrap.cc and files present in swigSrc.

swigNameListlist, optional

A sequence of SWIG modules to build (NOT including .i extensions).

swigSrclist, optional

Additional source files to be compiled into SWIG modules, as a dictionary; each key must be an entry in swigNameList, and each value a list of additional source files.

Returns:
result???

???

static lib(libName=None, src=None, libs='self', noBuildList=None)

Convenience function to replace standard lib/SConscript boilerplate.

With no arguments, this will build a shared library with the same name as the package. This uses lsst.sconsUtils.env.SourcesForSharedLibrary to support the optFiles/noOptFiles command-line variables.

Parameters:
libNamestr

Name of the shared libray to be built (defaults to env["packageName"]).

srcstr or Glob

Source to compile into the library. Defaults to a 4-directory deep glob of all *.cc files in #src.

libsstr or list

Libraries to link against, either as a string argument to be passed to lsst.sconsUtils.env.getLibs or a sequence of actual libraries to pass in.

noBuildListlist

List of source files to exclude from building.

Returns:
result???

???

static pybind11(nameList=[], libs='main python', extraSrc=None, addUnderscore=True)

Convenience function to replace standard python/*/SConscript boilerplate.

Note

Deprecated

Use lsst.sconsUtils.scripts.BasicSConscript.python for new code with all source compiled into a single module. Will be removed once all LSST code has been converted to use the new approach.

Parameters:
nameListlist, optional

Sequence of pybind11 modules to be built (does not include the file extensions).

libsstr or list, optional

Libraries to link against, either as a string argument to be passed to lsst.sconsUtils.env.getLibs or a sequence of actual libraries to pass in.

extraSrcdict, optional

A dictionary of additional source files that go into the modules. Each key should be an entry in nameList, and each value should be a list of additional C++ source files.

addUnderscorebool, optional

Add an underscore to each library name (if the source file name does not already start with underscore)? If False the library name is always the same as the source file name DEPRECATED: always use False for new code.

Returns:
resultlsst.sconsUtils.env.Pybin11LoadbleModule

A Pybind11LoadableModule instance.

static python(module=None, src=None, extra=(), libs='main python')

Convenience function to replace standard python/*/SConscript boilerplate.

With no arguments, this will build a pybind11 module with the name determined according to our current pseudo-convention: last part of env["packageName"] (split by underscores), with an underscore prepended. All .cc files in the same directory will be linked into a single module.

Parameters:
modulestr, optional

Name of the module to build (does not include the file extension). Defaults to "_" + env["packageName"].split("_")[-1].

srclist, optional

A list of source files to build the module from; defaults to all .cc files in the directory.

extralist, optional

A list of additional source files to add to src; should only be used if src is defaulted.

libsstr or list, optional

Libraries to link against, either as a string argument to be passed to lsst.sconsUtils.env.getLibs or a sequence of actual libraries to pass in.

Returns:
resultlsst.sconsUtils.env.Pybin11LoadbleModule

A Pybind11LoadableModule instance.

static shebang(src=None)

Handles shebang rewriting.

With no arguments looks in bin.src/ and copies to bin/ If needShebangRewrite() is False the shebang will not be modified.

Only Python files requiring a shebang rewrite should be placed in bin.src/. Do not place executable binaries in this directory.

Parameters:
srcstr or Glob, optional

Glob to use to search for files.

static tests(pyList=None, ccList=None, swigNameList=None, swigSrc=None, ignoreList=None, noBuildList=None, pySingles=None, args=None)

Convenience function to replace standard tests/SConscript boilerplate.

With no arguments, will attempt to figure out which files should be run as tests and which are support code (like SWIG modules).

Python tests will be marked as dependent on the entire #python directory and any SWIG modules built in the tests directory. This should ensure tests are always run when their results might have changed, but may result in them being re-run more often than necessary.

Parameters:
pyListlist, optional

A sequence of Python tests to run (including .py extensions). Defaults to a *.py glob of the tests directory, minus any files corresponding to the SWIG modules in swigFileList. An empty list will enable automated test discovery.

ccListlist, optional

A sequence of C++ unit tests to run (including .cc extensions). Defaults to a *.cc glob of the tests directory, minus any files that end with *_wrap.cc and files present in swigSrc.

swigNameListlist, optional

A sequence of SWIG modules to build (NOT including .i extensions).

swigSrcdict, optional

Additional source files to be compiled into SWIG modules, as a dictionary; each key must be an entry in swigNameList, and each value a list of additional source files.

ignoreListlist, optional

List of ignored tests to be passed to lsst.sconsUtils.tests.Control (note that ignored tests will be built, but not run).

noBuildListlist, optional

List of tests that should not even be built.

pySingleslist, optional

A sequence of Python tests to run (including .py extensions) as independent single tests. By default this list is empty and all tests are run in a single pytest call. Items specified here will not appear in the default pyList and should not start with test_ (such that they will not be auto-discoverable by pytest).

argsdict, optional

A dictionary of program arguments for tests, passed directly to lsst.sconsUtils.tests.Control.

Returns:
result???

???