[Scons-users] Errors in "Using scanners with Builders" example

Mats Wichmann mats at wichmann.us
Tue Jan 30 14:31:47 EST 2024


On 1/30/24 09:16, Andreas Gustafsson wrote:
> Hello Mats,
> 
> Thank you for your quick response!
> 
> You wrote:
>> The user guide examples are, in fact, usually processed, to produce the
>> command output you see with many of the examples.  However this example
>> isn't listed as an "scons_example" element, which triggers that
>> processing, but as a plain "programlisting", which gets no processing.
>> Don't know why, perhaps designing a complete runnable example here
>> didn't seem feasible to the author.  I also notice that the earlier
>> example, in section 20.1, *is* entered as an "scons_example", but then
>> the incantation to cause the code to be run and the results captured is
>> commented out.  Will look into why - I'll file the ticket.
> 
> Speaking of that example, I found it really confusing.  It starts out
> by saying:
> 
>    Suppose, for example, that we want to create a simple Scanner
>    for .foo files.
> 
> but the example code that follows seems to deal with .k files,
> not .foo files.
> 
> Then, if I want to try actually running the example code, I will
> presumably have to create my own "kprocess" script.  But no matter
> where I put it, scons won't actually execute it, because of the line
> 
>    env = Environment(ENV={'PATH': '/usr/local/bin'})

this is on my todo list - we have various invented snippets that wipe 
out existing settings, and that style of override really is "override" 
rather than "merge" (there are techniques, usually involve construction 
variable references, like {'PATH': '$PATH:/usr/lobcal/bin'} ).

> 
> which overrides the PATH such that scons not only can't find the
> kprocess script itself, but apparently can't even find a shell to run
> it with.  Even installing the script in /usr/local/bin does not help:
> 
>    $ ls -l /usr/local/bin/kprocess
>    -rwxr-xr-x 1 gson gson 4 Jan 30 18:00 /usr/local/bin/kprocess
>    $ cat /usr/local/bin/kprocess
>    cat
>    $ scons
>    scons: Reading SConscript files ...
>    scons: done reading SConscript files.
>    scons: Building targets ...
>    kprocess < foo.k > foo
>    scons: *** [foo] sh: No such file or directory
> 
> I figure the PATH override is for the benefit of the automated test,
> but surely there is some way to do it without breaking things for
> human users.
> 
> Regards,



More information about the Scons-users mailing list