[Scons-dev] SCons Node ID
anatoly techtonik
techtonik at gmail.com
Fri Sep 4 04:24:14 EDT 2015
On Fri, Sep 4, 2015 at 10:10 AM, Dirk Bächle <tshortik at gmx.de> wrote:
> On 04.09.2015 06:16, anatoly techtonik wrote:
>
>> I have another question about SCons. If I specify target explicitly, it
>> ends up
>> as str in BUILD_TARGETS and it is impossible to traverse. How do I
>> transform it to Node if I don't know the type? I.e. how to lookup Node
>> object
>> by name?
>>
>>
> you mean you explicitly specify a target "x" on the command line, but you
> don't know whether it's a File or a Dir?
> Can you come up with a short user scenario for this? What is it that
> you're trying to accomplish?
>
The short user scenario - a person want to build wesnoth and executes
`scons`. The output says that possible targets are "wesnoth" and
"wesnothd". Because I don't have dependencies for "wesnoth", I specify
"wesnothd" which ends up as str in BUILD_TARGETS and I can not traverse it.
> I think we had this discussion some time ago when you asked about how to
> traverse the Node tree (DAG), the single Nodes are mainly addressed
> (identified) by their full path (relative path and name) relative to the
> top-level folder of the current SCons build. This is what's used while
> looking up Nodes (exists already, or not?) in the internal FS tree
> structure, such that we are able to distinguish between "vector.h" in two
> different subdirectories for example.
>
> Hope this helps you a little further.
I found a list SCons.Node.arg2nodes_lookups which contains at
least SCons.Node.Alias.AliasNameSpace() instance that lookups the name in
the list of all Alias nodes. So, the way SCons.Script.Main converts name to
Node is:
for lookup in SCons.Node.arg2nodes_lookups:
node = lookup(x, curdir=curdir)
if node is not None:
break
if node is None:
node = fs.Entry(x, directory=ltop, create=1)
--
anatoly t.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20150904/eb04baa2/attachment.html>
More information about the Scons-dev
mailing list