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
Public Member Functions | Public Attributes | List of all members
lsst.sconsUtils.installation.DirectoryInstaller Class Reference

SCons Action callable to recursively install a directory. More...

Inheritance diagram for lsst.sconsUtils.installation.DirectoryInstaller:

Public Member Functions

def __init__
 
def __call__
 

Public Attributes

 ignoreRegex
 
 recursive
 

Detailed Description

SCons Action callable to recursively install a directory.

This is separate from the InstallDir function to allow the directory-walking to happen when installation is actually invoked, rather than when the SConscripts are parsed. This still does not ensure that all necessary files are built as prerequisites to installing, but if one explicitly marks the install targets as dependent on the build targets, that should be enough.

Definition at line 226 of file installation.py.

Constructor & Destructor Documentation

def lsst.sconsUtils.installation.DirectoryInstaller.__init__ (   self,
  ignoreRegex,
  recursive 
)

Definition at line 228 of file installation.py.

229  def __init__(self, ignoreRegex, recursive):
230  self.ignoreRegex = re.compile(ignoreRegex)
231  self.recursive = recursive

Member Function Documentation

def lsst.sconsUtils.installation.DirectoryInstaller.__call__ (   self,
  target,
  source,
  env 
)

Definition at line 232 of file installation.py.

233  def __call__(self, target, source, env):
234  prefix = os.path.abspath(os.path.join(target[0].abspath, ".."))
235  destpath = os.path.join(target[0].abspath)
236  if not os.path.isdir(destpath):
237  state.log.info("Creating directory %s" % destpath)
238  os.makedirs(destpath)
239  for root, dirnames, filenames in os.walk(source[0].path):
240  if not self.recursive:
241  dirnames[:] = []
242  else:
243  dirnames[:] = [d for d in dirnames if d != ".svn"] # ignore .svn tree
244  for dirname in dirnames:
245  destpath = os.path.join(prefix, root, dirname)
246  if not os.path.isdir(destpath):
247  state.log.info("Creating directory %s" % destpath)
248  os.makedirs(destpath)
249  for filename in filenames:
250  if self.ignoreRegex.search(filename):
251  continue
252  destpath = os.path.join(prefix, root)
253  srcpath = os.path.join(root, filename)
254  state.log.info("Copying %s to %s" % (srcpath, destpath))
255  shutil.copy(srcpath, destpath)
256  return 0
257 

Member Data Documentation

lsst.sconsUtils.installation.DirectoryInstaller.ignoreRegex

Definition at line 229 of file installation.py.

lsst.sconsUtils.installation.DirectoryInstaller.recursive

Definition at line 230 of file installation.py.


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