ToolFinder¶
-
class
sconstool.util.
ToolFinder
(tool, **kw)[source]¶ Callable object which searches for executables.
A single ToolFinder instance searches for a single file (program), for example a compiler executable or script interpreter. The constructor accepts several options, for each option there is corresponding @property (read-only) with the same name.
Example: Typical use in a tool module from sconstool.util import ToolFinder foo = ToolFinder('foo') def generate(env): env.SetDefault(FOO=foo(env)) # ... def exists(env): return env.get('FOO', foo(env))
Parameters: - tool (str) – symbolic name of the tool,
- name (str,list) – base name of the file (program name) being searched for, may be a list of alternative program names,
- path (str,list) – search path to be used instead of the standard SCons PATH,
- pathext (str,list) – a list of file extensions to be considered as executable,
- reject (list) – a list of paths to be rejected,
- priority_path (str,list) – extra search path to be searched prior to
path
, - fallback_path (str,list) – extra search path to be searched after
path
, - strip_path (bool) – if
True
(default), the leading path, if it’s inpath
list, will be stripped from the returned file path, - strip_priority_path (bool) – if
True
, the leading path, if it’s in priority_path list, will be stripped from the returned file path; - strip_fallback_path (bool) – if
True
, the leading path, if it’s in fallback_path list, will be stripped from the returned file path.
-
__call__
(env)[source]¶ Performs the actual search.
Parameters: env – a SCons environment; provides construction variables and the env.WhereIs()
method to theToolFinder
.Returns: depending on options chosen at object creation, a name or a path to the executable file found. If the program can’t be found, None
is returned.Return type: str
-
fallback_path
¶ The value of fallback_path keyword argument passed in to the constructor at object creation, or
[]
if the argument was omitted.Return type: str,list
-
name
¶ The value of name keyword argument passed in to the constructor at object creation, or
self.tool
if the argument was omitted.Return type: str
-
path
¶ The value of path keyword argument passed in to the constructor at object creation, or
None
if the argument was omitted.Return type: str,list
-
pathext
¶ The value of pathext keyword argument passed in to the constructor at object creation, or
None
if the argument was omitted.Return type: str,list
-
priority_path
¶ The value of priority_path keyword argument passed in to the constructor at object creation, or
[]
if the argument was omitted.Return type: str,list
-
reject
¶ The value of reject keyword argument passed in to the constructor at object creation, or
[]
if the argument was omitted.Return type: list
-
strip_fallback_path
¶ The value of strip_fallback_path keyword argument passed in to the constructor at object creation, or
False
if the argument was omitted.Return type: bool
-
strip_path
¶ The value of strip_path keyword argument passed in to the constructor at object creation, or
True
if the argument was omitted.Return type: bool