[Scons-users] Errors in "Using scanners with Builders" example
Mats Wichmann
mats at wichmann.us
Tue Jan 30 10:42:04 EST 2024
On 1/30/24 07:58, Andreas Gustafsson wrote:
> Hi all,
>
> I was going to file a bug report but was asked to bring the issue here
> first.
>
> If I copy and paste the example code from
> https://scons.org/doc/production/HTML/scons-user/ch20s03.html
> into a SConstruct and run it, I get a syntax error because
> of unbalanced parentheses in
>
> kscan = Scanner(function=kfile_scan, skeys=['.k'], path_function=FindPathDirs('KPATH')
will fix this.
> And after fixing that, I get a second error:
>
> scons: *** [file.foo] TypeError : kfile_scan() missing 1 required positional argument: 'arg'
will fix this, too, though it actually hints
> As a meta-issue, given the emphasis the SCons project seems to place
> on automated testing, how come these aren't caught by some automated
> test?
Because we/re human? :-)
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.
Looks like some thought needs to go into how scanner objects are
described in the manpage, too - there seem to be some inconsistencies in
the ordering of the optional positional arguments in the Scanner() call
in various examples, including the one you cite (they're all optional
except for the scanner function itself).
Thanks for bringing this up!
More information about the Scons-users
mailing list