LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Static Public Member Functions | List of all members
lsst.sconsUtils.scripts.BasicSConscript Class Reference

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

Inheritance diagram for lsst.sconsUtils.scripts.BasicSConscript:

Static Public Member Functions

def lib
 Convenience function to replace standard lib/SConscript boilerplate. More...
 
def python
 Convenience function to replace standard python/*/SConscript boilerplate. More...
 
def doc
 Convenience function to replace standard doc/SConscript boilerplate. More...
 
def tests
 Convenience function to replace standard tests/SConscript boilerplate. More...
 
def examples
 Convenience function to replace standard examples/SConscript boilerplate. More...
 

Detailed Description

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

All methods of BasicSConscript are static. All of these functions update the state.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 it to the state.targets dict.

Definition at line 180 of file scripts.py.

Member Function Documentation

def lsst.sconsUtils.scripts.BasicSConscript.doc (   config = "doxygen.conf.in",
  projectName = None,
  projectNumber = None,
  kw 
)
static

Convenience function to replace standard doc/SConscript boilerplate.

With no arguments, this will generate a Doxygen config file and run Doxygen with 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 env.Doxygen().

Definition at line 253 of file scripts.py.

254  def doc(config="doxygen.conf.in", projectName=None, projectNumber=None, **kw):
255  if not find_executable("doxygen"):
256  state.log.warn("doxygen executable not found; skipping documentation build.")
257  return []
258  if projectName is None:
259  projectName = ".".join(["lsst"] + state.env["packageName"].split("_"))
260  if projectNumber is None:
261  projectNumber = state.env["version"]
262  result = state.env.Doxygen(
263  config, projectName=projectName, projectNumber=projectNumber,
264  includes=state.env.doxygen["includes"],
265  useTags=state.env.doxygen["tags"],
266  makeTag=(state.env["packageName"] + ".tag"),
267  **kw
268  )
269  state.targets["doc"].extend(result)
270  return result
def doc
Convenience function to replace standard doc/SConscript boilerplate.
Definition: scripts.py:253
def lsst.sconsUtils.scripts.BasicSConscript.examples (   ccList = None,
  swigNameList = None,
  swigSrc = None 
)
static

Convenience function to replace standard examples/SConscript boilerplate.

Parameters
ccListA 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.
swigNameListA sequence of SWIG modules to build (NOT including .i extensions).
swigSrcAdditional 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.

Definition at line 361 of file scripts.py.

362  def examples(ccList=None, swigNameList=None, swigSrc=None):
363  if swigNameList is None:
364  swigFileList = Glob("*.i")
365  swigNameList = [_getFileBase(node) for node in swigFileList]
366  else:
367  swigFileList = [File(name) for name in swigNameList]
368  if swigSrc is None:
369  swigSrc = {}
370  allSwigSrc = set()
371  for name, node in zip(swigNameList, swigFileList):
372  src = swigSrc.setdefault(name, [])
373  allSwigSrc.update(str(element) for element in src)
374  src.append(node)
375  if ccList is None:
376  ccList = [node for node in Glob("*.cc")
377  if (not str(node).endswith("_wrap.cc")) and str(node) not in allSwigSrc]
378  state.log.info("SWIG modules for examples: %s" % swigFileList)
379  state.log.info("C++ examples: %s" % ccList)
380  results = []
381  for src in ccList:
382  results.extend(state.env.Program(src, LIBS=state.env.getLibs("main")))
383  swigMods = []
384  for name, src in swigSrc.items():
385  results.extend(
386  state.env.SwigLoadableModule("_" + name, src, LIBS=state.env.getLibs("main python"))
387  )
388  for result in results:
389  state.env.Depends(result, state.targets["lib"])
390  state.targets["examples"].extend(results)
391  return results
def examples
Convenience function to replace standard examples/SConscript boilerplate.
Definition: scripts.py:361
def lsst.sconsUtils.scripts.BasicSConscript.lib (   libName = None,
  src = None,
  libs = "self" 
)
static

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 env.SourcesForSharedLibrary to support the optFiles/noOptFiles command-line variables.

Parameters
libNameName of the shared libray to be built (defaults to env["packageName"]).
srcSource to compile into the library. Defaults to a 4-directory deep glob of all *.cc files in #src.
libsLibraries to link against, either as a string argument to be passed to env.getLibs() or a sequence of actual libraries to pass in.

Definition at line 195 of file scripts.py.

196  def lib(libName=None, src=None, libs="self"):
197  if libName is None:
198  libName = state.env["packageName"]
199  if src is None:
200  src = Glob("#src/*.cc") + Glob("#src/*/*.cc") + Glob("#src/*/*/*.cc") + Glob("#src/*/*/*/*.cc")
201  src = state.env.SourcesForSharedLibrary(src)
202  if isinstance(libs, basestring):
203  libs = state.env.getLibs(libs)
204  elif libs is None:
205  libs = []
206  result = state.env.SharedLibrary(libName, src, LIBS=libs)
207  state.targets["lib"].extend(result)
208  return result
def lib
Convenience function to replace standard lib/SConscript boilerplate.
Definition: scripts.py:195
def lsst.sconsUtils.scripts.BasicSConscript.python (   swigNameList = None,
  libs = "main python",
  swigSrc = None 
)
static

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

With no arguments, this will build a SWIG module with the name determined according to our current pseudo-convention: last part of env["packageName"], split by underscores, with "Lib" appended to the end.

Parameters
swigNameListSequence of SWIG modules to be built (does not include the file extensions).
libsLibraries to link against, either as a string argument to be passed to env.getLibs() or a sequence of actual libraries to pass in.
swigSrcA dictionary of additional source files that go into the modules. Each key should be an entry in swigNameList, and each value should be a list of additional C++ source files not generated by SWIG.

Definition at line 224 of file scripts.py.

225  def python(swigNameList=None, libs="main python", swigSrc=None):
226  if swigNameList is None:
227  swigNameList = [state.env["packageName"].split("_")[-1] + "Lib"]
228  swigFileList = [File(name + ".i") for name in swigNameList]
229  if swigSrc is None:
230  swigSrc = {}
231  for name, node in zip(swigNameList, swigFileList):
232  swigSrc.setdefault(name, []).append(node)
233  if isinstance(libs, basestring):
234  libs = state.env.getLibs(libs)
235  elif libs is None:
236  libs = []
237  result = []
238  for name, src in swigSrc.items():
239  result.extend(state.env.SwigLoadableModule("_" + name, src, LIBS=libs))
240  state.targets["python"].extend(result)
241  return result
def python
Convenience function to replace standard python/*/SConscript boilerplate.
Definition: scripts.py:224
def lsst.sconsUtils.scripts.BasicSConscript.tests (   pyList = None,
  ccList = None,
  swigNameList = None,
  swigSrc = None,
  ignoreList = None,
  noBuildList = None,
  args = None 
)
static

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
pyListA 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.
ccListA 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.
swigNameListA sequence of SWIG modules to build (NOT including .i extensions).
swigSrcAdditional 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 of ignored tests to be passed to tests.Control (note that ignored tests will be built, but not run).
nobuildListList of tests that should not even be built.
argsA dictionary of program arguments for tests, passed directly to tests.Control.

Definition at line 301 of file scripts.py.

302  args=None):
303  if noBuildList is None:
304  noBuildList = []
305  if swigNameList is None:
306  swigFileList = Glob("*.i")
307  swigNameList = [_getFileBase(node) for node in swigFileList]
308  else:
309  swigFileList = [File(name + ".i") for name in swigNameList]
310  if swigSrc is None:
311  swigSrc = {}
312  allSwigSrc = set()
313  for name, node in zip(swigNameList, swigFileList):
314  src = swigSrc.setdefault(name, [])
315  allSwigSrc.update(str(element) for element in src)
316  src.append(node)
317  if pyList is None:
318  pyList = [node for node in Glob("*.py")
319  if _getFileBase(node) not in swigNameList
320  and os.path.basename(str(node)) not in noBuildList]
321  if ccList is None:
322  ccList = [node for node in Glob("*.cc")
323  if (not str(node).endswith("_wrap.cc")) and str(node) not in allSwigSrc
324  and os.path.basename(str(node)) not in noBuildList]
325  if ignoreList is None:
326  ignoreList = []
327  s = lambda l: [str(i) for i in l]
328  state.log.info("SWIG modules for tests: %s" % s(swigFileList))
329  state.log.info("Python tests: %s" % s(pyList))
330  state.log.info("C++ tests: %s" % s(ccList))
331  state.log.info("Files that will not be built: %s" % noBuildList)
332  state.log.info("Ignored tests: %s" % ignoreList)
333  control = tests.Control(state.env, ignoreList=ignoreList, args=args, verbose=True)
334  for ccTest in ccList:
335  state.env.Program(ccTest, LIBS=state.env.getLibs("main test"))
336  swigMods = []
337  for name, src in swigSrc.items():
338  swigMods.extend(
339  state.env.SwigLoadableModule("_" + name, src, LIBS=state.env.getLibs("main python"))
340  )
341  ccList = [control.run(str(node)) for node in ccList]
342  pyList = [control.run(str(node)) for node in pyList]
343  for pyTest in pyList:
344  state.env.Depends(pyTest, swigMods)
345  state.env.Depends(pyTest, state.targets["python"])
346  result = ccList + pyList
347  state.targets["tests"].extend(result)
348  return result
A class to control unit tests.
Definition: tests.py:17

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