Package SCons :: Package Node :: Module FS :: Class Dir
[show private | hide private]
[frames | no frames]

Class Dir

Node --+    
       |    
    Base --+
           |
          Dir

Known Subclasses:
RootDir

A class for directories in a file system.


Method Summary
  __init__(self, name, directory, fs)
Initialize a generic Node.FS.Base object.
  addRepository(self, dir)
  alter_targets(self)
Return any corresponding targets in a build directory.
  build(self, **kw)
A null "builder" for directories.
  changed_since_last_build(self, target, prev_ni)
  Dir(self, name, create)
Looks up or creates a directory node named 'name' relative to this directory.
  dir_on_disk(self, name)
  diskcheck_match(self)
  do_duplicate(self, src)
  Entry(self, name)
Looks up or creates an entry node named 'name' relative to this directory.
  entry_abspath(self, name)
  entry_exists_on_disk(self, name)
  entry_labspath(self, name)
  entry_path(self, name)
  entry_tpath(self, name)
  File(self, name)
Looks up or creates a file node named 'name' relative to this directory.
  file_on_disk(self, name)
  get_all_rdirs(self)
  get_contents(self)
Return aggregate contents of all our children.
  get_env_scanner(self, env, kw)
  get_found_includes(self, env, scanner, path)
Return this directory's implicit dependencies.
  get_target_scanner(self)
  get_timestamp(self)
Return the latest timestamp from among our children
  getRepositories(self)
Returns a list of repositories for this directory.
  glob(self, pathname, ondisk, source, strings)
Returns a list of Nodes (or strings) matching a specified pathname pattern.
  is_up_to_date(self)
If any child is not up-to-date, then this directory isn't, either.
  link(self, srcdir, duplicate)
Set this directory as the build directory for the supplied source directory.
  multiple_side_effect_has_builder(self)
Return whether this Node has a builder or not.
  prepare(self)
Prepare for this Node to be built.
  rdir(self)
  rel_path(self, other)
Return a path to "other" relative to this directory.
  scanner_key(self)
A directory does not get scanned.
  sconsign(self)
Return the .sconsign file info for this directory, creating it first if necessary.
  srcdir_duplicate(self, name)
  srcdir_find_file(self, filename)
  srcdir_list(self)
  srcnode(self)
Dir has a special need for srcnode()...if we have a srcdir attribute set, then that is our srcnode.
  up(self)
  walk(self, func, arg)
Walk this directory tree by calling the specified function for each directory in the tree.
    Inherited from Base
  __str__(self)
A Node.FS.Base object's string representation is its path name.
  exists(self)
Does this node exists?
  for_signature(self)
Return a string representation of the Node that will always be the same for this particular Node, no matter what.
  get_abspath(self)
Get the absolute path of the file.
  get_dir(self)
  get_path(self, dir)
Return path relative to the current working directory of the Node.FS.Base object that owns us.
  get_subst_proxy(self)
This method is expected to return an object that will function exactly like this Node, except that it implements any additional special features that we would like to be in effect for Environment variable substitution.
  get_suffix(self)
  getmtime(self)
  getsize(self)
  is_under(self, dir)
  isdir(self)
  isfile(self)
  islink(self)
  must_be_same(self, klass)
This node, which already existed, is being looked up as the specified klass.
  RDirs(self, pathlist)
Search for a list of directories in the Repository list.
  rentry(self)
  rexists(self)
Does this node exist locally or in a repositiory?
  rfile(self)
  Rfindalldirs(self, pathlist)
Return all of the directories for a given path list, including corresponding "backing" directories in any repositories.
  rstr(self)
A Node.FS.Base object's string representation is its path name.
  set_local(self)
  set_src_builder(self, builder)
Set the source code builder for this node.
  src_builder(self)
Fetch the source code builder for this node.
  stat(self)
  target_from_source(self, prefix, suffix, splitext)
Generates a target entry that corresponds to this entry (usually a source file) with the specified prefix and suffix.
    Inherited from Node
  add_dependency(self, depend)
Adds dependencies.
  add_ignore(self, depend)
Adds dependencies to ignore.
  add_prerequisite(self, prerequisite)
Adds prerequisites
  add_source(self, source)
Adds sources.
  add_to_implicit(self, deps)
  add_to_waiting_parents(self, node)
Returns the number of nodes added to our waiting parents list: 1 if we add a unique waiting parent, 0 if not.
  add_to_waiting_s_e(self, node)
  add_wkid(self, wkid)
Add a node to the list of kids waiting to be evaluated
  all_children(self, scan)
Return a list of all the node's direct children.
  builder_set(self, builder)
  built(self)
Called just after this node is successfully built.
  call_for_all_waiting_parents(self, func)
  changed(self, node)
Returns if the node is up-to-date with respect to the BuildInfo stored last time it was built.
  children(self, scan)
Return a list of the node's direct children, minus those that are ignored by this node.
  children_are_up_to_date(self)
Alternate check for whether the Node is current: If all of our children were up-to-date, then this Node was up-to-date, too.
  clear(self)
Completely clear a Node of all its cached state (so that it can be re-evaluated by interfaces that do continuous integration builds).
  clear_memoized_values(self)
  Decider(self, function)
  del_binfo(self)
Delete the build info from this node.
  disambiguate(self, must_exist)
  do_not_ignore(self, node)
  do_not_store_info(self)
  env_set(self, env, safe)
  executor_cleanup(self)
Let the executor clean up any cached information.
  explain(self)
  get_binfo(self)
Fetch a node's build information.
  get_build_env(self)
Fetch the appropriate Environment to build this node.
  get_build_scanner_path(self, scanner)
Fetch the appropriate scanner path for this node.
  get_builder(self, default_builder)
Return the set builder, or a specified default value
  get_cachedir_csig(self)
  get_csig(self)
  get_env(self)
  get_executor(self, create)
Fetch the action executor for this node.
  get_implicit_deps(self, env, scanner, path)
Return a list of implicit dependencies for this node.
  get_ninfo(self)
  get_source_scanner(self, node)
Fetch the source scanner for the specified node
  get_state(self)
  get_stored_implicit(self)
Fetch the stored implicit dependencies
  get_stored_info(self)
  get_string(self, for_signature)
This is a convenience function designed primarily to be used in command generators (i.e., CommandGeneratorActions or Environment variables that are callable), which are called with a for_signature argument that is nonzero if the command generator is being called to generate a signature for the command line, which determines if we should rebuild or not.
  has_builder(self)
Return whether this Node has a builder or not.
  has_explicit_builder(self)
Return whether this Node has an explicit builder
  is_derived(self)
Returns true iff this node is derived (i.e.
  is_literal(self)
Always pass the string representation of a Node to the command interpreter literally.
  make_ready(self)
Get a Node ready for evaluation.
  missing(self)
  new_binfo(self)
  new_ninfo(self)
  postprocess(self)
Clean up anything we don't need to hang onto after we've been built.
  remove(self)
Remove this Node: no-op by default.
  render_include_tree(self)
Return a text representation, suitable for displaying to the user, of the include tree for the sources of this node.
  reset_executor(self)
Remove cached executor; forces recompute when needed.
  retrieve_from_cache(self)
Try to retrieve the node's content from a cache
  scan(self)
Scan this node's dependents for implicit dependencies.
  select_scanner(self, scanner)
Selects a scanner for this Node.
  set_always_build(self, always_build)
Set the Node's always_build value.
  set_executor(self, executor)
Set the action executor for this node.
  set_explicit(self, is_explicit)
  set_nocache(self, nocache)
Set the Node's nocache value.
  set_noclean(self, noclean)
Set the Node's noclean value.
  set_precious(self, precious)
Set the Node's precious value.
  set_state(self, state)
  state_has_changed(self, target, prev_ni)
  store_info(self)
Make the build signature permanent (that is, store it in the .sconsign file or equivalent).
  visited(self)
Called just after this node has been visited (with or without a build).

Class Variable Summary
classobj BuildInfo = SCons.Node.FS.DirBuildInfo
list memoizer_counters = [<SCons.Memoize.CountValue instance ...
classobj NodeInfo = SCons.Node.FS.DirNodeInfo

Method Details

__init__(self, name, directory, fs)
(Constructor)

Initialize a generic Node.FS.Base object.

Call the superclass initialization, take care of setting up our relative and absolute paths, identify our parent directory, and indicate that this node should use signatures.

Overrides:
SCons.Node.FS.Base.__init__ (inherited documentation)

alter_targets(self)

Return any corresponding targets in a build directory.

Overrides:
SCons.Node.Node.alter_targets

build(self, **kw)

A null "builder" for directories.

Overrides:
SCons.Node.Node.build

Dir(self, name, create=True)

Looks up or creates a directory node named 'name' relative to this directory.

Entry(self, name)

Looks up or creates an entry node named 'name' relative to this directory.

File(self, name)

Looks up or creates a file node named 'name' relative to this directory.

get_contents(self)

Return aggregate contents of all our children.

get_found_includes(self, env, scanner, path)

Return this directory's implicit dependencies.

We don't bother caching the results because the scan typically shouldn't be requested more than once (as opposed to scanning .h file contents, which can be requested as many times as the files is #included by other files).

Overrides:
SCons.Node.Node.get_found_includes

get_timestamp(self)

Return the latest timestamp from among our children

getRepositories(self)

Returns a list of repositories for this directory.

glob(self, pathname, ondisk=True, source=False, strings=False)

Returns a list of Nodes (or strings) matching a specified pathname pattern.

Pathname patterns follow UNIX shell semantics: * matches any-length strings of any characters, ? matches any character, and [] can enclose lists or ranges of characters. Matches do not span directory separators.

The matches take into account Repositories, returning local Nodes if a corresponding entry exists in a Repository (either an in-memory Node or something on disk).

By defafult, the glob() function matches entries that exist on-disk, in addition to in-memory Nodes. Setting the "ondisk" argument to False (or some other non-true value) causes the glob() function to only match in-memory Nodes. The default behavior is to return both the on-disk and in-memory Nodes.

The "source" argument, when true, specifies that corresponding source Nodes must be returned if you're globbing in a build directory (initialized with BuildDir()). The default behavior is to return Nodes local to the BuildDir().

The "strings" argument, when true, returns the matches as strings, not Nodes. The strings are path names relative to this directory.

The underlying algorithm is adapted from the glob.glob() function in the Python library (but heavily modified), and uses fnmatch() under the covers.

is_up_to_date(self)

If any child is not up-to-date, then this directory isn't, either.

Overrides:
SCons.Node.Node.is_up_to_date

link(self, srcdir, duplicate)

Set this directory as the build directory for the supplied source directory.

multiple_side_effect_has_builder(self)

Return whether this Node has a builder or not.

In Boolean tests, this turns out to be a lot more efficient than simply examining the builder attribute directly ("if node.builder: ..."). When the builder attribute is examined directly, it ends up calling __getattr__ for both the __len__ and __nonzero__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

Overrides:
SCons.Node.Node.has_builder (inherited documentation)

prepare(self)

Prepare for this Node to be built.

This is called after the Taskmaster has decided that the Node is out-of-date and must be rebuilt, but before actually calling the method to build the Node.

This default implemenation checks that all children either exist or are derived, and initializes the BuildInfo structure that will hold the information about how this node is, uh, built.

Overriding this method allows for for a Node subclass to remove the underlying file from the file system. Note that subclass methods should call this base class method to get the child check and the BuildInfo structure.

Overrides:
SCons.Node.Node.prepare (inherited documentation)

rel_path(self, other)

Return a path to "other" relative to this directory.

scanner_key(self)

A directory does not get scanned.

Overrides:
SCons.Node.Node.scanner_key

sconsign(self)

Return the .sconsign file info for this directory, creating it first if necessary.

srcnode(self)

Dir has a special need for srcnode()...if we have a srcdir attribute set, then that is our srcnode.

Overrides:
SCons.Node.FS.Base.srcnode

walk(self, func, arg)

Walk this directory tree by calling the specified function for each directory in the tree.

This behaves like the os.path.walk() function, but for in-memory Node.FS.Dir objects. The function takes the same arguments as the functions passed to os.path.walk():

func(arg, dirname, fnames)

Except that "dirname" will actually be the directory Node, not the string. The '.' and '..' entries are excluded from fnames. The fnames list may be modified in-place to filter the subdirectories visited or otherwise impose a specific order. The "arg" argument is always passed to func() and may be used in any way (or ignored, passing None is common).


Class Variable Details

memoizer_counters

Type:
list
Value:
[<SCons.Memoize.CountValue instance at 0xa3b200>,
 <SCons.Memoize.CountDict instance at 0xa3bf80>,
 <SCons.Memoize.CountValue instance at 0xa3b050>,
 <SCons.Memoize.CountDict instance at 0xa3b908>]                       

Generated by Epydoc 2.1 on Wed Dec 12 09:39:31 2007 http://epydoc.sf.net