SCons.Node package

Contents

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) None#
GetTag(key)#

Return a user-defined tag.

NodeInfo#

alias of AliasNodeInfo

Tag(key, value) None#

Add a user-defined tag.

_add_child(collection, set, child) None#

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

_children_get()#
_children_reset() None#
_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) None#

Adds prerequisites

add_source(source)#

Adds sources.

add_to_implicit(deps) None#
add_to_waiting_parents(node) int#

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) None#
add_wkid(wkid) None#

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

all_children(scan: int = 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() None[source]#

A “builder” for aliases.

builder#
builder_set(builder) None#
built() None#

Called just after this node is successfully built.

cached#
changed(node=None, allowcache: bool = 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: int = 1)#

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

children_are_up_to_date() bool#

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() None#

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

Delete the build info from this node.

depends#
depends_set#
disambiguate(must_exist=None)#
env#
env_set(env, safe: bool = False) None#
executor#
executor_cleanup() None#

Let the executor clean up any cached information.

exists() bool#

Reports whether 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: int = 1) Executor#

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() str#
get_target_scanner()#
has_builder() bool#

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() bool#

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() bool#

Returns true if this node is an conftest node

is_derived() bool#

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() bool#

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

is_sconscript() bool#

Returns true if this node is an sconscript

is_under(dir) bool[source]#
is_up_to_date() bool#

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() None[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() bool#
multiple_side_effect_has_builder() bool#

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() None#

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() None#

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() None#

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() None#

Remove cached executor; forces recompute when needed.

retrieve_from_cache() bool#

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() None#

Scan this node’s dependents for implicit dependencies.

scanner_key()#
sconsign() None[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: int = 1) None#

Set the Node’s always_build value.

set_executor(executor: Executor) None#

Set the action executor for this node.

set_explicit(is_explicit) None#
set_nocache(nocache: int = 1) None#

Set the Node’s nocache value.

set_noclean(noclean: int = 1) None#

Set the Node’s noclean value.

set_precious(precious: int = 1) None#

Set the Node’s precious value.

set_pseudo(pseudo: bool = True) None#

Set the Node’s pseudo value.

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

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

__getstate__()#

Return all fields that shall be pickled. Walk the slots in the class hierarchy and add those to the state dictionary. If a ‘__dict__’ slot is available, copy all entries to the dictionary. Also include the version id, which is fixed for all instances of a class.

__setstate__(state) None#

Restore the attributes from a pickled state.

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

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(dict=None, /, **kwargs)[source]#

Bases: UserDict

Alias(name, **kw)[source]#
_abc_impl = <_abc._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

__getstate__()[source]#

Return all fields that shall be pickled. Walk the slots in the class hierarchy and add those to the state dictionary. If a ‘__dict__’ slot is available, copy all entries to the dictionary. Also include the version id, which is fixed for all instances of a class.

__setstate__(state) None[source]#

Restore the attributes from a pickled state.

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

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) None#

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) None#
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) None#

Add a user-defined tag.

_Rfindalldirs_key(pathlist)[source]#
__getattr__(attr)[source]#

Together with the node_bwcomp dict defined below, this method provides a simple backward compatibility layer for the Node attributes ‘abspath’, ‘labspath’, ‘path’, ‘tpath’, ‘suffix’ and ‘path_elements’. These Node attributes used to be directly available in v2.3 and earlier, but have been replaced by getter methods that initialize the single variables lazily when required, in order to save memory. The redirection to the getters lets older Tools and SConstruct continue to work without any additional changes, fully transparent to the user. Note, that __getattr__ is only called as fallback when the requested attribute can’t be found, so there should be no speed performance penalty involved for standard builds.

__lt__(other)[source]#

less than operator used by sorting on py3

__str__() str[source]#

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

_abspath#
_add_child(collection, set, child) None#

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

_children_get()#
_children_reset() None#
_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: bool = True, source: bool = False, strings: bool = 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) None#

Adds prerequisites

add_source(source)#

Adds sources.

add_to_implicit(deps) None#
add_to_waiting_parents(node) int#

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) None#
add_wkid(wkid) None#

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

all_children(scan: int = 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) None#
built() None#

Called just after this node is successfully built.

cached#
changed(node=None, allowcache: bool = 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: int = 1)#

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

children_are_up_to_date() bool#

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() None#

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

Delete the build info from this node.

depends#
depends_set#
dir#
disambiguate(must_exist=None)#
duplicate#
env#
env_set(env, safe: bool = False) None#
executor#
executor_cleanup() None#

Let the executor clean up any cached information.

exists()[source]#

Reports whether 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: int = 1) Executor#

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() bool#

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() bool#

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() bool#

Returns true if this node is an conftest node

is_derived() bool#

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() bool#

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

is_sconscript() bool#

Returns true if this node is an sconscript

is_under(dir) bool[source]#
is_up_to_date() bool#

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

isdir() bool[source]#
isfile() bool[source]#
linked#
lstat()[source]#
make_ready() None#

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() bool#
multiple_side_effect_has_builder() bool#

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() None#

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() None#

Try to push a node into a cache

ref_count#
release_target_info() None#

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() None#

Remove cached executor; forces recompute when needed.

retrieve_from_cache() bool#

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() str#

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

sbuilder#
scan() None#

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: int = 1) None#

Set the Node’s always_build value.

set_executor(executor: Executor) None#

Set the action executor for this node.

set_explicit(is_explicit) None#
set_local() None[source]#
set_nocache(nocache: int = 1) None#

Set the Node’s nocache value.

set_noclean(noclean: int = 1) None#

Set the Node’s noclean value.

set_precious(precious: int = 1) None#

Set the Node’s precious value.

set_pseudo(pseudo: bool = True) None#

Set the Node’s pseudo value.

set_specific_source(source) None#
set_src_builder(builder) None[source]#

Set the source code builder for this node.

set_state(state) None#
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() None#

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) None#
Dir(name, create: bool = 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) None#

Add a user-defined tag.

_Rfindalldirs_key(pathlist)#
__clearRepositoryCache(duplicate=None) None#

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

__getattr__(attr)#

Together with the node_bwcomp dict defined below, this method provides a simple backward compatibility layer for the Node attributes ‘abspath’, ‘labspath’, ‘path’, ‘tpath’, ‘suffix’ and ‘path_elements’. These Node attributes used to be directly available in v2.3 and earlier, but have been replaced by getter methods that initialize the single variables lazily when required, in order to save memory. The redirection to the getters lets older Tools and SConstruct continue to work without any additional changes, fully transparent to the user. Note, that __getattr__ is only called as fallback when the requested attribute can’t be found, so there should be no speed performance penalty involved for standard builds.

__lt__(other)#

less than operator used by sorting on py3

__resetDuplicate(node) None#
__str__() str#

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

_abspath#
_add_child(collection, set, child) None#

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

_children_get()#
_children_reset() None#
_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: bool = True, source: bool = False, strings: bool = 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. Python’s glob.glob uses a separate _glob0 function to do this.

_labspath#
_local#
_memo#
_morph() None[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) None[source]#
add_dependency(depend)#

Adds dependencies.

add_ignore(depend)#

Adds dependencies to ignore.

add_prerequisite(prerequisite) None#

Adds prerequisites

add_source(source)#

Adds sources.

add_to_implicit(deps) None#
add_to_waiting_parents(node) int#

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) None#
add_wkid(wkid) None#

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

all_children(scan: int = 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) None[source]#

A null “builder” for directories.

builder#
builder_set(builder) None#
built() None#

Called just after this node is successfully built.

cached#
cachedir_csig#
cachesig#
changed(node=None, allowcache: bool = 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: int = 1)#

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

children_are_up_to_date() bool#

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() None#

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

Delete the build info from this node.

depends#
depends_set#
dir#
dir_on_disk(name)[source]#
dirname#
disambiguate(must_exist=None)#
diskcheck_match() None[source]#
do_duplicate(src) None[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: bool = False) None#
executor#
executor_cleanup() None#

Let the executor clean up any cached information.

exists()#

Reports whether 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: int = 1) Executor#

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: bool = True, source: bool = False, strings: bool = False, exclude=None) list[source]#

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

Pathname patterns follow POSIX shell syntax:

*      matches everything
?      matches any single character
[seq]  matches any character in seq (ranges allowed)
[!seq] matches any char not in seq

The wildcard characters can be escaped by enclosing in brackets. A leading dot is not matched by a wildcard, and needs to be explicitly included in the pattern to be matched. Matches also do not span directory separators.

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

The underlying algorithm is adapted from a rather old version of glob.glob() function in the Python standard library (heavily modified), and uses fnmatch.fnmatch() under the covers.

This is the internal implementation of the external Glob API.

Parameters:
  • pattern – pathname pattern to match.

  • ondisk – if false, restricts matches to in-memory Nodes. By defafult, matches entries that exist on-disk in addition to in-memory Nodes.

  • source – if true, corresponding source Nodes are returned if globbing in a variant directory. The default behavior is to return Nodes local to the variant directory.

  • strings – if true, returns the matches as strings instead of Nodes. The strings are path names relative to this directory.

  • exclude – if not None, must be a pattern or a list of patterns following the same POSIX shell semantics. Elements matching at least one pattern from exclude will be excluded from the result.

has_builder() bool#

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() bool#

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() bool#

Returns true if this node is an conftest node

is_derived() bool#

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() bool#

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

is_sconscript() bool#

Returns true if this node is an sconscript

is_under(dir) bool#
is_up_to_date() bool[source]#

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

isdir() bool#
isfile() bool#

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

linked#
lstat()#
make_ready() None#

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() bool#
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() None#

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

precious#
prepare() None[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() None#

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() None#

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() None#

Remove cached executor; forces recompute when needed.

retrieve_from_cache() bool#

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() str#

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

sbuilder#
scan() None#

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: int = 1) None#

Set the Node’s always_build value.

set_executor(executor: Executor) None#

Set the action executor for this node.

set_explicit(is_explicit) None#
set_local() None#
set_nocache(nocache: int = 1) None#

Set the Node’s nocache value.

set_noclean(noclean: int = 1) None#

Set the Node’s noclean value.

set_precious(precious: int = 1) None#

Set the Node’s precious value.

set_pseudo(pseudo: bool = True) None#

Set the Node’s pseudo value.

set_specific_source(source) None#
set_src_builder(builder) None#

Set the source code builder for this node.

set_state(state) None#
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() None#

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

waiting_parents#
waiting_s_e#
walk(func, arg) None[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

__getstate__()#

Return all fields that shall be pickled. Walk the slots in the class hierarchy and add those to the state dictionary. If a ‘__dict__’ slot is available, copy all entries to the dictionary. Also include the version id, which is fixed for all instances of a class.

__setstate__(state) None#

Restore the attributes from a pickled state.

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

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

__getstate__()#

Return all fields that shall be pickled. Walk the slots in the class hierarchy and add those to the state dictionary. If a ‘__dict__’ slot is available, copy all entries to the dictionary. Also include the version id, which is fixed for all instances of a class.

__setstate__(state) None#

Restore the attributes from a pickled state. The version is discarded.

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

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) None#
class SCons.Node.FS.DiskChecker(disk_check_type, do_check_function, ignore_check_function)[source]#

Bases: object

Implement disk check variation.

This Class will hold functions to determine what this particular disk checking implementation should do when enabled or disabled.

enable(disk_check_type_list) None[source]#

If the current object’s disk_check_type matches any in the list passed :param disk_check_type_list: List of disk checks to enable :return:

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) None#
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) None#

Add a user-defined tag.

_Rfindalldirs_key(pathlist)#
__getattr__(attr)#

Together with the node_bwcomp dict defined below, this method provides a simple backward compatibility layer for the Node attributes ‘abspath’, ‘labspath’, ‘path’, ‘tpath’, ‘suffix’ and ‘path_elements’. These Node attributes used to be directly available in v2.3 and earlier, but have been replaced by getter methods that initialize the single variables lazily when required, in order to save memory. The redirection to the getters lets older Tools and SConstruct continue to work without any additional changes, fully transparent to the user. Note, that __getattr__ is only called as fallback when the requested attribute can’t be found, so there should be no speed performance penalty involved for standard builds.

__lt__(other)#

less than operator used by sorting on py3

__str__() str#

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

_abspath#
_add_child(collection, set, child) None#

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

_children_get()#
_children_reset() None#
_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: bool = True, source: bool = False, strings: bool = 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) None#

Adds prerequisites

add_source(source)#

Adds sources.

add_to_implicit(deps) None#
add_to_waiting_parents(node) int#

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) None#
add_wkid(wkid) None#

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

all_children(scan: int = 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) None#
built() None#

Called just after this node is successfully built.

cached#
cachedir_csig#
cachesig#
changed(node=None, allowcache: bool = 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: int = 1)#

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

children_are_up_to_date() bool#

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() None#

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

Delete the build info from this node.

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

Let the executor clean up any cached information.

exists()[source]#

Reports whether 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: int = 1) Executor#

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() str[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() bool#

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() bool#

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() bool#

Returns true if this node is an conftest node

is_derived() bool#

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() bool#

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

is_sconscript() bool#

Returns true if this node is an sconscript

is_under(dir) bool#
is_up_to_date() bool#

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

isdir() bool#
isfile() bool#
linked#
lstat()#
make_ready() None#

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() bool#
multiple_side_effect_has_builder() bool#

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) None[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() None#

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() None#

Try to push a node into a cache

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

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() None#

Remove cached executor; forces recompute when needed.

retrieve_from_cache() bool#

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() str#

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

sbuilder#
scan() None#

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: int = 1) None#

Set the Node’s always_build value.

set_executor(executor: Executor) None#

Set the action executor for this node.

set_explicit(is_explicit) None#
set_local() None#
set_nocache(nocache: int = 1) None#

Set the Node’s nocache value.

set_noclean(noclean: int = 1) None#

Set the Node’s noclean value.

set_precious(precious: int = 1) None#

Set the Node’s precious value.

set_pseudo(pseudo: bool = True) None#

Set the Node’s pseudo value.

set_specific_source(source) None#
set_src_builder(builder) None#

Set the source code builder for this node.

set_state(state) None#
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() None#

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.

add_note()#

Exception.add_note(note) – add a note to the exception

args#
name#

attribute name

obj#

object

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: bool = 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: bool = True)[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: bool = True)[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: bool = True, source: bool = True, strings: bool = False, exclude=None, cwd=None)[source]#

Globs

This is mainly a shim layer

PyPackageDir(modulename) Dir | None[source]#

Locate the directory of Python module modulename.

For example ‘SCons’ might resolve to Windows: C:Python311Libsite-packagesSCons Linux: /usr/lib64/python3.11/site-packages/SCons

Can be used to determine a toolpath based on a Python module name.

This is the backend called by the public API function PyPackageDir().

Repository(*dirs) None[source]#

Specify Repository directories to search.

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

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

_lookup(p, directory, fsclass, create: bool = True)[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: bool = False)[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) bool#
isfile(path) bool#
listdir(path)#
lstat(path)#
makedirs(path, mode: int = 511, exist_ok: bool = False)#
mkdir(path, mode: int = 511)#
open(path)#
rename(old, new)#
scandir(path)#
set_SConstruct_dir(dir) None[source]#
set_max_drift(max_drift) None[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) None#
Dir(name, create: bool = 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) None#

Add a user-defined tag.

_Rfindalldirs_key(pathlist)#
__dmap_cache = {}#
__dmap_sig_cache = {}#
__getattr__(attr)#

Together with the node_bwcomp dict defined below, this method provides a simple backward compatibility layer for the Node attributes ‘abspath’, ‘labspath’, ‘path’, ‘tpath’, ‘suffix’ and ‘path_elements’. These Node attributes used to be directly available in v2.3 and earlier, but have been replaced by getter methods that initialize the single variables lazily when required, in order to save memory. The redirection to the getters lets older Tools and SConstruct continue to work without any additional changes, fully transparent to the user. Note, that __getattr__ is only called as fallback when the requested attribute can’t be found, so there should be no speed performance penalty involved for standard builds.

__lt__(other)#

less than operator used by sorting on py3

__str__() str#

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

_abspath#
_add_child(collection, set, child) None#

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() None#
_createDir() None[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: bool = True, source: bool = False, strings: bool = False)#
_labspath#
_local#
_memo#
_morph() None[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) None#

Adds prerequisites

add_source(source)#

Adds sources.

add_to_implicit(deps) None#
add_to_waiting_parents(node) int#

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) None#
add_wkid(wkid) None#

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

all_children(scan: int = 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) None[source]#
built() None[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: bool = False) bool[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) bool[source]#
changed_since_last_build#
changed_state(target, prev_ni, repo_node=None) bool[source]#
changed_timestamp_match(target, prev_ni, repo_node=None) bool[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) bool[source]#
changed_timestamp_then_content(target, prev_ni, node=None) bool[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: SCons/scons#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: int = 1)#

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

children_are_up_to_date() bool#

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() None#

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() None#
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() None#

Delete the build info from this node.

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

Let the executor clean up any cached information.

exists()[source]#

Reports whether 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: int = 1) Executor#

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() str | None[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 as text.

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

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() bool#

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() bool[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() bool#

Returns true if this node is an conftest node

is_derived() bool#

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() bool#

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

is_sconscript() bool#

Returns true if this node is an sconscript

is_under(dir) bool#
is_up_to_date() bool[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() bool#
isfile() bool#
linked#
lstat()#
make_ready() None[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() bool#
multiple_side_effect_has_builder() bool#

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() None#

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

Try to push the node into a cache

ref_count#
rel_path(other)[source]#
release_target_info() None[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() None#

Remove cached executor; forces recompute when needed.

retrieve_from_cache() bool[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() None#

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: int = 1) None#

Set the Node’s always_build value.

set_executor(executor: Executor) None#

Set the action executor for this node.

set_explicit(is_explicit) None#
set_local() None#
set_nocache(nocache: int = 1) None#

Set the Node’s nocache value.

set_noclean(noclean: int = 1) None#

Set the Node’s noclean value.

set_precious(precious: int = 1) None#

Set the Node’s precious value.

set_pseudo(pseudo: bool = True) None#

Set the Node’s pseudo value.

set_specific_source(source) None#
set_src_builder(builder) None#

Set the source code builder for this node.

set_state(state) None#
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() None[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

__getstate__()#

Return all fields that shall be pickled. Walk the slots in the class hierarchy and add those to the state dictionary. If a ‘__dict__’ slot is available, copy all entries to the dictionary. Also include the version id, which is fixed for all instances of a class.

__setstate__(state) None#

Restore the attributes from a pickled state.

bact#
bactsig#
bdepends#
bdependsigs#
bimplicit#
bimplicitsigs#
bsources#
bsourcesigs#
convert_from_sconsign(dir, name) None[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() None[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: int = 0)[source]#
merge(other) None#

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() None[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