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

Class Base

source code

object --+    
         |    
      Node --+
             |
            Base
Known Subclasses:

A generic class for file system entries. This class is for when we don't know yet whether the entry being looked up is a file or a directory. Instances of this class can morph into either Dir or File objects by a later, more precise lookup.

Note: this class does not define __cmp__ and __hash__ for efficiency reasons. SCons does a lot of comparing of Node.FS.{Base,Entry,File,Dir} objects, so those operations must be as fast as possible, which means we want to use Python's built-in object identity comparisons.

Nested Classes [hide private]

Inherited from Node: Attrs, BuildInfo, NodeInfo

Instance Methods [hide private]
 
__init__(self, name, directory, fs)
Initialize a generic Node.FS.Base object.
source code
 
str_for_display(self) source code
 
must_be_same(self, klass)
This node, which already existed, is being looked up as the specified klass. Raise an exception if it isn't.
source code
 
get_dir(self) source code
 
get_suffix(self) source code
 
rfile(self) source code
 
__getattr__(self, attr)
Together with the node_bwcomp dict defined below, this method provides a simple backward compatibility layer for the Node attributes 'abspath', 'labspath', 'path', 'tpath', 'suffix' and 'path_elements'. These Node attributes used to be directly available in v2.3 and earlier, but have been replaced by getter methods that initialize the single variables lazily when required, in order to save memory. The redirection to the getters lets older Tools and SConstruct continue to work without any additional changes, fully transparent to the user. Note, that __getattr__ is only called as fallback when the requested attribute can't be found, so there should be no speed performance penalty involved for standard builds.
source code
 
__str__(self)
A Node.FS.Base object's string representation is its path name.
source code
 
__lt__(self, other)
less than operator used by sorting on py3
source code
 
_save_str(self) source code
 
_get_str(self) source code
 
rstr(self)
A Node.FS.Base object's string representation is its path name.
source code
 
stat(self) source code
 
exists(self)
Does this node exists?
source code
 
rexists(self)
Does this node exist locally or in a repository?
source code
 
getmtime(self) source code
 
getsize(self) source code
 
isdir(self) source code
 
isfile(self) source code
 
islink(self) source code
 
is_under(self, dir) source code
 
set_local(self) source code
 
srcnode(self)
If this node is in a build path, return the node corresponding to its source file. Otherwise, return ourself.
source code
 
get_path(self, dir=None)
Return path relative to the current working directory of the Node.FS.Base object that owns us.
source code
 
set_src_builder(self, builder)
Set the source code builder for this node.
source code
 
src_builder(self)
Fetch the source code builder for this node.
source code
 
get_abspath(self)
Get the absolute path of the file.
source code
 
get_labspath(self)
Get the absolute path of the file.
source code
 
get_internal_path(self) source code
 
get_tpath(self) source code
 
get_path_elements(self) source code
 
for_signature(self)
Return a string representation of the Node that will always be the same for this particular Node, no matter what. This is by contrast to the __str__() method, which might, for instance, return a relative path for a file Node. The purpose of this method is to generate a value to be used in signature calculation for the command line used to build a target, and we use this method instead of str() to avoid unnecessary rebuilds. This method does not need to return something that would actually work in a command line; it can return any kind of nonsense, so long as it does not change.
source code
 
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. The principle use is that some Nodes would like to implement a __getattr__() method, but putting that in the Node type itself has a tendency to kill performance. We instead put it in a proxy and return it from this method. It is legal for this method to return self if no new functionality is needed for Environment substitution.
source code
 
target_from_source(self, prefix, suffix, splitext=<__builtin__.function object>)
Generates a target entry that corresponds to this entry (usually a source file) with the specified prefix and suffix.
source code
 
_Rfindalldirs_key(self, pathlist) source code
 
Rfindalldirs(self, pathlist)
Return all of the directories for a given path list, including corresponding "backing" directories in any repositories.
source code
 
RDirs(self, pathlist)
Search for a list of directories in the Repository list.
source code
 
rentry(self) source code
 
_glob1(self, pattern, ondisk=True, source=False, strings=False) source code

Inherited from Node: Decider, GetTag, Tag, add_dependency, add_ignore, add_prerequisite, add_source, add_to_implicit, add_to_waiting_parents, add_to_waiting_s_e, add_wkid, all_children, alter_targets, build, builder_set, built, changed, children, children_are_up_to_date, clear, clear_memoized_values, del_binfo, disambiguate, env_set, executor_cleanup, explain, get_binfo, get_build_env, get_build_scanner_path, get_builder, get_cachedir_csig, get_contents, get_csig, get_env, get_env_scanner, get_executor, get_found_includes, get_implicit_deps, get_ninfo, get_source_scanner, get_state, get_stored_implicit, get_stored_info, get_string, get_target_scanner, has_builder, has_explicit_builder, is_derived, is_literal, is_up_to_date, make_ready, missing, multiple_side_effect_has_builder, new_binfo, new_ninfo, postprocess, prepare, push_to_cache, release_target_info, remove, render_include_tree, reset_executor, retrieve_from_cache, scan, scanner_key, select_scanner, set_always_build, set_executor, set_explicit, set_nocache, set_noclean, set_precious, set_pseudo, set_specific_source, set_state, visited

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Instance Variables [hide private]
  fs
Reference to parent Node.FS object
Properties [hide private]
  _abspath
  _func_sconsign
  _labspath
  _local
  _path
  _path_elements
  _proxy
  _tpath
  cwd
  dir
  duplicate
  name
  sbuilder

Inherited from Node: always_build, attributes, binfo, builder, cached, changed_since_last_build, depends, depends_set, env, executor, ignore, ignore_set, implicit, implicit_set, includes, is_explicit, linked, ninfo, nocache, noclean, precious, prerequisites, pseudo, ref_count, side_effect, side_effects, sources, sources_set, state, store_info, waiting_parents, waiting_s_e, wkids

Inherited from object: __class__

Method Details [hide private]

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

source code 

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: object.__init__

get_suffix(self)

source code 
Overrides: Node.get_suffix

__str__(self)
(Informal representation operator)

source code 
A Node.FS.Base object's string representation is its path name.
Overrides: object.__str__

_save_str(self)

source code 
Decorators:
  • @SCons.Memoize.CountMethodCall

stat(self)

source code 
Decorators:
  • @SCons.Memoize.CountMethodCall

exists(self)

source code 
Does this node exists?
Overrides: Node.exists
(inherited documentation)

rexists(self)

source code 
Does this node exist locally or in a repository?
Overrides: Node.rexists
(inherited documentation)

src_builder(self)

source code 

Fetch the source code builder for this node.

If there isn't one, we cache the source code builder specified for the directory (which in turn will cache the value from its parent directory, and so on up to the file system root).

get_abspath(self)

source code 
Get the absolute path of the file.
Overrides: Node.get_abspath

for_signature(self)

source code 
Return a string representation of the Node that will always be the same for this particular Node, no matter what. This is by contrast to the __str__() method, which might, for instance, return a relative path for a file Node. The purpose of this method is to generate a value to be used in signature calculation for the command line used to build a target, and we use this method instead of str() to avoid unnecessary rebuilds. This method does not need to return something that would actually work in a command line; it can return any kind of nonsense, so long as it does not change.
Overrides: Node.for_signature
(inherited documentation)

get_subst_proxy(self)

source code 
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. The principle use is that some Nodes would like to implement a __getattr__() method, but putting that in the Node type itself has a tendency to kill performance. We instead put it in a proxy and return it from this method. It is legal for this method to return self if no new functionality is needed for Environment substitution.
Overrides: Node.get_subst_proxy
(inherited documentation)

target_from_source(self, prefix, suffix, splitext=<__builtin__.function object>)

source code 

Generates a target entry that corresponds to this entry (usually a source file) with the specified prefix and suffix.

Note that this method can be overridden dynamically for generated files that need different behavior. See Tool/swig.py for an example.

Rfindalldirs(self, pathlist)

source code 

Return all of the directories for a given path list, including corresponding "backing" directories in any repositories.

The Node lookups are relative to this Node (typically a directory), so memoizing result saves cycles from looking up the same path for each target in a given directory.

Decorators:
  • @SCons.Memoize.CountDictCall(_Rfindalldirs_key)

rentry(self)

source code 
Decorators:
  • @SCons.Memoize.CountMethodCall