lsst.sconsUtils  16.0-15-g57c515d
Classes | Functions
lsst.sconsUtils.utils Namespace Reference

Classes

class  Log
 A dead-simple logger for all messages. More...
 

Functions

def libraryPathPassThrough ()
 Returns name of library path environment variable to be passed through or else returns None if no pass through is required on this platform. More...
 
def whichPython ()
 Returns the full path to the Python executable as determined from the PATH. More...
 
def needShebangRewrite ()
 Returns True if the shebang lines of executables should be rewritten. More...
 
def libraryLoaderEnvironment ()
 Returns library loader path environment string to be prepended to external commands Will be "" if nothing is required. More...
 
def runExternal (cmd, fatal=False, msg=None)
 Safe wrapper for running external programs, reading stdout, and sanitizing error messages. More...
 
def memberOf (cls, name=None)
 A Python decorator that injects functions into a class. More...
 

Function Documentation

◆ libraryLoaderEnvironment()

def lsst.sconsUtils.utils.libraryLoaderEnvironment ( )

Returns library loader path environment string to be prepended to external commands Will be "" if nothing is required.

If we have an OS X with System Integrity Protection enabled or similar we need to pass through both DYLD_LIBRARY_PATH and LSST_LIBRARY_PATH to the external command. DYLD_LIBRARY_PATH for Python code LSST_LIBRARY_PATH for shell scripts

If both are already defined then pass them each through If only one is defined, then set both to the defined env variable If neither is defined then pass through nothing.

References lsst.sconsUtils.utils.libraryPathPassThrough().

◆ libraryPathPassThrough()

def lsst.sconsUtils.utils.libraryPathPassThrough ( )

Returns name of library path environment variable to be passed through or else returns None if no pass through is required on this platform.

Referenced by lsst.sconsUtils.utils.libraryLoaderEnvironment().

◆ memberOf()

def lsst.sconsUtils.utils.memberOf (   cls,
  name = None 
)

A Python decorator that injects functions into a class.

For example:

class test_class:
pass
@memberOf(test_class):
def test_method(self):
print "test_method!"

...will cause test_method to appear as as if it were defined within test_class.

The function or method will still be added to the module scope as well, replacing any existing module-scope function with that name; this appears to be unavoidable.

Referenced by lsst.sconsUtils.installation.DirectoryInstaller.__call__(), lsst.sconsUtils.builders.DoxygenBuilder.buildConfig(), lsst.sconsUtils.builders.BuildETags(), lsst.sconsUtils.builders.CleanTree(), lsst.sconsUtils.builders.Doxygen(), lsst.sconsUtils.builders.filesToTag(), lsst.sconsUtils.installation.InstallDir(), lsst.sconsUtils.installation.InstallEups(), lsst.sconsUtils.builders.Pybind11LoadableModule(), lsst.sconsUtils.installation.setPrefix(), and lsst.sconsUtils.builders.SharedLibraryIncomplete().

◆ needShebangRewrite()

def lsst.sconsUtils.utils.needShebangRewrite ( )

Returns True if the shebang lines of executables should be rewritten.

◆ runExternal()

def lsst.sconsUtils.utils.runExternal (   cmd,
  fatal = False,
  msg = None 
)

Safe wrapper for running external programs, reading stdout, and sanitizing error messages.

Command can be given as a list/tuple of command with separate options.

Note that the entire program output is returned, not just a single line.

Returns
Strings not bytes.

Referenced by lsst.sconsUtils.utils.whichPython().

◆ whichPython()

def lsst.sconsUtils.utils.whichPython ( )

Returns the full path to the Python executable as determined from the PATH.

Does not return the full path of the Python running SCons. Caches result and assumes the PATH does not change between calls. Runs the "python" command and asks where it is rather than scanning the PATH.

References lsst.sconsUtils.utils.runExternal().