Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
Buildhelper Namespace Reference

Classes

class  Record
 a set of properties with record style access. More...
 

Functions

 isCleanupOperation (env)
 
 isHelpRequest ()
 this is a hack: SCons does all configure tests even if only the help message is requested.
 
 srcSubtree (tree, **args)
 convenience wrapper: scan the given subtree, which is relative to the current SConscript, and find all source files.
 
 scanSubtree (roots, patterns=SRCPATTERNS)
 first expand (possible) wildcards and filter out non-dirs.
 
 globRootdirs (roots)
 helper: expand shell wildcards and filter the resulting list, so that it only contains existing directories
 
 findSrcTrees (location, patterns=SRCPATTERNS)
 find possible source tree roots, starting with the given location.
 
 isSrcDir (path, patterns=SRCPATTERNS)
 helper: investigate the given (relative) path
 
 getDirname (d, basePrefix=None)
 extract directory name without leading path, or without the explicitly given basePrefix
 
 stripPrefix (path, prefix)
 
 createPlugins (env, directory, **kw)
 investigate the given source directory to identify all contained source trees.
 
 checkCommandOption (env, optID, val=None, cmdName=None)
 evaluate and verify an option, which may point at a command.
 
 extract_localPathDefs (localDefs)
 extracts the directory configuration values.
 

Variables

list SRCPATTERNS = ['*.c','*.cpp','*.cc']
 

Function Documentation

◆ isCleanupOperation()

isCleanupOperation (   env)

Definition at line 27 of file Buildhelper.py.

◆ isHelpRequest()

isHelpRequest ( )

this is a hack: SCons does all configure tests even if only the help message is requested.

SCons doesn't export the help option for retrieval by env.GetOption(), so we scan the commandline directly.

Definition at line 30 of file Buildhelper.py.

◆ srcSubtree()

srcSubtree (   tree,
**  args 
)

convenience wrapper: scan the given subtree, which is relative to the current SConscript, and find all source files.

Definition at line 40 of file Buildhelper.py.

References scanSubtree().

Referenced by createPlugins().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ scanSubtree()

scanSubtree (   roots,
  patterns = SRCPATTERNS 
)

first expand (possible) wildcards and filter out non-dirs.

Then scan the given subtree for source filenames (python generator function)

Definition at line 50 of file Buildhelper.py.

References globRootdirs(), and stripPrefix().

Referenced by srcSubtree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ globRootdirs()

globRootdirs (   roots)

helper: expand shell wildcards and filter the resulting list, so that it only contains existing directories

Definition at line 64 of file Buildhelper.py.

Referenced by findSrcTrees(), and scanSubtree().

+ Here is the caller graph for this function:

◆ findSrcTrees()

findSrcTrees (   location,
  patterns = SRCPATTERNS 
)

find possible source tree roots, starting with the given location.

When delving down from the initial location(s), a source tree is defined as a directory containing source files and possibly further sub directories. After having initially expanded the given location with globRootdirs, each directory is examined depth first, until encountering a directory containing source files, which then yields a result. Especially, this can be used to traverse an organisational directory structure and find out all possible source trees to be built into packages, plugins, individual tool executables etc.

Returns
: the relative path names of all source root dirs found (generator function).

Definition at line 74 of file Buildhelper.py.

References globRootdirs().

Referenced by createPlugins().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSrcDir()

isSrcDir (   path,
  patterns = SRCPATTERNS 
)

helper: investigate the given (relative) path

Parameters
patternslist of wildcards to define what counts as "source file"
Returns
: True if it's a directory containing any source file

Definition at line 93 of file Buildhelper.py.

◆ getDirname()

getDirname (   d,
  basePrefix = None 
)

extract directory name without leading path, or without the explicitly given basePrefix

Definition at line 107 of file Buildhelper.py.

References stripPrefix().

Referenced by createPlugins(), LumieraEnvironment.register_LumieraIconBuilder(), and LumieraEnvironment.register_LumieraResourceBuilders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stripPrefix()

stripPrefix (   path,
  prefix 
)

Definition at line 123 of file Buildhelper.py.

Referenced by getDirname(), and scanSubtree().

+ Here is the caller graph for this function:

◆ createPlugins()

createPlugins (   env,
  directory,
**  kw 
)

investigate the given source directory to identify all contained source trees.

Returns
: a list of build nodes defining a plugin for each of these source trees.

Definition at line 130 of file Buildhelper.py.

References findSrcTrees(), getDirname(), and srcSubtree().

+ Here is the call graph for this function:

◆ checkCommandOption()

checkCommandOption (   env,
  optID,
  val = None,
  cmdName = None 
)

evaluate and verify an option, which may point at a command.

besides specifying a path, the option may read True, yes or 1, denoting that the system default for this command should be used.

Returns
: True, if the key has been expanded and validated, False, if this failed and the key was removed

Definition at line 143 of file Buildhelper.py.

Referenced by ToolCCache.exists(), and ToolDistCC.exists().

+ Here is the caller graph for this function:

◆ extract_localPathDefs()

extract_localPathDefs (   localDefs)

extracts the directory configuration values.

For sake of simplicity, paths and directories are defined immediately as global variables in the SConstruct. This helper extracts from the given dict the variables matching some magical pattern and returns them wrapped into a Record for convenient access

Definition at line 200 of file Buildhelper.py.

Variable Documentation

◆ SRCPATTERNS

list SRCPATTERNS = ['*.c','*.cpp','*.cc']

Definition at line 48 of file Buildhelper.py.