SCons.Node package

Submodules

SCons.Node.Alias module

Alias nodes.

This creates a hash of global Aliases (dummy targets).

class SCons.Node.Alias.Alias(name)[source]

Bases: Node

class Attrs

Bases: object

shared
BuildInfo

alias of AliasBuildInfo

Decider(function)
GetTag(key)

Return a user-defined tag.

NodeInfo

alias of AliasNodeInfo

Tag(key, value)

Add a user-defined tag.

_add_child(collection, set, child)

Adds ‘child’ to ‘collection’, first checking ‘set’ to see if it’s already present.

_children_get()
_children_reset()
_func_exists
_func_get_contents
_func_is_derived
_func_rexists
_func_target_from_source
_get_scanner(env, initial_scanner, root_node_scanner, kw)
_memo
_specific_sources
_tags
add_dependency(depend)

Adds dependencies.

add_ignore(depend)

Adds dependencies to ignore.

add_prerequisite(prerequisite)

Adds prerequisites

add_source(source)

Adds sources.

add_to_implicit(deps)
add_to_waiting_parents(node)

Returns the number of nodes added to our waiting parents list: 1 if we add a unique waiting parent, 0 if not. (Note that the returned values are intended to be used to increment a reference count, so don’t think you can “clean up” this function by using True and False instead…)

add_to_waiting_s_e(node)
add_wkid(wkid)

Add a node to the list of kids waiting to be evaluated

all_children(scan=1)

Return a list of all the node’s direct children.

alter_targets()

Return a list of alternate targets for this Node.

always_build
attributes
binfo
build()[source]

A “builder” for aliases.

builder
builder_set(builder)
built()

Called just after this node is successfully built.

cached
changed(node=None, allowcache=False)

Returns if the node is up-to-date with respect to the BuildInfo stored last time it was built. The default behavior is to compare it against our own previously stored BuildInfo, but the stored BuildInfo from another Node (typically one in a Repository) can be used instead.

Note that we now always check every dependency. We used to short-circuit the check by returning as soon as we detected any difference, but we now rely on checking every dependency to make sure that any necessary Node information (for example, the content signature of an #included .h file) is updated.

The allowcache option was added for supporting the early release of the executor/builder structures, right after a File target was built. When set to true, the return value of this changed method gets cached for File nodes. Like this, the executor isn’t needed any longer for subsequent calls to changed().

@see: FS.File.changed(), FS.File.release_target_info()

changed_since_last_build
check_attributes(name)

Simple API to check if the node.attributes for name has been set

children(scan=1)

Return a list of the node’s direct children, minus those that are ignored by this node.

children_are_up_to_date()

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.

The SCons.Node.Alias and SCons.Node.Python.Value subclasses rebind their current() method to this method.

clear()

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()
convert()[source]
del_binfo()

Delete the build info from this node.

depends
depends_set
disambiguate(must_exist=None)
env
env_set(env, safe=0)
executor
executor_cleanup()

Let the executor clean up any cached information.

exists()

Does this node exists?

explain()
for_signature()

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.

get_abspath()

Return an absolute path to the Node. This will return simply str(Node) by default, but for Node types that have a concept of relative path, this might return something different.

get_binfo()

Fetch a node’s build information.

node - the node whose sources will be collected cache - alternate node to use for the signature cache returns - the build signature

This no longer handles the recursive descent of the node’s children’s signatures. We expect that they’re already built and updated by someone else, if that’s what’s wanted.

get_build_env()

Fetch the appropriate Environment to build this node.

get_build_scanner_path(scanner)

Fetch the appropriate scanner path for this node.

get_builder(default_builder=None)

Return the set builder, or a specified default value

get_cachedir_csig()
get_contents()[source]

The contents of an alias is the concatenation of the content signatures of all its sources.

get_csig()[source]

Generate a node’s content signature, the digested signature of its content.

node - the node cache - alternate node to use for the signature cache returns - the content signature

get_env()
get_env_scanner(env, kw={})
get_executor(create=1)

Fetch the action executor for this node. Create one if there isn’t already one, and requested to do so.

get_found_includes(env, scanner, path)

Return the scanned include lines (implicit dependencies) found in this node.

The default is no implicit dependencies. We expect this method to be overridden by any subclass that can be scanned for implicit dependencies.

get_implicit_deps(env, initial_scanner, path_func, kw={})

Return a list of implicit dependencies for this node.

This method exists to handle recursive invocation of the scanner on the implicit dependencies returned by the scanner, if the scanner’s recursive flag says that we should.

get_ninfo()
get_source_scanner(node)

Fetch the source scanner for the specified node

NOTE: “self” is the target being built, “node” is the source file for which we want to fetch the scanner.

Implies self.has_builder() is true; again, expect to only be called from locations where this is already verified.

This function may be called very often; it attempts to cache the scanner found to improve performance.

get_state()
get_stored_implicit()

Fetch the stored implicit dependencies

get_stored_info()
get_string(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.

Such command generators should use this method in preference to str(Node) when converting a Node to a string, passing in the for_signature parameter, such that we will call Node.for_signature() or str(Node) properly, depending on whether we are calculating a signature or actually constructing a command line.

get_subst_proxy()

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.

get_suffix()
get_target_scanner()
has_builder()

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 __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

has_explicit_builder()

Return whether this Node has an explicit builder

This allows an internal Builder created by SCons to be marked non-explicit, so that it can be overridden by an explicit builder that the user supplies (the canonical example being directories).

ignore
ignore_set
implicit
implicit_set
includes
is_conftest()

Returns true if this node is an conftest node

is_derived()

Returns true if this node is derived (i.e. built).

This should return true only for nodes whose path should be in the variant directory when duplicate=0 and should contribute their build signatures when they are used as source files to other derived files. For example: source with source builders are not derived in this sense, and hence should not return true.

is_explicit
is_literal()

Always pass the string representation of a Node to the command interpreter literally.

is_sconscript()

Returns true if this node is an sconscript

is_under(dir)[source]
is_up_to_date()

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.

The SCons.Node.Alias and SCons.Node.Python.Value subclasses rebind their current() method to this method.

linked
make_ready()[source]

Get a Node ready for evaluation.

This is called before the Taskmaster decides if the Node is up-to-date or not. Overriding this method allows for a Node subclass to be disambiguated if necessary, or for an implicit source builder to be attached.

missing()
multiple_side_effect_has_builder()

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 __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

new_binfo()
new_ninfo()
ninfo
nocache
noclean
postprocess()

Clean up anything we don’t need to hang onto after we’ve been built.

precious
prepare()

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 implementation checks that explicit or implicit dependencies either exist or are derived, and initializes the BuildInfo structure that will hold the information about how this node is, uh, built.

(The existence of source files is checked separately by the Executor, which aggregates checks for all of the targets built by a specific action.)

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.

prerequisites
pseudo
push_to_cache()

Try to push a node into a cache

really_build(**kw)

Actually build the node.

This is called by the Taskmaster after it’s decided that the Node is out-of-date and must be rebuilt, and after the prepare() method has gotten everything, uh, prepared.

This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in built().

ref_count
release_target_info()

Called just after this node has been marked up-to-date or was built completely.

This is where we try to release as many target node infos as possible for clean builds and update runs, in order to minimize the overall memory consumption.

By purging attributes that aren’t needed any longer after a Node (=File) got built, we don’t have to care that much how many KBytes a Node actually requires…as long as we free the memory shortly afterwards.

@see: built() and File.release_target_info()

remove()

Remove this Node: no-op by default.

render_include_tree()

Return a text representation, suitable for displaying to the user, of the include tree for the sources of this node.

reset_executor()

Remove cached executor; forces recompute when needed.

retrieve_from_cache()

Try to retrieve the node’s content from a cache

This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in built().

Returns true if the node was successfully retrieved.

rexists()

Does this node exist locally or in a repository?

scan()

Scan this node’s dependents for implicit dependencies.

scanner_key()
sconsign()[source]

An Alias is not recorded in .sconsign files

select_scanner(scanner)

Selects a scanner for this Node.

This is a separate method so it can be overridden by Node subclasses (specifically, Node.FS.Dir) that must use their own Scanner and don’t select one the Scanner.Selector that’s configured for the target.

set_always_build(always_build=1)

Set the Node’s always_build value.

set_executor(executor)

Set the action executor for this node.

set_explicit(is_explicit)
set_nocache(nocache=1)

Set the Node’s nocache value.

set_noclean(noclean=1)

Set the Node’s noclean value.

set_precious(precious=1)

Set the Node’s precious value.

set_pseudo(pseudo=True)

Set the Node’s precious value.

set_specific_source(source)
set_state(state)
side_effect
side_effects
sources
sources_set
state
store_info
str_for_display()[source]
target_peers
visited()

Called just after this node has been visited (with or without a build).

waiting_parents
waiting_s_e
wkids
class SCons.Node.Alias.AliasBuildInfo[source]

Bases: BuildInfoBase

bact
bactsig
bdepends
bdependsigs
bimplicit
bimplicitsigs
bsources
bsourcesigs
current_version_id = 2
merge(other)

Merge the fields of another object into this object. Already existing information is overwritten by the other instance’s data. WARNING: If a ‘__dict__’ slot is added, it should be updated instead of replaced.

class SCons.Node.Alias.AliasNameSpace(**kwargs)[source]

Bases: UserDict

Alias(name, **kw)[source]
_abc_impl = <_abc_data object>
clear() None.  Remove all items from D.
copy()
classmethod fromkeys(iterable, value=None)
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
lookup(name, **kw)[source]
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
class SCons.Node.Alias.AliasNodeInfo[source]

Bases: NodeInfoBase

convert(node, val)
csig
current_version_id = 2
field_list = ['csig']
format(field_list=None, names=0)
merge(other)

Merge the fields of another object into this object. Already existing information is overwritten by the other instance’s data. WARNING: If a ‘__dict__’ slot is added, it should be updated instead of replaced.

str_to_node(s)[source]
update(node)

SCons.Node.FS module

File system nodes.

These Nodes represent the canonical external objects that people think of when they think of building software: files and directories.

This holds a “default_fs” variable that should be initialized with an FS that can be used by scripts or modules looking for the canonical default.

class SCons.Node.FS.Base(name, directory, fs)[source]

Bases: Node

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.

class Attrs

Bases: object

shared
BuildInfo

alias of BuildInfoBase

Decider(function)
GetTag(key)

Return a user-defined tag.

NodeInfo

alias of NodeInfoBase

RDirs(pathlist)[source]

Search for a list of directories in the Repository list.

Rfindalldirs(pathlist)[source]

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.

Tag(key, value)

Add a user-defined tag.

_Rfindalldirs_key(pathlist)[source]
_abspath
_add_child(collection, set, child)

Adds ‘child’ to ‘collection’, first checking ‘set’ to see if it’s already present.

_children_get()
_children_reset()
_func_exists
_func_get_contents
_func_is_derived
_func_rexists
_func_sconsign
_func_target_from_source
_get_scanner(env, initial_scanner, root_node_scanner, kw)
_get_str()[source]
_glob1(pattern, ondisk=True, source=False, strings=False)[source]
_labspath
_local
_memo
_path
_path_elements
_proxy
_save_str()[source]
_specific_sources
_tags
_tpath
add_dependency(depend)

Adds dependencies.

add_ignore(depend)

Adds dependencies to ignore.

add_prerequisite(prerequisite)

Adds prerequisites

add_source(source)

Adds sources.

add_to_implicit(deps)
add_to_waiting_parents(node)

Returns the number of nodes added to our waiting parents list: 1 if we add a unique waiting parent, 0 if not. (Note that the returned values are intended to be used to increment a reference count, so don’t think you can “clean up” this function by using True and False instead…)

add_to_waiting_s_e(node)
add_wkid(wkid)

Add a node to the list of kids waiting to be evaluated

all_children(scan=1)

Return a list of all the node’s direct children.

alter_targets()

Return a list of alternate targets for this Node.

always_build
attributes
binfo
build(**kw)

Actually build the node.

This is called by the Taskmaster after it’s decided that the Node is out-of-date and must be rebuilt, and after the prepare() method has gotten everything, uh, prepared.

This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in built().

builder
builder_set(builder)
built()

Called just after this node is successfully built.

cached
changed(node=None, allowcache=False)

Returns if the node is up-to-date with respect to the BuildInfo stored last time it was built. The default behavior is to compare it against our own previously stored BuildInfo, but the stored BuildInfo from another Node (typically one in a Repository) can be used instead.

Note that we now always check every dependency. We used to short-circuit the check by returning as soon as we detected any difference, but we now rely on checking every dependency to make sure that any necessary Node information (for example, the content signature of an #included .h file) is updated.

The allowcache option was added for supporting the early release of the executor/builder structures, right after a File target was built. When set to true, the return value of this changed method gets cached for File nodes. Like this, the executor isn’t needed any longer for subsequent calls to changed().

@see: FS.File.changed(), FS.File.release_target_info()

changed_since_last_build
check_attributes(name)

Simple API to check if the node.attributes for name has been set

children(scan=1)

Return a list of the node’s direct children, minus those that are ignored by this node.

children_are_up_to_date()

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.

The SCons.Node.Alias and SCons.Node.Python.Value subclasses rebind their current() method to this method.

clear()

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()
cwd
del_binfo()

Delete the build info from this node.

depends
depends_set
dir
disambiguate(must_exist=None)
duplicate
env
env_set(env, safe=0)
executor
executor_cleanup()

Let the executor clean up any cached information.

exists()[source]

Does this node exists?

explain()
for_signature()[source]

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.

fs

Reference to parent Node.FS object

get_abspath()[source]

Get the absolute path of the file.

get_binfo()

Fetch a node’s build information.

node - the node whose sources will be collected cache - alternate node to use for the signature cache returns - the build signature

This no longer handles the recursive descent of the node’s children’s signatures. We expect that they’re already built and updated by someone else, if that’s what’s wanted.

get_build_env()

Fetch the appropriate Environment to build this node.

get_build_scanner_path(scanner)

Fetch the appropriate scanner path for this node.

get_builder(default_builder=None)

Return the set builder, or a specified default value

get_cachedir_csig()
get_contents()

Fetch the contents of the entry.

get_csig()
get_dir()[source]
get_env()
get_env_scanner(env, kw={})
get_executor(create=1)

Fetch the action executor for this node. Create one if there isn’t already one, and requested to do so.

get_found_includes(env, scanner, path)

Return the scanned include lines (implicit dependencies) found in this node.

The default is no implicit dependencies. We expect this method to be overridden by any subclass that can be scanned for implicit dependencies.

get_implicit_deps(env, initial_scanner, path_func, kw={})

Return a list of implicit dependencies for this node.

This method exists to handle recursive invocation of the scanner on the implicit dependencies returned by the scanner, if the scanner’s recursive flag says that we should.

get_internal_path()[source]
get_labspath()[source]

Get the absolute path of the file.

get_ninfo()
get_path(dir=None)[source]

Return path relative to the current working directory of the Node.FS.Base object that owns us.

get_path_elements()[source]
get_relpath()[source]

Get the path of the file relative to the root SConstruct file’s directory.

get_source_scanner(node)

Fetch the source scanner for the specified node

NOTE: “self” is the target being built, “node” is the source file for which we want to fetch the scanner.

Implies self.has_builder() is true; again, expect to only be called from locations where this is already verified.

This function may be called very often; it attempts to cache the scanner found to improve performance.

get_state()
get_stored_implicit()

Fetch the stored implicit dependencies

get_stored_info()
get_string(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.

Such command generators should use this method in preference to str(Node) when converting a Node to a string, passing in the for_signature parameter, such that we will call Node.for_signature() or str(Node) properly, depending on whether we are calculating a signature or actually constructing a command line.

get_subst_proxy()[source]

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.

get_suffix()[source]
get_target_scanner()
get_tpath()[source]
getmtime()[source]
getsize()[source]
has_builder()

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 __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

has_explicit_builder()

Return whether this Node has an explicit builder

This allows an internal Builder created by SCons to be marked non-explicit, so that it can be overridden by an explicit builder that the user supplies (the canonical example being directories).

ignore
ignore_set
implicit
implicit_set
includes
is_conftest()

Returns true if this node is an conftest node

is_derived()

Returns true if this node is derived (i.e. built).

This should return true only for nodes whose path should be in the variant directory when duplicate=0 and should contribute their build signatures when they are used as source files to other derived files. For example: source with source builders are not derived in this sense, and hence should not return true.

is_explicit
is_literal()

Always pass the string representation of a Node to the command interpreter literally.

is_sconscript()

Returns true if this node is an sconscript

is_under(dir)[source]
is_up_to_date()

Default check for whether the Node is current: unknown Node subtypes are always out of date, so they will always get built.

isdir()[source]
isfile()[source]
linked
lstat()[source]
make_ready()

Get a Node ready for evaluation.

This is called before the Taskmaster decides if the Node is up-to-date or not. Overriding this method allows for a Node subclass to be disambiguated if necessary, or for an implicit source builder to be attached.

missing()
multiple_side_effect_has_builder()

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 __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

must_be_same(klass)[source]

This node, which already existed, is being looked up as the specified klass. Raise an exception if it isn’t.

name
new_binfo()
new_ninfo()
ninfo
nocache
noclean
postprocess()

Clean up anything we don’t need to hang onto after we’ve been built.

precious
prepare()

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 implementation checks that explicit or implicit dependencies either exist or are derived, and initializes the BuildInfo structure that will hold the information about how this node is, uh, built.

(The existence of source files is checked separately by the Executor, which aggregates checks for all of the targets built by a specific action.)

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.

prerequisites
pseudo
push_to_cache()

Try to push a node into a cache

ref_count
release_target_info()

Called just after this node has been marked up-to-date or was built completely.

This is where we try to release as many target node infos as possible for clean builds and update runs, in order to minimize the overall memory consumption.

By purging attributes that aren’t needed any longer after a Node (=File) got built, we don’t have to care that much how many KBytes a Node actually requires…as long as we free the memory shortly afterwards.

@see: built() and File.release_target_info()

remove()

Remove this Node: no-op by default.

render_include_tree()

Return a text representation, suitable for displaying to the user, of the include tree for the sources of this node.

rentry()[source]
reset_executor()

Remove cached executor; forces recompute when needed.

retrieve_from_cache()

Try to retrieve the node’s content from a cache

This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in built().

Returns true if the node was successfully retrieved.

rexists()[source]

Does this node exist locally or in a repository?

rfile()[source]
rstr()

A Node.FS.Base object’s string representation is its path name.

sbuilder
scan()

Scan this node’s dependents for implicit dependencies.

scanner_key()
select_scanner(scanner)

Selects a scanner for this Node.

This is a separate method so it can be overridden by Node subclasses (specifically, Node.FS.Dir) that must use their own Scanner and don’t select one the Scanner.Selector that’s configured for the target.

set_always_build(always_build=1)

Set the Node’s always_build value.

set_executor(executor)

Set the action executor for this node.

set_explicit(is_explicit)
set_local()[source]
set_nocache(nocache=1)

Set the Node’s nocache value.

set_noclean(noclean=1)

Set the Node’s noclean value.

set_precious(precious=1)

Set the Node’s precious value.

set_pseudo(pseudo=True)

Set the Node’s precious value.

set_specific_source(source)
set_src_builder(builder)[source]

Set the source code builder for this node.

set_state(state)
side_effect
side_effects
sources
sources_set
src_builder()[source]

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).

srcnode()[source]

If this node is in a build path, return the node corresponding to its source file. Otherwise, return ourself.

stat()[source]
state
store_info
str_for_display()[source]
target_from_source(prefix, suffix, splitext=<function splitext>)[source]

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.

target_peers
visited()

Called just after this node has been visited (with or without a build).

waiting_parents
waiting_s_e
wkids
class SCons.Node.FS.Dir(name, directory, fs)[source]

Bases: Base

A class for directories in a file system.

class Attrs

Bases: object

shared
BuildInfo

alias of DirBuildInfo

Decider(function)
Dir(name, create=True)[source]

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

Entry(name)[source]

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

File(name)[source]

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

GetTag(key)

Return a user-defined tag.

NodeInfo

alias of DirNodeInfo

RDirs(pathlist)

Search for a list of directories in the Repository list.

Rfindalldirs(pathlist)

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.

Tag(key, value)

Add a user-defined tag.

_Rfindalldirs_key(pathlist)
__clearRepositoryCache(duplicate=None)

Called when we change the repository(ies) for a directory. This clears any cached information that is invalidated by changing the repository.

__resetDuplicate(node)
_abspath
_add_child(collection, set, child)

Adds ‘child’ to ‘collection’, first checking ‘set’ to see if it’s already present.

_children_get()
_children_reset()
_create()[source]

Create this directory, silently and without worrying about whether the builder is the default or not.

_func_exists
_func_get_contents
_func_is_derived
_func_rexists
_func_sconsign
_func_target_from_source
_get_scanner(env, initial_scanner, root_node_scanner, kw)
_get_str()
_glob1(pattern, ondisk=True, source=False, strings=False)[source]

Globs for and returns a list of entry names matching a single pattern in this directory.

This searches any repositories and source directories for corresponding entries and returns a Node (or string) relative to the current directory if an entry is found anywhere.

TODO: handle pattern with no wildcard

_labspath
_local
_memo
_morph()[source]

Turn a file system Node (either a freshly initialized directory object or a separate Entry object) into a proper directory object.

Set up this directory’s entries and hook it into the file system tree. Specify that directories (this Node) don’t use signatures for calculating whether they’re current.

_path
_path_elements
_proxy
_rel_path_key(other)[source]
_save_str()
_sconsign
_specific_sources
_srcdir_find_file_key(filename)[source]
_tags
_tpath
addRepository(dir)[source]
add_dependency(depend)

Adds dependencies.

add_ignore(depend)

Adds dependencies to ignore.

add_prerequisite(prerequisite)

Adds prerequisites

add_source(source)

Adds sources.

add_to_implicit(deps)
add_to_waiting_parents(node)

Returns the number of nodes added to our waiting parents list: 1 if we add a unique waiting parent, 0 if not. (Note that the returned values are intended to be used to increment a reference count, so don’t think you can “clean up” this function by using True and False instead…)

add_to_waiting_s_e(node)
add_wkid(wkid)

Add a node to the list of kids waiting to be evaluated

all_children(scan=1)

Return a list of all the node’s direct children.

alter_targets()[source]

Return any corresponding targets in a variant directory.

always_build
attributes
binfo
build(**kw)[source]

A null “builder” for directories.

builder
builder_set(builder)
built()

Called just after this node is successfully built.

cached
cachedir_csig
cachesig
changed(node=None, allowcache=False)

Returns if the node is up-to-date with respect to the BuildInfo stored last time it was built. The default behavior is to compare it against our own previously stored BuildInfo, but the stored BuildInfo from another Node (typically one in a Repository) can be used instead.

Note that we now always check every dependency. We used to short-circuit the check by returning as soon as we detected any difference, but we now rely on checking every dependency to make sure that any necessary Node information (for example, the content signature of an #included .h file) is updated.

The allowcache option was added for supporting the early release of the executor/builder structures, right after a File target was built. When set to true, the return value of this changed method gets cached for File nodes. Like this, the executor isn’t needed any longer for subsequent calls to changed().

@see: FS.File.changed(), FS.File.release_target_info()

changed_since_last_build
check_attributes(name)

Simple API to check if the node.attributes for name has been set

children(scan=1)

Return a list of the node’s direct children, minus those that are ignored by this node.

children_are_up_to_date()

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.

The SCons.Node.Alias and SCons.Node.Python.Value subclasses rebind their current() method to this method.

clear()

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()
contentsig
cwd
del_binfo()

Delete the build info from this node.

depends
depends_set
dir
dir_on_disk(name)[source]
dirname
disambiguate(must_exist=None)
diskcheck_match()[source]
do_duplicate(src)[source]
duplicate
entries
entry_abspath(name)[source]
entry_exists_on_disk(name)[source]

Searches through the file/dir entries of the current directory, and returns True if a physical entry with the given name could be found.

@see rentry_exists_on_disk

entry_labspath(name)[source]
entry_path(name)[source]
entry_tpath(name)[source]
env
env_set(env, safe=0)
executor
executor_cleanup()

Let the executor clean up any cached information.

exists()

Does this node exists?

explain()
file_on_disk(name)[source]
for_signature()

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.

fs

Reference to parent Node.FS object

getRepositories()[source]

Returns a list of repositories for this directory.

get_abspath() str[source]

Get the absolute path of the file.

get_all_rdirs()[source]
get_binfo()

Fetch a node’s build information.

node - the node whose sources will be collected cache - alternate node to use for the signature cache returns - the build signature

This no longer handles the recursive descent of the node’s children’s signatures. We expect that they’re already built and updated by someone else, if that’s what’s wanted.

get_build_env()

Fetch the appropriate Environment to build this node.

get_build_scanner_path(scanner)

Fetch the appropriate scanner path for this node.

get_builder(default_builder=None)

Return the set builder, or a specified default value

get_cachedir_csig()
get_contents()[source]

Return content signatures and names of all our children separated by new-lines. Ensure that the nodes are sorted.

get_csig()[source]

Compute the content signature for Directory nodes. In general, this is not needed and the content signature is not stored in the DirNodeInfo. However, if get_contents on a Dir node is called which has a child directory, the child directory should return the hash of its contents.

get_dir()
get_env()
get_env_scanner(env, kw={})[source]
get_executor(create=1)

Fetch the action executor for this node. Create one if there isn’t already one, and requested to do so.

get_found_includes(env, scanner, path)[source]

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).

get_implicit_deps(env, initial_scanner, path_func, kw={})

Return a list of implicit dependencies for this node.

This method exists to handle recursive invocation of the scanner on the implicit dependencies returned by the scanner, if the scanner’s recursive flag says that we should.

get_internal_path()[source]
get_labspath() str[source]

Get the absolute path of the file.

get_ninfo()
get_path(dir=None)

Return path relative to the current working directory of the Node.FS.Base object that owns us.

get_path_elements()[source]
get_relpath()

Get the path of the file relative to the root SConstruct file’s directory.

get_source_scanner(node)

Fetch the source scanner for the specified node

NOTE: “self” is the target being built, “node” is the source file for which we want to fetch the scanner.

Implies self.has_builder() is true; again, expect to only be called from locations where this is already verified.

This function may be called very often; it attempts to cache the scanner found to improve performance.

get_state()
get_stored_implicit()

Fetch the stored implicit dependencies

get_stored_info()
get_string(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.

Such command generators should use this method in preference to str(Node) when converting a Node to a string, passing in the for_signature parameter, such that we will call Node.for_signature() or str(Node) properly, depending on whether we are calculating a signature or actually constructing a command line.

get_subst_proxy()

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.

get_suffix()
get_target_scanner()[source]
get_text_contents()[source]

We already emit things in text, so just return the binary version.

get_timestamp() int[source]

Return the latest timestamp from among our children

get_tpath()[source]
getmtime()
getsize()
glob(pathname, ondisk=True, source=False, strings=False, exclude=None)[source]

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 VariantDir()). The default behavior is to return Nodes local to the VariantDir().

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

The “exclude” argument, if not None, must be a pattern or a list of patterns following the same UNIX shell semantics. Elements matching a least one pattern of this list will be excluded from the result.

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

has_builder()

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 __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

has_explicit_builder()

Return whether this Node has an explicit builder

This allows an internal Builder created by SCons to be marked non-explicit, so that it can be overridden by an explicit builder that the user supplies (the canonical example being directories).

ignore
ignore_set
implicit
implicit_set
includes
is_conftest()

Returns true if this node is an conftest node

is_derived()

Returns true if this node is derived (i.e. built).

This should return true only for nodes whose path should be in the variant directory when duplicate=0 and should contribute their build signatures when they are used as source files to other derived files. For example: source with source builders are not derived in this sense, and hence should not return true.

is_explicit
is_literal()

Always pass the string representation of a Node to the command interpreter literally.

is_sconscript()

Returns true if this node is an sconscript

is_under(dir)
is_up_to_date()[source]

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

isdir()
isfile()

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

linked
lstat()
make_ready()

Get a Node ready for evaluation.

This is called before the Taskmaster decides if the Node is up-to-date or not. Overriding this method allows for a Node subclass to be disambiguated if necessary, or for an implicit source builder to be attached.

missing()
multiple_side_effect_has_builder()[source]

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 __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

must_be_same(klass)

This node, which already existed, is being looked up as the specified klass. Raise an exception if it isn’t.

name
new_binfo()
new_ninfo()
ninfo
nocache
noclean
on_disk_entries
postprocess()

Clean up anything we don’t need to hang onto after we’ve been built.

precious
prepare()[source]

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 implementation checks that explicit or implicit dependencies either exist or are derived, and initializes the BuildInfo structure that will hold the information about how this node is, uh, built.

(The existence of source files is checked separately by the Executor, which aggregates checks for all of the targets built by a specific action.)

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.

prerequisites
pseudo
push_to_cache()

Try to push a node into a cache

rdir()[source]
ref_count
rel_path(other)[source]

Return a path to “other” relative to this directory.

release_target_info()

Called just after this node has been marked up-to-date or was built completely.

This is where we try to release as many target node infos as possible for clean builds and update runs, in order to minimize the overall memory consumption.

By purging attributes that aren’t needed any longer after a Node (=File) got built, we don’t have to care that much how many KBytes a Node actually requires…as long as we free the memory shortly afterwards.

@see: built() and File.release_target_info()

released_target_info
remove()

Remove this Node: no-op by default.

render_include_tree()

Return a text representation, suitable for displaying to the user, of the include tree for the sources of this node.

rentry()
rentry_exists_on_disk(name)[source]

Searches through the file/dir entries of the current and all its remote directories (repos), and returns True if a physical entry with the given name could be found. The local directory (self) gets searched first, so repositories take a lower precedence regarding the searching order.

@see entry_exists_on_disk

repositories
reset_executor()

Remove cached executor; forces recompute when needed.

retrieve_from_cache()

Try to retrieve the node’s content from a cache

This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in built().

Returns true if the node was successfully retrieved.

rexists()

Does this node exist locally or in a repository?

rfile()
root
rstr()

A Node.FS.Base object’s string representation is its path name.

sbuilder
scan()

Scan this node’s dependents for implicit dependencies.

scanner_key()[source]

A directory does not get scanned.

scanner_paths
sconsign()[source]

Return the .sconsign file info for this directory.

searched
select_scanner(scanner)

Selects a scanner for this Node.

This is a separate method so it can be overridden by Node subclasses (specifically, Node.FS.Dir) that must use their own Scanner and don’t select one the Scanner.Selector that’s configured for the target.

set_always_build(always_build=1)

Set the Node’s always_build value.

set_executor(executor)

Set the action executor for this node.

set_explicit(is_explicit)
set_local()
set_nocache(nocache=1)

Set the Node’s nocache value.

set_noclean(noclean=1)

Set the Node’s noclean value.

set_precious(precious=1)

Set the Node’s precious value.

set_pseudo(pseudo=True)

Set the Node’s precious value.

set_specific_source(source)
set_src_builder(builder)

Set the source code builder for this node.

set_state(state)
side_effect
side_effects
sources
sources_set
src_builder()

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).

srcdir
srcdir_duplicate(name)[source]
srcdir_find_file(filename)[source]
srcdir_list()[source]
srcnode()[source]

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

stat()
state
store_info
str_for_display()
target_from_source(prefix, suffix, splitext=<function splitext>)

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.

target_peers
up()[source]
variant_dirs
visited()

Called just after this node has been visited (with or without a build).

waiting_parents
waiting_s_e
walk(func, arg)[source]

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).

wkids
class SCons.Node.FS.DirBuildInfo[source]

Bases: BuildInfoBase

bact
bactsig
bdepends
bdependsigs
bimplicit
bimplicitsigs
bsources
bsourcesigs
current_version_id = 2
merge(other)

Merge the fields of another object into this object. Already existing information is overwritten by the other instance’s data. WARNING: If a ‘__dict__’ slot is added, it should be updated instead of replaced.

class SCons.Node.FS.DirNodeInfo[source]

Bases: NodeInfoBase

convert(node, val)
current_version_id = 2
format(field_list=None, names=0)
fs = None
merge(other)

Merge the fields of another object into this object. Already existing information is overwritten by the other instance’s data. WARNING: If a ‘__dict__’ slot is added, it should be updated instead of replaced.

str_to_node(s)[source]
update(node)
class SCons.Node.FS.DiskChecker(type, do, ignore)[source]

Bases: object

set(list)[source]
class SCons.Node.FS.Entry(name, directory, fs)[source]

Bases: Base

This is the class for generic Node.FS entries–that is, things that could be a File or a Dir, but we’re just not sure yet. Consequently, the methods in this class really exist just to transform their associated object into the right class when the time comes, and then call the same-named method in the transformed class.

class Attrs

Bases: object

shared
BuildInfo

alias of BuildInfoBase

Decider(function)
GetTag(key)

Return a user-defined tag.

NodeInfo

alias of NodeInfoBase

RDirs(pathlist)

Search for a list of directories in the Repository list.

Rfindalldirs(pathlist)

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.

Tag(key, value)

Add a user-defined tag.

_Rfindalldirs_key(pathlist)
_abspath
_add_child(collection, set, child)

Adds ‘child’ to ‘collection’, first checking ‘set’ to see if it’s already present.

_children_get()
_children_reset()
_func_exists
_func_get_contents
_func_is_derived
_func_rexists
_func_sconsign
_func_target_from_source
_get_scanner(env, initial_scanner, root_node_scanner, kw)
_get_str()
_glob1(pattern, ondisk=True, source=False, strings=False)[source]
_labspath
_local
_memo
_path
_path_elements
_proxy
_save_str()
_sconsign
_specific_sources
_tags
_tpath
add_dependency(depend)

Adds dependencies.

add_ignore(depend)

Adds dependencies to ignore.

add_prerequisite(prerequisite)

Adds prerequisites

add_source(source)

Adds sources.

add_to_implicit(deps)
add_to_waiting_parents(node)

Returns the number of nodes added to our waiting parents list: 1 if we add a unique waiting parent, 0 if not. (Note that the returned values are intended to be used to increment a reference count, so don’t think you can “clean up” this function by using True and False instead…)

add_to_waiting_s_e(node)
add_wkid(wkid)

Add a node to the list of kids waiting to be evaluated

all_children(scan=1)

Return a list of all the node’s direct children.

alter_targets()

Return a list of alternate targets for this Node.

always_build
attributes
binfo
build(**kw)

Actually build the node.

This is called by the Taskmaster after it’s decided that the Node is out-of-date and must be rebuilt, and after the prepare() method has gotten everything, uh, prepared.

This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in built().

builder
builder_set(builder)
built()

Called just after this node is successfully built.

cached
cachedir_csig
cachesig
changed(node=None, allowcache=False)

Returns if the node is up-to-date with respect to the BuildInfo stored last time it was built. The default behavior is to compare it against our own previously stored BuildInfo, but the stored BuildInfo from another Node (typically one in a Repository) can be used instead.

Note that we now always check every dependency. We used to short-circuit the check by returning as soon as we detected any difference, but we now rely on checking every dependency to make sure that any necessary Node information (for example, the content signature of an #included .h file) is updated.

The allowcache option was added for supporting the early release of the executor/builder structures, right after a File target was built. When set to true, the return value of this changed method gets cached for File nodes. Like this, the executor isn’t needed any longer for subsequent calls to changed().

@see: FS.File.changed(), FS.File.release_target_info()

changed_since_last_build
check_attributes(name)

Simple API to check if the node.attributes for name has been set

children(scan=1)

Return a list of the node’s direct children, minus those that are ignored by this node.

children_are_up_to_date()

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.

The SCons.Node.Alias and SCons.Node.Python.Value subclasses rebind their current() method to this method.

clear()

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()
contentsig
cwd
del_binfo()

Delete the build info from this node.

depends
depends_set
dir
dirname
disambiguate(must_exist=None)[source]
diskcheck_match()[source]
duplicate
entries
env
env_set(env, safe=0)
executor
executor_cleanup()

Let the executor clean up any cached information.

exists()[source]

Does this node exists?

explain()
for_signature()

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.

fs

Reference to parent Node.FS object

get_abspath()

Get the absolute path of the file.

get_binfo()

Fetch a node’s build information.

node - the node whose sources will be collected cache - alternate node to use for the signature cache returns - the build signature

This no longer handles the recursive descent of the node’s children’s signatures. We expect that they’re already built and updated by someone else, if that’s what’s wanted.

get_build_env()

Fetch the appropriate Environment to build this node.

get_build_scanner_path(scanner)

Fetch the appropriate scanner path for this node.

get_builder(default_builder=None)

Return the set builder, or a specified default value

get_cachedir_csig()
get_contents()[source]

Fetch the contents of the entry. Returns the exact binary contents of the file.

get_csig()
get_dir()
get_env()
get_env_scanner(env, kw={})
get_executor(create=1)

Fetch the action executor for this node. Create one if there isn’t already one, and requested to do so.

get_found_includes(env, scanner, path)

Return the scanned include lines (implicit dependencies) found in this node.

The default is no implicit dependencies. We expect this method to be overridden by any subclass that can be scanned for implicit dependencies.

get_implicit_deps(env, initial_scanner, path_func, kw={})

Return a list of implicit dependencies for this node.

This method exists to handle recursive invocation of the scanner on the implicit dependencies returned by the scanner, if the scanner’s recursive flag says that we should.

get_internal_path()
get_labspath()

Get the absolute path of the file.

get_ninfo()
get_path(dir=None)

Return path relative to the current working directory of the Node.FS.Base object that owns us.

get_path_elements()
get_relpath()

Get the path of the file relative to the root SConstruct file’s directory.

get_source_scanner(node)

Fetch the source scanner for the specified node

NOTE: “self” is the target being built, “node” is the source file for which we want to fetch the scanner.

Implies self.has_builder() is true; again, expect to only be called from locations where this is already verified.

This function may be called very often; it attempts to cache the scanner found to improve performance.

get_state()
get_stored_implicit()

Fetch the stored implicit dependencies

get_stored_info()
get_string(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.

Such command generators should use this method in preference to str(Node) when converting a Node to a string, passing in the for_signature parameter, such that we will call Node.for_signature() or str(Node) properly, depending on whether we are calculating a signature or actually constructing a command line.

get_subst_proxy()[source]

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.

get_suffix()
get_target_scanner()
get_text_contents()[source]

Fetch the decoded text contents of a Unicode encoded Entry.

Since this should return the text contents from the file system, we check to see into what sort of subclass we should morph this Entry.

get_tpath()
getmtime()
getsize()
has_builder()

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 __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

has_explicit_builder()

Return whether this Node has an explicit builder

This allows an internal Builder created by SCons to be marked non-explicit, so that it can be overridden by an explicit builder that the user supplies (the canonical example being directories).

ignore
ignore_set
implicit
implicit_set
includes
is_conftest()

Returns true if this node is an conftest node

is_derived()

Returns true if this node is derived (i.e. built).

This should return true only for nodes whose path should be in the variant directory when duplicate=0 and should contribute their build signatures when they are used as source files to other derived files. For example: source with source builders are not derived in this sense, and hence should not return true.

is_explicit
is_literal()

Always pass the string representation of a Node to the command interpreter literally.

is_sconscript()

Returns true if this node is an sconscript

is_under(dir)
is_up_to_date()

Default check for whether the Node is current: unknown Node subtypes are always out of date, so they will always get built.

isdir()
isfile()
linked
lstat()
make_ready()

Get a Node ready for evaluation.

This is called before the Taskmaster decides if the Node is up-to-date or not. Overriding this method allows for a Node subclass to be disambiguated if necessary, or for an implicit source builder to be attached.

missing()
multiple_side_effect_has_builder()

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 __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

must_be_same(klass)[source]

Called to make sure a Node is a Dir. Since we’re an Entry, we can morph into one.

name
new_binfo()
new_ninfo()[source]
ninfo
nocache
noclean
on_disk_entries
postprocess()

Clean up anything we don’t need to hang onto after we’ve been built.

precious
prepare()

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 implementation checks that explicit or implicit dependencies either exist or are derived, and initializes the BuildInfo structure that will hold the information about how this node is, uh, built.

(The existence of source files is checked separately by the Executor, which aggregates checks for all of the targets built by a specific action.)

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.

prerequisites
pseudo
push_to_cache()

Try to push a node into a cache

ref_count
rel_path(other)[source]
release_target_info()

Called just after this node has been marked up-to-date or was built completely.

This is where we try to release as many target node infos as possible for clean builds and update runs, in order to minimize the overall memory consumption.

By purging attributes that aren’t needed any longer after a Node (=File) got built, we don’t have to care that much how many KBytes a Node actually requires…as long as we free the memory shortly afterwards.

@see: built() and File.release_target_info()

released_target_info
remove()

Remove this Node: no-op by default.

render_include_tree()

Return a text representation, suitable for displaying to the user, of the include tree for the sources of this node.

rentry()
repositories
reset_executor()

Remove cached executor; forces recompute when needed.

retrieve_from_cache()

Try to retrieve the node’s content from a cache

This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in built().

Returns true if the node was successfully retrieved.

rexists()

Does this node exist locally or in a repository?

rfile()[source]

We’re a generic Entry, but the caller is actually looking for a File at this point, so morph into one.

root
rstr()

A Node.FS.Base object’s string representation is its path name.

sbuilder
scan()

Scan this node’s dependents for implicit dependencies.

scanner_key()[source]
scanner_paths
searched
select_scanner(scanner)

Selects a scanner for this Node.

This is a separate method so it can be overridden by Node subclasses (specifically, Node.FS.Dir) that must use their own Scanner and don’t select one the Scanner.Selector that’s configured for the target.

set_always_build(always_build=1)

Set the Node’s always_build value.

set_executor(executor)

Set the action executor for this node.

set_explicit(is_explicit)
set_local()
set_nocache(nocache=1)

Set the Node’s nocache value.

set_noclean(noclean=1)

Set the Node’s noclean value.

set_precious(precious=1)

Set the Node’s precious value.

set_pseudo(pseudo=True)

Set the Node’s precious value.

set_specific_source(source)
set_src_builder(builder)

Set the source code builder for this node.

set_state(state)
side_effect
side_effects
sources
sources_set
src_builder()

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).

srcdir
srcnode()

If this node is in a build path, return the node corresponding to its source file. Otherwise, return ourself.

stat()
state
store_info
str_for_display()
target_from_source(prefix, suffix, splitext=<function splitext>)

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.

target_peers
variant_dirs
visited()

Called just after this node has been visited (with or without a build).

waiting_parents
waiting_s_e
wkids
class SCons.Node.FS.EntryProxy(subject)[source]

Bases: Proxy

__get_abspath()
__get_base_path()

Return the file’s directory and file name, with the suffix stripped.

__get_dir()
__get_file()
__get_filebase()
__get_posix_path()

Return the path with / as the path separator, regardless of platform.

__get_relpath()
__get_rsrcdir()

Returns the directory containing the source node linked to this node via VariantDir(), or the directory of this node if not linked.

__get_rsrcnode()
__get_srcdir()

Returns the directory containing the source node linked to this node via VariantDir(), or the directory of this node if not linked.

__get_srcnode()
__get_suffix()
__get_windows_path()

Return the path with as the path separator, regardless of platform.

dictSpecialAttrs = {'abspath': <function EntryProxy.__get_abspath>, 'base': <function EntryProxy.__get_base_path>, 'dir': <function EntryProxy.__get_dir>, 'file': <function EntryProxy.__get_file>, 'filebase': <function EntryProxy.__get_filebase>, 'posix': <function EntryProxy.__get_posix_path>, 'relpath': <function EntryProxy.__get_relpath>, 'rsrcdir': <function EntryProxy.__get_rsrcdir>, 'rsrcpath': <function EntryProxy.__get_rsrcnode>, 'srcdir': <function EntryProxy.__get_srcdir>, 'srcpath': <function EntryProxy.__get_srcnode>, 'suffix': <function EntryProxy.__get_suffix>, 'win32': <function EntryProxy.__get_windows_path>, 'windows': <function EntryProxy.__get_windows_path>}
get()

Retrieve the entire wrapped object

exception SCons.Node.FS.EntryProxyAttributeError(entry_proxy, attribute)[source]

Bases: AttributeError

An AttributeError subclass for recording and displaying the name of the underlying Entry involved in an AttributeError exception.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class SCons.Node.FS.FS(path=None)[source]

Bases: LocalFS

Dir(name, directory=None, create=True)[source]

Look up or create a Dir node with the specified name. If the name is a relative path (begins with ./, ../, or a file name), then it is looked up relative to the supplied directory node, or to the top level directory of the FS (supplied at construction time) if no directory is supplied.

This method will raise TypeError if a normal file is found at the specified path.

Entry(name, directory=None, create=1)[source]

Look up or create a generic Entry node with the specified name. If the name is a relative path (begins with ./, ../, or a file name), then it is looked up relative to the supplied directory node, or to the top level directory of the FS (supplied at construction time) if no directory is supplied.

File(name, directory=None, create=1)[source]

Look up or create a File node with the specified name. If the name is a relative path (begins with ./, ../, or a file name), then it is looked up relative to the supplied directory node, or to the top level directory of the FS (supplied at construction time) if no directory is supplied.

This method will raise TypeError if a directory is found at the specified path.

Glob(pathname, ondisk=True, source=True, strings=False, exclude=None, cwd=None)[source]

Globs

This is mainly a shim layer

PyPackageDir(modulename)[source]

Locate the directory of a given python module name

For example scons might resolve to Windows: C:Python27Libsite-packagesscons-2.5.1 Linux: /usr/lib/scons

This can be useful when we want to determine a toolpath based on a python module name

Repository(*dirs)[source]

Specify Repository directories to search.

VariantDir(variant_dir, src_dir, duplicate=1)[source]

Link the supplied variant directory to the source directory for purposes of building files.

_lookup(p, directory, fsclass, create=1)[source]

The generic entry point for Node lookup with user-supplied data.

This translates arbitrary input into a canonical Node.FS object of the specified fsclass. The general approach for strings is to turn it into a fully normalized absolute path and then call the root directory’s lookup_abs() method for the heavy lifting.

If the path name begins with ‘#’, it is unconditionally interpreted relative to the top-level directory of this FS. ‘#’ is treated as a synonym for the top-level SConstruct directory, much like ‘~’ is treated as a synonym for the user’s home directory in a UNIX shell. So both ‘#foo’ and ‘#/foo’ refer to the ‘foo’ subdirectory underneath the top-level SConstruct directory.

If the path name is relative, then the path is looked up relative to the specified directory, or the current directory (self._cwd, typically the SConscript directory) if the specified directory is None.

chdir(dir, change_os_dir=0)[source]

Change the current working directory for lookups. If change_os_dir is true, we will also change the “real” cwd to match.

chmod(path, mode)
copy(src, dst)
copy2(src, dst)
exists(path)
get_max_drift()[source]
get_root(drive)[source]

Returns the root directory for the specified drive, creating it if necessary.

getcwd()[source]
getmtime(path)
getsize(path)
isdir(path)
isfile(path)
listdir(path)
lstat(path)
makedirs(path, mode=511, exist_ok=False)
mkdir(path, mode=511)
open(path)
rename(old, new)
scandir(path)
set_SConstruct_dir(dir)[source]
set_max_drift(max_drift)[source]
stat(path)
variant_dir_target_climb(orig, dir, tail)[source]

Create targets in corresponding variant directories

Climb the directory tree, and look up path names relative to any linked variant directories we find.

Even though this loops and walks up the tree, we don’t memoize the return value because this is really only used to process the command-line targets.

class SCons.Node.FS.File(name, directory, fs)[source]

Bases: Base

A class for files in a file system.

class Attrs

Bases: object

shared
BuildInfo

alias of FileBuildInfo

Decider(function)
Dir(name, create=True)[source]

Create a directory node named ‘name’ relative to the directory of this file.

Dirs(pathlist)[source]

Create a list of directories relative to the SConscript directory of this file.

Entry(name)[source]

Create an entry node named ‘name’ relative to the directory of this file.

File(name)[source]

Create a file node named ‘name’ relative to the directory of this file.

GetTag(key)

Return a user-defined tag.

NodeInfo

alias of FileNodeInfo

RDirs(pathlist)

Search for a list of directories in the Repository list.

Rfindalldirs(pathlist)

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.

Tag(key, value)

Add a user-defined tag.

_Rfindalldirs_key(pathlist)
__dmap_cache = {}
__dmap_sig_cache = {}
_abspath
_add_child(collection, set, child)

Adds ‘child’ to ‘collection’, first checking ‘set’ to see if it’s already present.

_add_strings_to_dependency_map(dmap)[source]

In the case comparing node objects isn’t sufficient, we’ll add the strings for the nodes to the dependency map :return:

_build_dependency_map(binfo)[source]

Build mapping from file -> signature

Parameters
  • self (self -) –

  • considered (binfo - buildinfo from node being) –

Returns

dictionary of file->signature mappings

_children_get()
_children_reset()
_createDir()[source]
_func_exists
_func_get_contents
_func_is_derived
_func_rexists
_func_sconsign
_func_target_from_source
_get_found_includes_key(env, scanner, path)[source]
_get_previous_signatures(dmap)[source]

Return a list of corresponding csigs from previous build in order of the node/files in children.

Parameters
  • self (self -) –

  • csig (dmap - Dictionary of file ->) –

Returns

List of csigs for provided list of children

_get_scanner(env, initial_scanner, root_node_scanner, kw)
_get_str()
_glob1(pattern, ondisk=True, source=False, strings=False)
_labspath
_local
_memo
_morph()[source]

Turn a file system node into a File object.

_path
_path_elements
_proxy
_rmv_existing()[source]
_save_str()
_sconsign
_specific_sources
_tags
_tpath
add_dependency(depend)

Adds dependencies.

add_ignore(depend)

Adds dependencies to ignore.

add_prerequisite(prerequisite)

Adds prerequisites

add_source(source)

Adds sources.

add_to_implicit(deps)
add_to_waiting_parents(node)

Returns the number of nodes added to our waiting parents list: 1 if we add a unique waiting parent, 0 if not. (Note that the returned values are intended to be used to increment a reference count, so don’t think you can “clean up” this function by using True and False instead…)

add_to_waiting_s_e(node)
add_wkid(wkid)

Add a node to the list of kids waiting to be evaluated

all_children(scan=1)

Return a list of all the node’s direct children.

alter_targets()[source]

Return any corresponding targets in a variant directory.

always_build
attributes
binfo
build(**kw)

Actually build the node.

This is called by the Taskmaster after it’s decided that the Node is out-of-date and must be rebuilt, and after the prepare() method has gotten everything, uh, prepared.

This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in built().

builder
builder_set(builder)[source]
built()[source]

Called just after this File node is successfully built.

Just like for ‘release_target_info’ we try to release some more target node attributes in order to minimize the overall memory consumption.

@see: release_target_info

cached
cachedir_csig
cachesig
changed(node=None, allowcache=False)[source]

Returns if the node is up-to-date with respect to the BuildInfo stored last time it was built.

For File nodes this is basically a wrapper around Node.changed(), but we allow the return value to get cached after the reference to the Executor got released in release_target_info().

@see: Node.changed()

changed_content(target, prev_ni, repo_node=None)[source]
changed_since_last_build
changed_state(target, prev_ni, repo_node=None)[source]
changed_timestamp_match(target, prev_ni, repo_node=None)[source]

Return True if the timestamps don’t match or if there is no previous timestamp :param target: :param prev_ni: Information about the node from the previous build :return:

changed_timestamp_newer(target, prev_ni, repo_node=None)[source]
changed_timestamp_then_content(target, prev_ni, node=None)[source]

Used when decider for file is Timestamp-MD5

NOTE: If the timestamp hasn’t changed this will skip md5’ing the

file and just copy the prev_ni provided. If the prev_ni is wrong. It will propagate it. See: https://github.com/SCons/scons/issues/2980

Parameters
  • dependency (self -) –

  • target (target -) –

  • .sconsign (prev_ni - The NodeInfo object loaded from previous builds) –

  • existence/timestamp (node - Node instance. Check this node for file) – if specified.

Returns

Boolean - Indicates if node(File) has changed.

check_attributes(name)

Simple API to check if the node.attributes for name has been set

children(scan=1)

Return a list of the node’s direct children, minus those that are ignored by this node.

children_are_up_to_date()

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.

The SCons.Node.Alias and SCons.Node.Python.Value subclasses rebind their current() method to this method.

clear()

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()
contentsig
convert_copy_attrs = ['bsources', 'bimplicit', 'bdepends', 'bact', 'bactsig', 'ninfo']
convert_old_entry(old_entry)[source]
convert_sig_attrs = ['bsourcesigs', 'bimplicitsigs', 'bdependsigs']
cwd
del_binfo()

Delete the build info from this node.

depends
depends_set
dir
dirname
disambiguate(must_exist=None)
diskcheck_match()[source]
do_duplicate(src)[source]
duplicate
entries
env
env_set(env, safe=0)
executor
executor_cleanup()

Let the executor clean up any cached information.

exists()[source]

Does this node exists?

explain()
find_repo_file()[source]

For this node, find if there exists a corresponding file in one or more repositories :return: list of corresponding files in repositories

find_src_builder()[source]
for_signature()

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.

fs

Reference to parent Node.FS object

get_abspath()

Get the absolute path of the file.

get_binfo()

Fetch a node’s build information.

node - the node whose sources will be collected cache - alternate node to use for the signature cache returns - the build signature

This no longer handles the recursive descent of the node’s children’s signatures. We expect that they’re already built and updated by someone else, if that’s what’s wanted.

get_build_env()

Fetch the appropriate Environment to build this node.

get_build_scanner_path(scanner)

Fetch the appropriate scanner path for this node.

get_builder(default_builder=None)

Return the set builder, or a specified default value

get_cachedir_bsig()[source]

Return the signature for a cached file, including its children.

It adds the path of the cached file to the cache signature, because multiple targets built by the same action will all have the same build signature, and we have to differentiate them somehow.

Signature should normally be string of hex digits.

get_cachedir_csig()[source]

Fetch a Node’s content signature for purposes of computing another Node’s cachesig.

This is a wrapper around the normal get_csig() method that handles the somewhat obscure case of using CacheDir with the -n option. Any files that don’t exist would normally be “built” by fetching them from the cache, but the normal get_csig() method will try to open up the local file, which doesn’t exist because the -n option meant we didn’t actually pull the file from cachedir. But since the file does actually exist in the cachedir, we can use its contents for the csig.

get_content_hash() str[source]

Compute and return the hash for this file.

get_contents() bytes[source]

Return the contents of the file as bytes.

get_contents_sig()[source]

A helper method for get_cachedir_bsig.

It computes and returns the signature for this node’s contents.

get_csig() str[source]

Generate a node’s content signature.

get_dir()
get_env()
get_env_scanner(env, kw={})
get_executor(create=1)

Fetch the action executor for this node. Create one if there isn’t already one, and requested to do so.

get_found_includes(env, scanner, path)[source]

Return the included implicit dependencies in this file. Cache results so we only scan the file once per path regardless of how many times this information is requested.

get_implicit_deps(env, initial_scanner, path_func, kw={})

Return a list of implicit dependencies for this node.

This method exists to handle recursive invocation of the scanner on the implicit dependencies returned by the scanner, if the scanner’s recursive flag says that we should.

get_internal_path()
get_labspath()

Get the absolute path of the file.

get_max_drift_csig() Optional[str][source]

Returns the content signature currently stored for this node if it’s been unmodified longer than the max_drift value, or the max_drift value is 0. Returns None otherwise.

get_ninfo()
get_path(dir=None)

Return path relative to the current working directory of the Node.FS.Base object that owns us.

get_path_elements()
get_relpath()

Get the path of the file relative to the root SConstruct file’s directory.

get_size() int[source]
get_source_scanner(node)

Fetch the source scanner for the specified node

NOTE: “self” is the target being built, “node” is the source file for which we want to fetch the scanner.

Implies self.has_builder() is true; again, expect to only be called from locations where this is already verified.

This function may be called very often; it attempts to cache the scanner found to improve performance.

get_state()
get_stored_implicit()[source]

Fetch the stored implicit dependencies

get_stored_info()[source]
get_string(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.

Such command generators should use this method in preference to str(Node) when converting a Node to a string, passing in the for_signature parameter, such that we will call Node.for_signature() or str(Node) properly, depending on whether we are calculating a signature or actually constructing a command line.

get_subst_proxy()

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.

get_suffix()
get_target_scanner()
get_text_contents() str[source]

Return the contents of the file in text form.

This attempts to figure out what the encoding of the text is based upon the BOM bytes, and then decodes the contents so that it’s a valid python string.

get_timestamp() int[source]
get_tpath()
getmtime()
getsize()
has_builder()

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 __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

has_explicit_builder()

Return whether this Node has an explicit builder

This allows an internal Builder created by SCons to be marked non-explicit, so that it can be overridden by an explicit builder that the user supplies (the canonical example being directories).

has_src_builder()[source]

Return whether this Node has a source builder or not.

If this Node doesn’t have an explicit source code builder, this is where we figure out, on the fly, if there’s a transparent source code builder for it.

Note that if we found a source builder, we also set the self.builder attribute, so that all of the methods that actually build this file don’t have to do anything different.

hash_chunksize = 65536
ignore
ignore_set
implicit
implicit_set
includes
is_conftest()

Returns true if this node is an conftest node

is_derived()

Returns true if this node is derived (i.e. built).

This should return true only for nodes whose path should be in the variant directory when duplicate=0 and should contribute their build signatures when they are used as source files to other derived files. For example: source with source builders are not derived in this sense, and hence should not return true.

is_explicit
is_literal()

Always pass the string representation of a Node to the command interpreter literally.

is_sconscript()

Returns true if this node is an sconscript

is_under(dir)
is_up_to_date()[source]

Check for whether the Node is current In all cases self is the target we’re checking to see if it’s up to date

isdir()
isfile()
linked
lstat()
make_ready()[source]

Get a Node ready for evaluation.

This is called before the Taskmaster decides if the Node is up-to-date or not. Overriding this method allows for a Node subclass to be disambiguated if necessary, or for an implicit source builder to be attached.

missing()
multiple_side_effect_has_builder()

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 __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

must_be_same(klass)

This node, which already existed, is being looked up as the specified klass. Raise an exception if it isn’t.

name
new_binfo()
new_ninfo()
ninfo
nocache
noclean
on_disk_entries
postprocess()

Clean up anything we don’t need to hang onto after we’ve been built.

precious
prepare()[source]

Prepare for this file to be created.

prerequisites
pseudo
push_to_cache()[source]

Try to push the node into a cache

ref_count
rel_path(other)[source]
release_target_info()[source]

Called just after this node has been marked up-to-date or was built completely.

This is where we try to release as many target node infos as possible for clean builds and update runs, in order to minimize the overall memory consumption.

We’d like to remove a lot more attributes like self.sources and self.sources_set, but they might get used in a next build step. For example, during configuration the source files for a built E{*}.o file are used to figure out which linker to use for the resulting Program (gcc vs. g++)! That’s why we check for the ‘keep_targetinfo’ attribute, config Nodes and the Interactive mode just don’t allow an early release of most variables.

In the same manner, we can’t simply remove the self.attributes here. The smart linking relies on the shared flag, and some parts of the java Tool use it to transport information about nodes…

@see: built() and Node.release_target_info()

released_target_info
remove()[source]

Remove this file.

render_include_tree()

Return a text representation, suitable for displaying to the user, of the include tree for the sources of this node.

rentry()
repositories
reset_executor()

Remove cached executor; forces recompute when needed.

retrieve_from_cache()[source]

Try to retrieve the node’s content from a cache

This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in built().

Returns true if the node was successfully retrieved.

rexists()

Does this node exist locally or in a repository?

rfile()[source]
root
rstr()[source]

A Node.FS.Base object’s string representation is its path name.

sbuilder
scan()

Scan this node’s dependents for implicit dependencies.

scanner_key()[source]
scanner_paths
searched
select_scanner(scanner)

Selects a scanner for this Node.

This is a separate method so it can be overridden by Node subclasses (specifically, Node.FS.Dir) that must use their own Scanner and don’t select one the Scanner.Selector that’s configured for the target.

set_always_build(always_build=1)

Set the Node’s always_build value.

set_executor(executor)

Set the action executor for this node.

set_explicit(is_explicit)
set_local()
set_nocache(nocache=1)

Set the Node’s nocache value.

set_noclean(noclean=1)

Set the Node’s noclean value.

set_precious(precious=1)

Set the Node’s precious value.

set_pseudo(pseudo=True)

Set the Node’s precious value.

set_specific_source(source)
set_src_builder(builder)

Set the source code builder for this node.

set_state(state)
side_effect
side_effects
sources
sources_set
src_builder()

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).

srcdir
srcnode()

If this node is in a build path, return the node corresponding to its source file. Otherwise, return ourself.

stat()
state
store_info
str_for_display()
target_from_source(prefix, suffix, splitext=<function splitext>)

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.

target_peers
variant_dirs
visited()[source]

Called just after this node has been visited (with or without a build).

waiting_parents
waiting_s_e
wkids
class SCons.Node.FS.FileBuildInfo[source]

Bases: BuildInfoBase

This is info loaded from sconsign.

Attributes unique to FileBuildInfo:
dependency_mapCaches file->csig mapping

for all dependencies. Currently this is only used when using MD5-timestamp decider. It’s used to ensure that we copy the correct csig from the previous build to be written to .sconsign when current build is done. Previously the matching of csig to file was strictly by order they appeared in bdepends, bsources, or bimplicit, and so a change in order or count of any of these could yield writing wrong csig, and then false positive rebuilds

bact
bactsig
bdepends
bdependsigs
bimplicit
bimplicitsigs
bsources
bsourcesigs
convert_from_sconsign(dir, name)[source]

Converts a newly-read FileBuildInfo object for in-SCons use

For normal up-to-date checking, we don’t have any conversion to perform–but we’re leaving this method here to make that clear.

convert_to_sconsign()[source]

Converts this FileBuildInfo object for writing to a .sconsign file

This replaces each Node in our various dependency lists with its usual string representation: relative to the top-level SConstruct directory, or an absolute path if it’s outside.

current_version_id = 2
dependency_map
format(names=0)[source]
merge(other)

Merge the fields of another object into this object. Already existing information is overwritten by the other instance’s data. WARNING: If a ‘__dict__’ slot is added, it should be updated instead of replaced.

prepare_dependencies()[source]

Prepares a FileBuildInfo object for explaining what changed

The bsources, bdepends and bimplicit lists have all been stored on disk as paths relative to the top-level SConstruct directory. Convert the strings to actual Nodes (for use by the –debug=explain code and –implicit-cache).

exception SCons.Node.FS.FileBuildInfoFileToCsigMappingError[source]

Bases: Exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class SCons.Node.FS.FileFinder[source]

Bases: object

_find_file_key(filename, paths, verbose=None)[source]
filedir_lookup(p, fd=None)[source]

A helper method for find_file() that looks up a directory for a file we’re trying to find. This only creates the Dir Node if it exists on-disk, since if the directory doesn’t exist we know we won’t find any files in it… :-)

It would be more compact to just use this as a nested function with a default keyword argument (see the commented-out version below), but that doesn’t work unless you have nested scopes, so we define it here just so this work under Python 1.5.2.

find_file(filename, paths, verbose=None)[source]

Find a node corresponding to either a derived file or a file that exists already.

Only the first file found is returned, and none is returned if no file is found.

filename: A filename to find paths: A list of directory path nodes to search in. Can be represented as a list, a tuple, or a callable that is called with no arguments and returns the list or tuple.

returns The node created from the found file.

class SCons.Node.FS.FileNodeInfo[source]

Bases: NodeInfoBase

convert(node, val)
csig
current_version_id = 2
field_list = ['csig', 'timestamp', 'size']
format(field_list=None, names=0)
fs = None
merge(other)

Merge the fields of another object into this object. Already existing information is overwritten by the other instance’s data. WARNING: If a ‘__dict__’ slot is added, it should be updated instead of replaced.

size
str_to_node(s)[source]
timestamp
update(node)
SCons.Node.FS.LinkFunc(target, source, env)[source]

Relative paths cause problems with symbolic links, so we use absolute paths, which may be a problem for people who want to move their soft-linked src-trees around. Those people should use the ‘hard-copy’ mode, softlinks cannot be used for that; at least I have no idea how …

class SCons.Node.FS.LocalFS[source]

Bases: object

This class implements an abstraction layer for operations involving a local file system. Essentially, this wraps any function in the os, os.path or shutil modules that we use to actually go do anything with or to the local file system.

Note that there’s a very good chance we’ll refactor this part of the architecture in some way as we really implement the interface(s) for remote file system Nodes. For example, the right architecture might be to have this be a subclass instead of a base class. Nevertheless, we’re using this as a first step in that direction.

We’re not using chdir() yet because the calling subclass method needs to use os.chdir() directly to avoid recursion. Will we really need this one?

chmod(path, mode)[source]
copy(src, dst)[source]
copy2(src, dst)[source]
exists(path)[source]
getmtime(path)[source]
getsize(path)[source]
isdir(path)[source]
isfile(path)[source]
listdir(path)[source]
lstat(path)[source]
makedirs(path, mode=511, exist_ok=False)[source]
mkdir(path, mode=511)[source]
open(path)[source]
rename(old, new)[source]
scandir(path)[source]
stat(path)[source]
SCons.Node.FS.LocalString(target, source, env)[source]
SCons.Node.FS.MkdirFunc(target, source, env)[source]
class SCons.Node.FS.RootDir(drive, fs)[source]

Bases: Dir

A class for the root directory of a file system.

This is the same as a Dir class, except that the path separator (‘/’ or ‘') is actually part of the name, so we don’t need to add a separator when creating the path names of entries within this directory.

class Attrs

Bases: object

shared
BuildInfo

alias of DirBuildInfo

Decider(function)
Dir(name, create=True)

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

Entry(name)

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

File(name)

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

GetTag(key)

Return a user-defined tag.

NodeInfo

alias of DirNodeInfo

RDirs(pathlist)

Search for a list of directories in the Repository list.

Rfindalldirs(pathlist)

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.

Tag(key, value)

Add a user-defined tag.

_Rfindalldirs_key(pathlist)
_abspath
_add_child(collection, set, child)

Adds ‘child’ to ‘collection’, first checking ‘set’ to see if it’s already present.

_children_get()
_children_reset()
_create()

Create this directory, silently and without worrying about whether the builder is the default or not.

_func_exists
_func_get_contents
_func_is_derived
_func_rexists
_func_sconsign
_func_target_from_source
_get_scanner(env, initial_scanner, root_node_scanner, kw)
_get_str()
_glob1(pattern, ondisk=True, source=False, strings=False)

Globs for and returns a list of entry names matching a single pattern in this directory.

This searches any repositories and source directories for corresponding entries and returns a Node (or string) relative to the current directory if an entry is found anywhere.

TODO: handle pattern with no wildcard

_labspath
_local
_lookupDict
_lookup_abs(p, klass, create=1)[source]

Fast (?) lookup of a normalized absolute path.

This method is intended for use by internal lookups with already-normalized path data. For general-purpose lookups, use the FS.Entry(), FS.Dir() or FS.File() methods.

The caller is responsible for making sure we’re passed a normalized absolute path; we merely let Python’s dictionary look up and return the One True Node.FS object for the path.

If a Node for the specified “p” doesn’t already exist, and “create” is specified, the Node may be created after recursive invocation to find or create the parent directory or directories.

_memo
_morph()[source]

Turn a file system Node (either a freshly initialized directory object or a separate Entry object) into a proper directory object.

Set up this directory’s entries and hook it into the file system tree. Specify that directories (this Node) don’t use signatures for calculating whether they’re current.

_path
_path_elements
_proxy
_rel_path_key(other)
_save_str()
_sconsign
_specific_sources
_srcdir_find_file_key(filename)
_tags
_tpath
abspath
addRepository(dir)
add_dependency(depend)

Adds dependencies.

add_ignore(depend)

Adds dependencies to ignore.

add_prerequisite(prerequisite)

Adds prerequisites

add_source(source)

Adds sources.

add_to_implicit(deps)
add_to_waiting_parents(node)

Returns the number of nodes added to our waiting parents list: 1 if we add a unique waiting parent, 0 if not. (Note that the returned values are intended to be used to increment a reference count, so don’t think you can “clean up” this function by using True and False instead…)

add_to_waiting_s_e(node)
add_wkid(wkid)

Add a node to the list of kids waiting to be evaluated

all_children(scan=1)

Return a list of all the node’s direct children.

alter_targets()

Return any corresponding targets in a variant directory.

always_build
attributes
binfo
build(**kw)

A null “builder” for directories.

builder
builder_set(builder)
built()

Called just after this node is successfully built.

cached
cachedir_csig
cachesig
changed(node=None, allowcache=False)

Returns if the node is up-to-date with respect to the BuildInfo stored last time it was built. The default behavior is to compare it against our own previously stored BuildInfo, but the stored BuildInfo from another Node (typically one in a Repository) can be used instead.

Note that we now always check every dependency. We used to short-circuit the check by returning as soon as we detected any difference, but we now rely on checking every dependency to make sure that any necessary Node information (for example, the content signature of an #included .h file) is updated.

The allowcache option was added for supporting the early release of the executor/builder structures, right after a File target was built. When set to true, the return value of this changed method gets cached for File nodes. Like this, the executor isn’t needed any longer for subsequent calls to changed().

@see: FS.File.changed(), FS.File.release_target_info()

changed_since_last_build
check_attributes(name)

Simple API to check if the node.attributes for name has been set

children(scan=1)

Return a list of the node’s direct children, minus those that are ignored by this node.

children_are_up_to_date()

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.

The SCons.Node.Alias and SCons.Node.Python.Value subclasses rebind their current() method to this method.

clear()

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()
contentsig
cwd
del_binfo()

Delete the build info from this node.

depends
depends_set
dir
dir_on_disk(name)
dirname
disambiguate(must_exist=None)
diskcheck_match()
do_duplicate(src)
duplicate
entries
entry_abspath(name)[source]
entry_exists_on_disk(name)

Searches through the file/dir entries of the current directory, and returns True if a physical entry with the given name could be found.

@see rentry_exists_on_disk

entry_labspath(name)[source]
entry_path(name)[source]
entry_tpath(name)[source]
env
env_set(env, safe=0)
executor
executor_cleanup()

Let the executor clean up any cached information.

exists()

Does this node exists?

explain()
file_on_disk(name)
for_signature()

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.

fs

Reference to parent Node.FS object

getRepositories()

Returns a list of repositories for this directory.

get_abspath() str

Get the absolute path of the file.

get_all_rdirs()
get_binfo()

Fetch a node’s build information.

node - the node whose sources will be collected cache - alternate node to use for the signature cache returns - the build signature

This no longer handles the recursive descent of the node’s children’s signatures. We expect that they’re already built and updated by someone else, if that’s what’s wanted.

get_build_env()

Fetch the appropriate Environment to build this node.

get_build_scanner_path(scanner)

Fetch the appropriate scanner path for this node.

get_builder(default_builder=None)

Return the set builder, or a specified default value

get_cachedir_csig()
get_contents()

Return content signatures and names of all our children separated by new-lines. Ensure that the nodes are sorted.

get_csig()

Compute the content signature for Directory nodes. In general, this is not needed and the content signature is not stored in the DirNodeInfo. However, if get_contents on a Dir node is called which has a child directory, the child directory should return the hash of its contents.

get_dir()[source]
get_env()
get_env_scanner(env, kw={})
get_executor(create=1)

Fetch the action executor for this node. Create one if there isn’t already one, and requested to do so.

get_found_includes(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).

get_implicit_deps(env, initial_scanner, path_func, kw={})

Return a list of implicit dependencies for this node.

This method exists to handle recursive invocation of the scanner on the implicit dependencies returned by the scanner, if the scanner’s recursive flag says that we should.

get_internal_path()
get_labspath() str

Get the absolute path of the file.

get_ninfo()
get_path(dir=None)

Return path relative to the current working directory of the Node.FS.Base object that owns us.

get_path_elements()
get_relpath()

Get the path of the file relative to the root SConstruct file’s directory.

get_source_scanner(node)

Fetch the source scanner for the specified node

NOTE: “self” is the target being built, “node” is the source file for which we want to fetch the scanner.

Implies self.has_builder() is true; again, expect to only be called from locations where this is already verified.

This function may be called very often; it attempts to cache the scanner found to improve performance.

get_state()
get_stored_implicit()

Fetch the stored implicit dependencies

get_stored_info()
get_string(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.

Such command generators should use this method in preference to str(Node) when converting a Node to a string, passing in the for_signature parameter, such that we will call Node.for_signature() or str(Node) properly, depending on whether we are calculating a signature or actually constructing a command line.

get_subst_proxy()

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.

get_suffix()
get_target_scanner()
get_text_contents()

We already emit things in text, so just return the binary version.

get_timestamp() int

Return the latest timestamp from among our children

get_tpath()
getmtime()
getsize()
glob(pathname, ondisk=True, source=False, strings=False, exclude=None)

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 VariantDir()). The default behavior is to return Nodes local to the VariantDir().

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

The “exclude” argument, if not None, must be a pattern or a list of patterns following the same UNIX shell semantics. Elements matching a least one pattern of this list will be excluded from the result.

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

has_builder()

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 __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

has_explicit_builder()

Return whether this Node has an explicit builder

This allows an internal Builder created by SCons to be marked non-explicit, so that it can be overridden by an explicit builder that the user supplies (the canonical example being directories).

ignore
ignore_set
implicit
implicit_set
includes
is_conftest()

Returns true if this node is an conftest node

is_derived()

Returns true if this node is derived (i.e. built).

This should return true only for nodes whose path should be in the variant directory when duplicate=0 and should contribute their build signatures when they are used as source files to other derived files. For example: source with source builders are not derived in this sense, and hence should not return true.

is_explicit
is_literal()

Always pass the string representation of a Node to the command interpreter literally.

is_sconscript()

Returns true if this node is an sconscript

is_under(dir)[source]
is_up_to_date()

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

isdir()
isfile()

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

linked
lstat()
make_ready()

Get a Node ready for evaluation.

This is called before the Taskmaster decides if the Node is up-to-date or not. Overriding this method allows for a Node subclass to be disambiguated if necessary, or for an implicit source builder to be attached.

missing()
multiple_side_effect_has_builder()

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 __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

must_be_same(klass)[source]

This node, which already existed, is being looked up as the specified klass. Raise an exception if it isn’t.

name
new_binfo()
new_ninfo()
ninfo
nocache
noclean
on_disk_entries
path
postprocess()

Clean up anything we don’t need to hang onto after we’ve been built.

precious
prepare()

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 implementation checks that explicit or implicit dependencies either exist or are derived, and initializes the BuildInfo structure that will hold the information about how this node is, uh, built.

(The existence of source files is checked separately by the Executor, which aggregates checks for all of the targets built by a specific action.)

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.

prerequisites
pseudo
push_to_cache()

Try to push a node into a cache

rdir()
ref_count
rel_path(other)

Return a path to “other” relative to this directory.

release_target_info()

Called just after this node has been marked up-to-date or was built completely.

This is where we try to release as many target node infos as possible for clean builds and update runs, in order to minimize the overall memory consumption.

By purging attributes that aren’t needed any longer after a Node (=File) got built, we don’t have to care that much how many KBytes a Node actually requires…as long as we free the memory shortly afterwards.

@see: built() and File.release_target_info()

released_target_info
remove()

Remove this Node: no-op by default.

render_include_tree()

Return a text representation, suitable for displaying to the user, of the include tree for the sources of this node.

rentry()
rentry_exists_on_disk(name)

Searches through the file/dir entries of the current and all its remote directories (repos), and returns True if a physical entry with the given name could be found. The local directory (self) gets searched first, so repositories take a lower precedence regarding the searching order.

@see entry_exists_on_disk

repositories
reset_executor()

Remove cached executor; forces recompute when needed.

retrieve_from_cache()

Try to retrieve the node’s content from a cache

This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in built().

Returns true if the node was successfully retrieved.

rexists()

Does this node exist locally or in a repository?

rfile()
root
rstr()

A Node.FS.Base object’s string representation is its path name.

sbuilder
scan()

Scan this node’s dependents for implicit dependencies.

scanner_key()

A directory does not get scanned.

scanner_paths
sconsign()

Return the .sconsign file info for this directory.

searched
select_scanner(scanner)

Selects a scanner for this Node.

This is a separate method so it can be overridden by Node subclasses (specifically, Node.FS.Dir) that must use their own Scanner and don’t select one the Scanner.Selector that’s configured for the target.

set_always_build(always_build=1)

Set the Node’s always_build value.

set_executor(executor)

Set the action executor for this node.

set_explicit(is_explicit)
set_local()
set_nocache(nocache=1)

Set the Node’s nocache value.

set_noclean(noclean=1)

Set the Node’s noclean value.

set_precious(precious=1)

Set the Node’s precious value.

set_pseudo(pseudo=True)

Set the Node’s precious value.

set_specific_source(source)
set_src_builder(builder)

Set the source code builder for this node.

set_state(state)
side_effect
side_effects
sources
sources_set
src_builder()[source]

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).

srcdir
srcdir_duplicate(name)
srcdir_find_file(filename)
srcdir_list()
srcnode()

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

stat()
state
store_info
str_for_display()
target_from_source(prefix, suffix, splitext=<function splitext>)

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.

target_peers
up()[source]
variant_dirs
visited()

Called just after this node has been visited (with or without a build).

waiting_parents
waiting_s_e
walk(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).

wkids
SCons.Node.FS.UnlinkFunc(target, source, env)[source]
class SCons.Node.FS._Null[source]

Bases: object

SCons.Node.FS._classEntry

alias of Entry

SCons.Node.FS._copy_func(fs, src, dest)[source]
SCons.Node.FS._my_normcase(x)[source]
SCons.Node.FS._my_splitdrive(p)
SCons.Node.FS.diskcheck_types()[source]
SCons.Node.FS.do_diskcheck_match(node, predicate, errorfmt)[source]
SCons.Node.FS.find_file(filename, paths, verbose=None)

Find a node corresponding to either a derived file or a file that exists already.

Only the first file found is returned, and none is returned if no file is found.

filename: A filename to find paths: A list of directory path nodes to search in. Can be represented as a list, a tuple, or a callable that is called with no arguments and returns the list or tuple.

returns The node created from the found file.

SCons.Node.FS.get_MkdirBuilder()[source]
SCons.Node.FS.get_default_fs()[source]
SCons.Node.FS.has_glob_magic(s)[source]
SCons.Node.FS.ignore_diskcheck_match(node, predicate, errorfmt)[source]
SCons.Node.FS.initialize_do_splitdrive()[source]
SCons.Node.FS.invalidate_node_memos(targets)[source]

Invalidate the memoized values of all Nodes (files or directories) that are associated with the given entries. Has been added to clear the cache of nodes affected by a direct execution of an action (e.g. Delete/Copy/Chmod). Existing Node caches become inconsistent if the action is run through Execute(). The argument targets can be a single Node object or filename, or a sequence of Nodes/filenames.

SCons.Node.FS.needs_normpath_match(string, pos=0, endpos=9223372036854775807)

Matches zero or more characters at the beginning of the string.

SCons.Node.FS.save_strings(val)[source]
SCons.Node.FS.sconsign_dir(node)[source]

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

SCons.Node.FS.sconsign_none(node)[source]
SCons.Node.FS.set_diskcheck(list)[source]
SCons.Node.FS.set_duplicate(duplicate)[source]

SCons.Node.Python module

Python nodes.

class SCons.Node.Python.Value(value, built_value=None, name=None)[source]

Bases: Node

A class for Python variables, typically passed on the command line or generated by a script, but not from a file or some other source.

class Attrs

Bases: object

shared
BuildInfo

alias of ValueBuildInfo

Decider(function)
GetTag(key)

Return a user-defined tag.

NodeInfo

alias of ValueNodeInfo

Tag(key, value)

Add a user-defined tag.

_add_child(collection, set, child)

Adds ‘child’ to ‘collection’, first checking ‘set’ to see if it’s already present.

_children_get()
_children_reset()
_func_exists
_func_get_contents
_func_is_derived
_func_rexists
_func_target_from_source
_get_scanner(env, initial_scanner, root_node_scanner, kw)
_memo
_specific_sources
_tags
add_dependency(depend)

Adds dependencies.

add_ignore(depend)

Adds dependencies to ignore.

add_prerequisite(prerequisite)

Adds prerequisites

add_source(source)

Adds sources.

add_to_implicit(deps)
add_to_waiting_parents(node)

Returns the number of nodes added to our waiting parents list: 1 if we add a unique waiting parent, 0 if not. (Note that the returned values are intended to be used to increment a reference count, so don’t think you can “clean up” this function by using True and False instead…)

add_to_waiting_s_e(node)
add_wkid(wkid)

Add a node to the list of kids waiting to be evaluated

all_children(scan=1)

Return a list of all the node’s direct children.

alter_targets()

Return a list of alternate targets for this Node.

always_build
attributes
binfo
build(**kw)[source]

Actually build the node.

This is called by the Taskmaster after it’s decided that the Node is out-of-date and must be rebuilt, and after the prepare() method has gotten everything, uh, prepared.

This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in built().

builder
builder_set(builder)
built()

Called just after this node is successfully built.

cached
changed(node=None, allowcache=False)

Returns if the node is up-to-date with respect to the BuildInfo stored last time it was built. The default behavior is to compare it against our own previously stored BuildInfo, but the stored BuildInfo from another Node (typically one in a Repository) can be used instead.

Note that we now always check every dependency. We used to short-circuit the check by returning as soon as we detected any difference, but we now rely on checking every dependency to make sure that any necessary Node information (for example, the content signature of an #included .h file) is updated.

The allowcache option was added for supporting the early release of the executor/builder structures, right after a File target was built. When set to true, the return value of this changed method gets cached for File nodes. Like this, the executor isn’t needed any longer for subsequent calls to changed().

@see: FS.File.changed(), FS.File.release_target_info()

changed_since_last_build
check_attributes(name)

Simple API to check if the node.attributes for name has been set

children(scan=1)

Return a list of the node’s direct children, minus those that are ignored by this node.

children_are_up_to_date()

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.

The SCons.Node.Alias and SCons.Node.Python.Value subclasses rebind their current() method to this method.

clear()

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()
del_binfo()

Delete the build info from this node.

depends
depends_set
disambiguate(must_exist=None)
env
env_set(env, safe=0)
executor
executor_cleanup()

Let the executor clean up any cached information.

exists()

Does this node exists?

explain()
for_signature()

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.

get_abspath()

Return an absolute path to the Node. This will return simply str(Node) by default, but for Node types that have a concept of relative path, this might return something different.

get_binfo()

Fetch a node’s build information.

node - the node whose sources will be collected cache - alternate node to use for the signature cache returns - the build signature

This no longer handles the recursive descent of the node’s children’s signatures. We expect that they’re already built and updated by someone else, if that’s what’s wanted.

get_build_env()

Fetch the appropriate Environment to build this node.

get_build_scanner_path(scanner)

Fetch the appropriate scanner path for this node.

get_builder(default_builder=None)

Return the set builder, or a specified default value

get_cachedir_csig()
get_contents() bytes[source]

Get contents for signature calculations.

get_csig(calc=None)[source]

Because we’re a Python value node and don’t have a real timestamp, we get to ignore the calculator and just use the value contents.

Returns string. Ideally string of hex digits. (Not bytes)

get_env()
get_env_scanner(env, kw={})
get_executor(create=1)

Fetch the action executor for this node. Create one if there isn’t already one, and requested to do so.

get_found_includes(env, scanner, path)

Return the scanned include lines (implicit dependencies) found in this node.

The default is no implicit dependencies. We expect this method to be overridden by any subclass that can be scanned for implicit dependencies.

get_implicit_deps(env, initial_scanner, path_func, kw={})

Return a list of implicit dependencies for this node.

This method exists to handle recursive invocation of the scanner on the implicit dependencies returned by the scanner, if the scanner’s recursive flag says that we should.

get_ninfo()
get_source_scanner(node)

Fetch the source scanner for the specified node

NOTE: “self” is the target being built, “node” is the source file for which we want to fetch the scanner.

Implies self.has_builder() is true; again, expect to only be called from locations where this is already verified.

This function may be called very often; it attempts to cache the scanner found to improve performance.

get_state()
get_stored_implicit()

Fetch the stored implicit dependencies

get_stored_info()
get_string(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.

Such command generators should use this method in preference to str(Node) when converting a Node to a string, passing in the for_signature parameter, such that we will call Node.for_signature() or str(Node) properly, depending on whether we are calculating a signature or actually constructing a command line.

get_subst_proxy()

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.

get_suffix()
get_target_scanner()
get_text_contents() str[source]

By the assumption that the node.built_value is a deterministic product of the sources, the contents of a Value are the concatenation of all the contents of its sources. As the value need not be built when get_contents() is called, we cannot use the actual node.built_value.

has_builder()

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 __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

has_explicit_builder()

Return whether this Node has an explicit builder

This allows an internal Builder created by SCons to be marked non-explicit, so that it can be overridden by an explicit builder that the user supplies (the canonical example being directories).

ignore
ignore_set
implicit
implicit_set
includes
is_conftest()

Returns true if this node is an conftest node

is_derived()

Returns true if this node is derived (i.e. built).

This should return true only for nodes whose path should be in the variant directory when duplicate=0 and should contribute their build signatures when they are used as source files to other derived files. For example: source with source builders are not derived in this sense, and hence should not return true.

is_explicit
is_literal()

Always pass the string representation of a Node to the command interpreter literally.

is_sconscript()

Returns true if this node is an sconscript

is_under(dir)[source]
is_up_to_date()

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.

The SCons.Node.Alias and SCons.Node.Python.Value subclasses rebind their current() method to this method.

linked
make_ready()[source]

Get a Node ready for evaluation.

This is called before the Taskmaster decides if the Node is up-to-date or not. Overriding this method allows for a Node subclass to be disambiguated if necessary, or for an implicit source builder to be attached.

missing()
multiple_side_effect_has_builder()

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 __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

new_binfo()
new_ninfo()
ninfo
nocache
noclean
postprocess()

Clean up anything we don’t need to hang onto after we’ve been built.

precious
prepare()

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 implementation checks that explicit or implicit dependencies either exist or are derived, and initializes the BuildInfo structure that will hold the information about how this node is, uh, built.

(The existence of source files is checked separately by the Executor, which aggregates checks for all of the targets built by a specific action.)

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.

prerequisites
pseudo
push_to_cache()

Try to push a node into a cache

read()[source]

Return the value. If necessary, the value is built.

ref_count
release_target_info()

Called just after this node has been marked up-to-date or was built completely.

This is where we try to release as many target node infos as possible for clean builds and update runs, in order to minimize the overall memory consumption.

By purging attributes that aren’t needed any longer after a Node (=File) got built, we don’t have to care that much how many KBytes a Node actually requires…as long as we free the memory shortly afterwards.

@see: built() and File.release_target_info()

remove()

Remove this Node: no-op by default.

render_include_tree()

Return a text representation, suitable for displaying to the user, of the include tree for the sources of this node.

reset_executor()

Remove cached executor; forces recompute when needed.

retrieve_from_cache()

Try to retrieve the node’s content from a cache

This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in built().

Returns true if the node was successfully retrieved.

rexists()

Does this node exist locally or in a repository?

scan()

Scan this node’s dependents for implicit dependencies.

scanner_key()
select_scanner(scanner)

Selects a scanner for this Node.

This is a separate method so it can be overridden by Node subclasses (specifically, Node.FS.Dir) that must use their own Scanner and don’t select one the Scanner.Selector that’s configured for the target.

set_always_build(always_build=1)

Set the Node’s always_build value.

set_executor(executor)

Set the action executor for this node.

set_explicit(is_explicit)
set_nocache(nocache=1)

Set the Node’s nocache value.

set_noclean(noclean=1)

Set the Node’s noclean value.

set_precious(precious=1)

Set the Node’s precious value.

set_pseudo(pseudo=True)

Set the Node’s precious value.

set_specific_source(source)
set_state(state)
side_effect
side_effects
sources
sources_set
state
store_info
str_for_display()[source]
target_peers
visited()

Called just after this node has been visited (with or without a build).

waiting_parents
waiting_s_e
wkids
write(built_value)[source]

Set the value of the node.

class SCons.Node.Python.ValueBuildInfo[source]

Bases: BuildInfoBase

bact
bactsig
bdepends
bdependsigs
bimplicit
bimplicitsigs
bsources
bsourcesigs
current_version_id = 2
merge(other)

Merge the fields of another object into this object. Already existing information is overwritten by the other instance’s data. WARNING: If a ‘__dict__’ slot is added, it should be updated instead of replaced.

class SCons.Node.Python.ValueNodeInfo[source]

Bases: NodeInfoBase

convert(node, val)
csig
current_version_id = 2
field_list = ['csig']
format(field_list=None, names=0)
merge(other)

Merge the fields of another object into this object. Already existing information is overwritten by the other instance’s data. WARNING: If a ‘__dict__’ slot is added, it should be updated instead of replaced.

str_to_node(s)[source]
update(node)
SCons.Node.Python.ValueWithMemo(value, built_value=None, name=None)[source]

Memoized Value() node factory.

Module contents

The Node package for the SCons software construction utility.

This is, in many ways, the heart of SCons.

A Node is where we encapsulate all of the dependency information about any thing that SCons can build, or about any thing which SCons can use to build some other thing. The canonical “thing,” of course, is a file, but a Node can also represent something remote (like a web page) or something completely abstract (like an Alias).

Each specific type of “thing” is specifically represented by a subclass of the Node base class: Node.FS.File for files, Node.Alias for aliases, etc. Dependency information is kept here in the base class, and information specific to files/aliases/etc. is in the subclass. The goal, if we’ve done this correctly, is that any type of “thing” should be able to depend on any other type of “thing.”

SCons.Node.Annotate(node)
class SCons.Node.BuildInfoBase[source]

Bases: object

The generic base class for build information for a Node.

This is what gets stored in a .sconsign file for each target file. It contains a NodeInfo instance for this node (signature information that’s specific to the type of Node) and direct attributes for the generic build stuff we have to track: sources, explicit dependencies, implicit dependencies, and action information.

bact
bactsig
bdepends
bdependsigs
bimplicit
bimplicitsigs
bsources
bsourcesigs
current_version_id = 2
merge(other)[source]

Merge the fields of another object into this object. Already existing information is overwritten by the other instance’s data. WARNING: If a ‘__dict__’ slot is added, it should be updated instead of replaced.

class SCons.Node.Node[source]

Bases: object

The base Node class, for entities that we know how to build, or use to build other Nodes.

class Attrs[source]

Bases: object

shared
BuildInfo

alias of BuildInfoBase

Decider(function)[source]
GetTag(key)[source]

Return a user-defined tag.

NodeInfo

alias of NodeInfoBase

Tag(key, value)[source]

Add a user-defined tag.

_add_child(collection, set, child)[source]

Adds ‘child’ to ‘collection’, first checking ‘set’ to see if it’s already present.

_children_get()[source]
_children_reset()[source]
_func_exists
_func_get_contents
_func_is_derived
_func_rexists
_func_target_from_source
_get_scanner(env, initial_scanner, root_node_scanner, kw)[source]
_memo
_specific_sources
_tags
add_dependency(depend)[source]

Adds dependencies.

add_ignore(depend)[source]

Adds dependencies to ignore.

add_prerequisite(prerequisite)[source]

Adds prerequisites

add_source(source)[source]

Adds sources.

add_to_implicit(deps)[source]
add_to_waiting_parents(node)[source]

Returns the number of nodes added to our waiting parents list: 1 if we add a unique waiting parent, 0 if not. (Note that the returned values are intended to be used to increment a reference count, so don’t think you can “clean up” this function by using True and False instead…)

add_to_waiting_s_e(node)[source]
add_wkid(wkid)[source]

Add a node to the list of kids waiting to be evaluated

all_children(scan=1)[source]

Return a list of all the node’s direct children.

alter_targets()[source]

Return a list of alternate targets for this Node.

always_build
attributes
binfo
build(**kw)[source]

Actually build the node.

This is called by the Taskmaster after it’s decided that the Node is out-of-date and must be rebuilt, and after the prepare() method has gotten everything, uh, prepared.

This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in built().

builder
builder_set(builder)[source]
built()[source]

Called just after this node is successfully built.

cached
changed(node=None, allowcache=False)[source]

Returns if the node is up-to-date with respect to the BuildInfo stored last time it was built. The default behavior is to compare it against our own previously stored BuildInfo, but the stored BuildInfo from another Node (typically one in a Repository) can be used instead.

Note that we now always check every dependency. We used to short-circuit the check by returning as soon as we detected any difference, but we now rely on checking every dependency to make sure that any necessary Node information (for example, the content signature of an #included .h file) is updated.

The allowcache option was added for supporting the early release of the executor/builder structures, right after a File target was built. When set to true, the return value of this changed method gets cached for File nodes. Like this, the executor isn’t needed any longer for subsequent calls to changed().

@see: FS.File.changed(), FS.File.release_target_info()

changed_since_last_build
check_attributes(name)[source]

Simple API to check if the node.attributes for name has been set

children(scan=1)[source]

Return a list of the node’s direct children, minus those that are ignored by this node.

children_are_up_to_date()[source]

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.

The SCons.Node.Alias and SCons.Node.Python.Value subclasses rebind their current() method to this method.

clear()[source]

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()[source]
del_binfo()[source]

Delete the build info from this node.

depends
depends_set
disambiguate(must_exist=None)[source]
env
env_set(env, safe=0)[source]
executor
executor_cleanup()[source]

Let the executor clean up any cached information.

exists()[source]

Does this node exists?

explain()[source]
for_signature()[source]

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.

get_abspath()[source]

Return an absolute path to the Node. This will return simply str(Node) by default, but for Node types that have a concept of relative path, this might return something different.

get_binfo()[source]

Fetch a node’s build information.

node - the node whose sources will be collected cache - alternate node to use for the signature cache returns - the build signature

This no longer handles the recursive descent of the node’s children’s signatures. We expect that they’re already built and updated by someone else, if that’s what’s wanted.

get_build_env()[source]

Fetch the appropriate Environment to build this node.

get_build_scanner_path(scanner)[source]

Fetch the appropriate scanner path for this node.

get_builder(default_builder=None)[source]

Return the set builder, or a specified default value

get_cachedir_csig()[source]
get_contents()[source]

Fetch the contents of the entry.

get_csig()[source]
get_env()[source]
get_env_scanner(env, kw={})[source]
get_executor(create=1)[source]

Fetch the action executor for this node. Create one if there isn’t already one, and requested to do so.

get_found_includes(env, scanner, path)[source]

Return the scanned include lines (implicit dependencies) found in this node.

The default is no implicit dependencies. We expect this method to be overridden by any subclass that can be scanned for implicit dependencies.

get_implicit_deps(env, initial_scanner, path_func, kw={})[source]

Return a list of implicit dependencies for this node.

This method exists to handle recursive invocation of the scanner on the implicit dependencies returned by the scanner, if the scanner’s recursive flag says that we should.

get_ninfo()[source]
get_source_scanner(node)[source]

Fetch the source scanner for the specified node

NOTE: “self” is the target being built, “node” is the source file for which we want to fetch the scanner.

Implies self.has_builder() is true; again, expect to only be called from locations where this is already verified.

This function may be called very often; it attempts to cache the scanner found to improve performance.

get_state()[source]
get_stored_implicit()[source]

Fetch the stored implicit dependencies

get_stored_info()[source]
get_string(for_signature)[source]

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.

Such command generators should use this method in preference to str(Node) when converting a Node to a string, passing in the for_signature parameter, such that we will call Node.for_signature() or str(Node) properly, depending on whether we are calculating a signature or actually constructing a command line.

get_subst_proxy()[source]

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.

get_suffix()[source]
get_target_scanner()[source]
has_builder()[source]

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 __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

has_explicit_builder()[source]

Return whether this Node has an explicit builder

This allows an internal Builder created by SCons to be marked non-explicit, so that it can be overridden by an explicit builder that the user supplies (the canonical example being directories).

ignore
ignore_set
implicit
implicit_set
includes
is_conftest()[source]

Returns true if this node is an conftest node

is_derived()[source]

Returns true if this node is derived (i.e. built).

This should return true only for nodes whose path should be in the variant directory when duplicate=0 and should contribute their build signatures when they are used as source files to other derived files. For example: source with source builders are not derived in this sense, and hence should not return true.

is_explicit
is_literal()[source]

Always pass the string representation of a Node to the command interpreter literally.

is_sconscript()[source]

Returns true if this node is an sconscript

is_up_to_date()[source]

Default check for whether the Node is current: unknown Node subtypes are always out of date, so they will always get built.

linked
make_ready()[source]

Get a Node ready for evaluation.

This is called before the Taskmaster decides if the Node is up-to-date or not. Overriding this method allows for a Node subclass to be disambiguated if necessary, or for an implicit source builder to be attached.

missing()[source]
multiple_side_effect_has_builder()

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 __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.

new_binfo()[source]
new_ninfo()[source]
ninfo
nocache
noclean
postprocess()[source]

Clean up anything we don’t need to hang onto after we’ve been built.

precious
prepare()[source]

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 implementation checks that explicit or implicit dependencies either exist or are derived, and initializes the BuildInfo structure that will hold the information about how this node is, uh, built.

(The existence of source files is checked separately by the Executor, which aggregates checks for all of the targets built by a specific action.)

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.

prerequisites
pseudo
push_to_cache()[source]

Try to push a node into a cache

ref_count
release_target_info()[source]

Called just after this node has been marked up-to-date or was built completely.

This is where we try to release as many target node infos as possible for clean builds and update runs, in order to minimize the overall memory consumption.

By purging attributes that aren’t needed any longer after a Node (=File) got built, we don’t have to care that much how many KBytes a Node actually requires…as long as we free the memory shortly afterwards.

@see: built() and File.release_target_info()

remove()[source]

Remove this Node: no-op by default.

render_include_tree()[source]

Return a text representation, suitable for displaying to the user, of the include tree for the sources of this node.

reset_executor()[source]

Remove cached executor; forces recompute when needed.

retrieve_from_cache()[source]

Try to retrieve the node’s content from a cache

This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in built().

Returns true if the node was successfully retrieved.

rexists()[source]

Does this node exist locally or in a repository?

scan()[source]

Scan this node’s dependents for implicit dependencies.

scanner_key()[source]
select_scanner(scanner)[source]

Selects a scanner for this Node.

This is a separate method so it can be overridden by Node subclasses (specifically, Node.FS.Dir) that must use their own Scanner and don’t select one the Scanner.Selector that’s configured for the target.

set_always_build(always_build=1)[source]

Set the Node’s always_build value.

set_executor(executor)[source]

Set the action executor for this node.

set_explicit(is_explicit)[source]
set_nocache(nocache=1)[source]

Set the Node’s nocache value.

set_noclean(noclean=1)[source]

Set the Node’s noclean value.

set_precious(precious=1)[source]

Set the Node’s precious value.

set_pseudo(pseudo=True)[source]

Set the Node’s precious value.

set_specific_source(source)[source]
set_state(state)[source]
side_effect
side_effects
sources
sources_set
state
store_info
target_peers
visited()[source]

Called just after this node has been visited (with or without a build).

waiting_parents
waiting_s_e
wkids
class SCons.Node.NodeInfoBase[source]

Bases: object

The generic base class for signature information for a Node.

Node subclasses should subclass NodeInfoBase to provide their own logic for dealing with their own Node-specific signature information.

convert(node, val)[source]
current_version_id = 2
format(field_list=None, names=0)[source]
merge(other)[source]

Merge the fields of another object into this object. Already existing information is overwritten by the other instance’s data. WARNING: If a ‘__dict__’ slot is added, it should be updated instead of replaced.

update(node)[source]
class SCons.Node.NodeList(initlist=None)[source]

Bases: UserList

_abc_impl = <_abc_data object>
append(item)

S.append(value) – append value to the end of the sequence

clear() None -- remove all items from S
copy()
count(value) integer -- return number of occurrences of value
extend(other)

S.extend(iterable) – extend sequence by appending elements from the iterable

index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

insert(i, item)

S.insert(index, value) – insert value before index

pop([index]) item -- remove and return item at index (default last).

Raise IndexError if list is empty or index is out of range.

remove(item)

S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.

reverse()

S.reverse() – reverse IN PLACE

sort(*args, **kwds)
class SCons.Node.Walker(node, kids_func=<function get_children>, cycle_func=<function ignore_cycle>, eval_func=<function do_nothing>)[source]

Bases: object

An iterator for walking a Node tree.

This is depth-first, children are visited before the parent. The Walker object can be initialized with any node, and returns the next node on the descent with each get_next() call. get the children of a node instead of calling ‘children’. ‘cycle_func’ is an optional function that will be called when a cycle is detected.

This class does not get caught in node cycles caused, for example, by C header file include loops.

get_next()[source]

Return the next node for this walk of the tree.

This function is intentionally iterative, not recursive, to sidestep any issues of stack size limitations.

is_done()[source]
SCons.Node.changed_since_last_build_alias(node, target, prev_ni, repo_node=None)[source]
SCons.Node.changed_since_last_build_entry(node, target, prev_ni, repo_node=None)[source]
SCons.Node.changed_since_last_build_node(node, target, prev_ni, repo_node=None)[source]

Must be overridden in a specific subclass to return True if this Node (a dependency) has changed since the last time it was used to build the specified target. prev_ni is this Node’s state (for example, its file timestamp, length, maybe content signature) as of the last time the target was built.

Note that this method is called through the dependency, not the target, because a dependency Node must be able to use its own logic to decide if it changed. For example, File Nodes need to obey if we’re configured to use timestamps, but Python Value Nodes never use timestamps and always use the content. If this method were called through the target, then each Node’s implementation of this method would have to have more complicated logic to handle all the different Node types on which it might depend.

SCons.Node.changed_since_last_build_python(node, target, prev_ni, repo_node=None)[source]
SCons.Node.changed_since_last_build_state_changed(node, target, prev_ni, repo_node=None)[source]
SCons.Node.classname(obj)[source]
SCons.Node.decide_source(node, target, prev_ni, repo_node=None)[source]
SCons.Node.decide_target(node, target, prev_ni, repo_node=None)[source]
SCons.Node.do_nothing(node, parent)[source]
SCons.Node.do_nothing_node(node)[source]
SCons.Node.exists_always(node)[source]
SCons.Node.exists_base(node)[source]
SCons.Node.exists_entry(node)[source]

Return if the Entry exists. Check the file system to see what we should turn into first. Assume a file if there’s no directory.

SCons.Node.exists_file(node)[source]
SCons.Node.exists_none(node)[source]
SCons.Node.get_children(node, parent)[source]
SCons.Node.get_contents_dir(node)[source]

Return content signatures and names of all our children separated by new-lines. Ensure that the nodes are sorted.

SCons.Node.get_contents_entry(node)[source]

Fetch the contents of the entry. Returns the exact binary contents of the file.

SCons.Node.get_contents_file(node)[source]
SCons.Node.get_contents_none(node)[source]
SCons.Node.ignore_cycle(node, stack)[source]
SCons.Node.is_derived_node(node)[source]

Returns true if this node is derived (i.e. built).

SCons.Node.is_derived_none(node)[source]
SCons.Node.rexists_base(node)[source]
SCons.Node.rexists_node(node)[source]
SCons.Node.rexists_none(node)[source]
SCons.Node.store_info_file(node)[source]
SCons.Node.store_info_pass(node)[source]
SCons.Node.target_from_source_base(node, prefix, suffix, splitext)[source]
SCons.Node.target_from_source_none(node, prefix, suffix, splitext)[source]