Package SCons :: Module Builder :: Class BuilderBase
[hide private]
[frames] | no frames]

Class BuilderBase

source code

object --+
         |
        BuilderBase

Base class for Builders, objects that create output nodes (files) from input nodes (files).
Instance Methods [hide private]
 
__init__(self, action=None, prefix='', suffix='', src_suffix='', target_factory=None, source_factory=None, target_scanner=None, source_scanner=None, emitter=None, multi=0, env=None, single_source=0, name=None, chdir=<class 'SCons.Builder._Null'>, is_explicit=1, src_builder=None, ensure_suffix=False, **overrides)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__nonzero__(self) source code
 
__bool__(self) source code
 
get_name(self, env)
Attempts to get the name of the Builder.
source code
 
__eq__(self, other) source code
 
splitext(self, path, env=None) source code
 
_adjustixes(self, files, pre, suf, ensure_suffix=False) source code
 
_create_nodes(self, env, target=None, source=None)
Create and return lists of target and source nodes.
source code
 
_execute(self, env, target, source, overwarn={}, executor_kw={}) source code
 
__call__(self, env, target=None, source=None, chdir=<class 'SCons.Builder._Null'>, **kw) source code
 
adjust_suffix(self, suff) source code
 
get_prefix(self, env, sources=[]) source code
 
set_suffix(self, suffix) source code
 
get_suffix(self, env, sources=[]) source code
 
set_src_suffix(self, src_suffix) source code
 
get_src_suffix(self, env)
Get the first src_suffix in the list of src_suffixes.
source code
 
add_emitter(self, suffix, emitter)
Add a suffix-emitter mapping to this Builder.
source code
 
add_src_builder(self, builder)
Add a new Builder to the list of src_builders.
source code
 
_get_sdict(self, env)
Returns a dictionary mapping all of the source suffixes of all src_builders of this Builder to the underlying Builder that should be called first.
source code
 
src_builder_sources(self, env, source, overwarn={}) source code
 
_get_src_builders_key(self, env) source code
 
get_src_builders(self, env)
Returns the list of source Builders for this Builder.
source code
 
_subst_src_suffixes_key(self, env) source code
 
subst_src_suffixes(self, env)
The suffix list may contain construction variable expansions, so we have to evaluate the individual strings. To avoid doing this over and over, we memoize the results for each construction environment.
source code
 
src_suffixes(self, env)
Returns the list of source suffixes for all src_builders of this Builder.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, action=None, prefix='', suffix='', src_suffix='', target_factory=None, source_factory=None, target_scanner=None, source_scanner=None, emitter=None, multi=0, env=None, single_source=0, name=None, chdir=<class 'SCons.Builder._Null'>, is_explicit=1, src_builder=None, ensure_suffix=False, **overrides)
(Constructor)

source code 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__
(inherited documentation)

get_name(self, env)

source code 

Attempts to get the name of the Builder.

Look at the BUILDERS variable of env, expecting it to be a dictionary containing this Builder, and return the key of the dictionary. If there's no key, then return a directly-configured name (if there is one) or the name of the class (by default).

add_emitter(self, suffix, emitter)

source code 

Add a suffix-emitter mapping to this Builder.

This assumes that emitter has been initialized with an appropriate dictionary type, and will throw a TypeError if not, so the caller is responsible for knowing that this is an appropriate method to call for the Builder in question.

add_src_builder(self, builder)

source code 

Add a new Builder to the list of src_builders.

This requires wiping out cached values so that the computed lists of source suffixes get re-calculated.

_get_sdict(self, env)

source code 

Returns a dictionary mapping all of the source suffixes of all src_builders of this Builder to the underlying Builder that should be called first.

This dictionary is used for each target specified, so we save a lot of extra computation by memoizing it for each construction environment.

Note that this is re-computed each time, not cached, because there might be changes to one of our source Builders (or one of their source Builders, and so on, and so on...) that we can't "see."

The underlying methods we call cache their computed values, though, so we hope repeatedly aggregating them into a dictionary like this won't be too big a hit. We may need to look for a better way to do this if performance data show this has turned into a significant bottleneck.

get_src_builders(self, env)

source code 

Returns the list of source Builders for this Builder.

This exists mainly to look up Builders referenced as strings in the 'BUILDER' variable of the construction environment and cache the result.

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

subst_src_suffixes(self, env)

source code 
The suffix list may contain construction variable expansions, so we have to evaluate the individual strings. To avoid doing this over and over, we memoize the results for each construction environment.
Decorators:
  • @SCons.Memoize.CountDictCall(_subst_src_suffixes_key)

src_suffixes(self, env)

source code 

Returns the list of source suffixes for all src_builders of this Builder.

This is essentially a recursive descent of the src_builder "tree." (This value isn't cached because there may be changes in a src_builder many levels deep that we can't see.)