SCons.Node package#
Module contents#
The Node package for the SCons software construction utility.
This is, in many ways, the heart of SCons.
A Node is where we encapsulate all of the dependency information about any thing that SCons can build, or about any thing which SCons can use to build some other thing. The canonical “thing,” of course, is a file, but a Node can also represent something remote (like a web page) or something completely abstract (like an Alias).
Each specific type of “thing” is specifically represented by a subclass of the Node base class: Node.FS.File for files, Node.Alias for aliases, etc. Dependency information is kept here in the base class, and information specific to files/aliases/etc. is in the subclass. The goal, if we’ve done this correctly, is that any type of “thing” should be able to depend on any other type of “thing.”
- SCons.Node.Annotate(node) None #
- class SCons.Node.BuildInfoBase[source]#
Bases:
object
The generic base class for build information for a Node.
This is what gets stored in a .sconsign file for each target file. It contains a NodeInfo instance for this node (signature information that’s specific to the type of Node) and direct attributes for the generic build stuff we have to track: sources, explicit dependencies, implicit dependencies, and action information.
- __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.
- bact#
- bactsig#
- bdepends#
- bdependsigs#
- bimplicit#
- bimplicitsigs#
- bsources#
- bsourcesigs#
- current_version_id = 2#
- class SCons.Node.Node[source]#
Bases:
object
The base Node class, for entities that we know how to build, or use to build other Nodes.
- BuildInfo#
alias of
BuildInfoBase
- NodeInfo#
alias of
NodeInfoBase
- _add_child(collection, set, child) None [source]#
Adds ‘child’ to ‘collection’, first checking ‘set’ to see if it’s already present.
- _func_exists#
- _func_get_contents#
- _func_is_derived#
- _func_rexists#
- _func_target_from_source#
- _memo#
- _specific_sources#
- _tags#
- add_to_waiting_parents(node) int [source]#
Returns the number of nodes added to our waiting parents list: 1 if we add a unique waiting parent, 0 if not. (Note that the returned values are intended to be used to increment a reference count, so don’t think you can “clean up” this function by using True and False instead…)
- always_build#
- attributes#
- binfo#
- build(**kw)[source]#
Actually build the node.
This is called by the Taskmaster after it’s decided that the Node is out-of-date and must be rebuilt, and after the
prepare()
method has gotten everything, uh, prepared.This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in
built()
.
- builder#
- cached#
- changed(node=None, allowcache: bool = False)[source]#
Returns if the node is up-to-date with respect to the BuildInfo stored last time it was built. The default behavior is to compare it against our own previously stored BuildInfo, but the stored BuildInfo from another Node (typically one in a Repository) can be used instead.
Note that we now always check every dependency. We used to short-circuit the check by returning as soon as we detected any difference, but we now rely on checking every dependency to make sure that any necessary Node information (for example, the content signature of an #included .h file) is updated.
The allowcache option was added for supporting the early release of the executor/builder structures, right after a File target was built. When set to true, the return value of this changed method gets cached for File nodes. Like this, the executor isn’t needed any longer for subsequent calls to changed().
@see: FS.File.changed(), FS.File.release_target_info()
- changed_since_last_build#
- children(scan: int = 1)[source]#
Return a list of the node’s direct children, minus those that are ignored by this node.
- children_are_up_to_date() bool [source]#
Alternate check for whether the Node is current: If all of our children were up-to-date, then this Node was up-to-date, too.
The SCons.Node.Alias and SCons.Node.Python.Value subclasses rebind their current() method to this method.
- clear() None [source]#
Completely clear a Node of all its cached state (so that it can be re-evaluated by interfaces that do continuous integration builds).
- depends#
- depends_set#
- env#
- executor#
- for_signature()[source]#
Return a string representation of the Node that will always be the same for this particular Node, no matter what. This is by contrast to the __str__() method, which might, for instance, return a relative path for a file Node. The purpose of this method is to generate a value to be used in signature calculation for the command line used to build a target, and we use this method instead of str() to avoid unnecessary rebuilds. This method does not need to return something that would actually work in a command line; it can return any kind of nonsense, so long as it does not change.
- get_abspath()[source]#
Return an absolute path to the Node. This will return simply str(Node) by default, but for Node types that have a concept of relative path, this might return something different.
- get_binfo()[source]#
Fetch a node’s build information.
node - the node whose sources will be collected cache - alternate node to use for the signature cache returns - the build signature
This no longer handles the recursive descent of the node’s children’s signatures. We expect that they’re already built and updated by someone else, if that’s what’s wanted.
- get_executor(create: int = 1) Executor [source]#
Fetch the action executor for this node. Create one if there isn’t already one, and requested to do so.
- get_found_includes(env, scanner, path)[source]#
Return the scanned include lines (implicit dependencies) found in this node.
The default is no implicit dependencies. We expect this method to be overridden by any subclass that can be scanned for implicit dependencies.
- get_implicit_deps(env, initial_scanner, path_func, kw={})[source]#
Return a list of implicit dependencies for this node.
This method exists to handle recursive invocation of the scanner on the implicit dependencies returned by the scanner, if the scanner’s recursive flag says that we should.
- get_source_scanner(node)[source]#
Fetch the source scanner for the specified node
NOTE: “self” is the target being built, “node” is the source file for which we want to fetch the scanner.
Implies self.has_builder() is true; again, expect to only be called from locations where this is already verified.
This function may be called very often; it attempts to cache the scanner found to improve performance.
- get_string(for_signature)[source]#
This is a convenience function designed primarily to be used in command generators (i.e., CommandGeneratorActions or Environment variables that are callable), which are called with a for_signature argument that is nonzero if the command generator is being called to generate a signature for the command line, which determines if we should rebuild or not.
Such command generators should use this method in preference to str(Node) when converting a Node to a string, passing in the for_signature parameter, such that we will call Node.for_signature() or str(Node) properly, depending on whether we are calculating a signature or actually constructing a command line.
- get_subst_proxy()[source]#
This method is expected to return an object that will function exactly like this Node, except that it implements any additional special features that we would like to be in effect for Environment variable substitution. The principle use is that some Nodes would like to implement a __getattr__() method, but putting that in the Node type itself has a tendency to kill performance. We instead put it in a proxy and return it from this method. It is legal for this method to return self if no new functionality is needed for Environment substitution.
- has_builder() bool [source]#
Return whether this Node has a builder or not.
In Boolean tests, this turns out to be a lot more efficient than simply examining the builder attribute directly (“if node.builder: …”). When the builder attribute is examined directly, it ends up calling __getattr__ for both the __len__ and __bool__ attributes on instances of our Builder Proxy class(es), generating a bazillion extra calls and slowing things down immensely.
- has_explicit_builder() bool [source]#
Return whether this Node has an explicit builder.
This allows an internal Builder created by SCons to be marked non-explicit, so that it can be overridden by an explicit builder that the user supplies (the canonical example being directories).
- ignore#
- ignore_set#
- implicit#
- implicit_set#
- includes#
- is_derived() bool [source]#
Returns true if this node is derived (i.e. built).
This should return true only for nodes whose path should be in the variant directory when duplicate=0 and should contribute their build signatures when they are used as source files to other derived files. For example: source with source builders are not derived in this sense, and hence should not return true.
- is_explicit#
- is_literal() bool [source]#
Always pass the string representation of a Node to the command interpreter literally.
- is_up_to_date() bool [source]#
Default check for whether the Node is current: unknown Node subtypes are always out of date, so they will always get built.
- linked#
- make_ready() 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.
- 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.
- ninfo#
- nocache#
- noclean#
- precious#
- prepare()[source]#
Prepare for this Node to be built.
This is called after the Taskmaster has decided that the Node is out-of-date and must be rebuilt, but before actually calling the method to build the Node.
This default implementation checks that explicit or implicit dependencies either exist or are derived, and initializes the BuildInfo structure that will hold the information about how this node is, uh, built.
(The existence of source files is checked separately by the Executor, which aggregates checks for all of the targets built by a specific action.)
Overriding this method allows for for a Node subclass to remove the underlying file from the file system. Note that subclass methods should call this base class method to get the child check and the BuildInfo structure.
- prerequisites#
- pseudo#
- ref_count#
- 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.
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()
- render_include_tree()[source]#
Return a text representation, suitable for displaying to the user, of the include tree for the sources of this node.
- 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.
- select_scanner(scanner)[source]#
Selects a scanner for this Node.
This is a separate method so it can be overridden by Node subclasses (specifically, Node.FS.Dir) that must use their own Scanner and don’t select one the Scanner.Selector that’s configured for the target.
- side_effect#
- side_effects#
- sources#
- sources_set#
- state#
- store_info#
- target_peers#
- waiting_parents#
- waiting_s_e#
- wkids#
- class SCons.Node.NodeInfoBase[source]#
Bases:
object
The generic base class for signature information for a Node.
Node subclasses should subclass NodeInfoBase to provide their own logic for dealing with their own Node-specific signature information.
- __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. The version is discarded.
- current_version_id = 2#
- class SCons.Node.NodeList(initlist=None)[source]#
Bases:
UserList
- _abc_impl = <_abc._abc_data object>#
- append(item)#
S.append(value) – append value to the end of the sequence
- clear() None -- remove all items from S #
- copy()#
- count(value) integer -- return number of occurrences of value #
- extend(other)#
S.extend(iterable) – extend sequence by appending elements from the iterable
- index(value[, start[, stop]]) integer -- return first index of value. #
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
- insert(i, item)#
S.insert(index, value) – insert value before index
- pop([index]) item -- remove and return item at index (default last). #
Raise IndexError if list is empty or index is out of range.
- remove(item)#
S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.
- reverse()#
S.reverse() – reverse IN PLACE
- sort(*args, **kwds)#
- class SCons.Node.Walker(node, kids_func=<function get_children>, cycle_func=<function ignore_cycle>, eval_func=<function do_nothing>)[source]#
Bases:
object
An iterator for walking a Node tree.
This is depth-first, children are visited before the parent. The Walker object can be initialized with any node, and returns the next node on the descent with each get_next() call. get the children of a node instead of calling ‘children’. ‘cycle_func’ is an optional function that will be called when a cycle is detected.
This class does not get caught in node cycles caused, for example, by C header file include loops.
- SCons.Node.changed_since_last_build_node(node, target, prev_ni, repo_node=None) bool [source]#
Must be overridden in a specific subclass to return True if this Node (a dependency) has changed since the last time it was used to build the specified target. prev_ni is this Node’s state (for example, its file timestamp, length, maybe content signature) as of the last time the target was built.
Note that this method is called through the dependency, not the target, because a dependency Node must be able to use its own logic to decide if it changed. For example, File Nodes need to obey if we’re configured to use timestamps, but Python Value Nodes never use timestamps and always use the content. If this method were called through the target, then each Node’s implementation of this method would have to have more complicated logic to handle all the different Node types on which it might depend.
- SCons.Node.changed_since_last_build_state_changed(node, target, prev_ni, repo_node=None) bool [source]#
- SCons.Node.exists_entry(node) bool [source]#
Return if the Entry exists. Check the file system to see what we should turn into first. Assume a file if there’s no directory.
- SCons.Node.get_contents_dir(node)[source]#
Return content signatures and names of all our children separated by new-lines. Ensure that the nodes are sorted.
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
- 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#
- 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 #
- 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_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() bool #
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()#
- 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_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#
- 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
- _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 #
- 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__()#
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 #
- 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.
- 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
- BuildInfo#
alias of
BuildInfoBase
- Decider(function) None #
- GetTag(key)#
Return a user-defined tag.
- NodeInfo#
alias of
NodeInfoBase
- 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.
- __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.
- _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)#
- _labspath#
- _local#
- _memo#
- _path#
- _path_elements#
- _proxy#
- _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.
- 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_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_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_path(dir=None)[source]#
Return path relative to the current working directory of the Node.FS.Base object that owns us.
- 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_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_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.
- linked#
- 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() bool #
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.
- 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.
- 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_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#
- 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.
- state#
- store_info#
- 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
- 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.
- 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#
- _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.
- always_build#
- attributes#
- binfo#
- 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)#
- duplicate#
- entries#
- 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
- 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()#
- 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_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_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_ninfo()#
- get_path(dir=None)#
Return path relative to the current working directory of the Node.FS.Base object that owns us.
- 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()#
- 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 usesfnmatch.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 #
- isdir() bool #
- isfile() bool #
- islink() bool #
- link(srcdir, duplicate) None [source]#
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() bool #
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()
- 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_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_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()[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#
- 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.
- 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.
- 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
- 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()#
- _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#
- duplicate#
- entries#
- env#
- env_set(env, safe: bool = False) None #
- executor#
- executor_cleanup() None #
Let the executor clean up any cached information.
- 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 #
- islink() 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()#
- 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() bool #
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()
- 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_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_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()
.
- 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_root(drive)[source]#
Returns the root directory for the specified drive, creating it if necessary.
- getmtime(path)#
- getsize(path)#
- isdir(path) bool #
- isfile(path) bool #
- islink(path) bool #
- link(src, dst)#
- listdir(path)#
- lstat(path)#
- makedirs(path, mode: int = 511, exist_ok: bool = False)#
- mkdir(path, mode: int = 511)#
- open(path)#
- readlink(file) str #
- rename(old, new)#
- scandir(path)#
- stat(path)#
- symlink(src, dst)#
- unlink(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
- 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.
- 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” dire