[Scons-users] What is the difference between Variables and Options

William Blevins wblevins001 at gmail.com
Sat Jan 2 12:55:11 EST 2016


Stefan,

SCons parses commandline arguments in multiple stages, so the commandline
gets parsed multiple times by various parsers. I don't remember the exact
logic, but options and variables are disjoint concepts.

The SCons Option implementation is simply a wrapper around optparse (which
will get replaced by argparse in the future).
The SCons variable implementation is simply a pair-wise key:value ordering
of non-option tokens.

If you want to add variables to the help, then you may have to interact
with OptParse more directly.

V/R,
William

On Sat, Jan 2, 2016 at 3:10 PM, Stefan Seefeld <stefan at seefeld.name> wrote:

> On 02.01.2016 02:15, Bill Deegan wrote:
> > Stefan,
> >
> > Previously they were called options, but we changed the name to
> variables.
> > So don't use options as you can see it's deprecated.
> >
> > Please point to where Options.GenerateHelpText() is recommended so we
> > can change it.
>
> There are a few places:
> http://scons.org/doc/production/HTML/scons-user.html#chap-command-line
> discusses (very briefly) the difference between "Options" and
> "Variables", and I found some code in the wiki:
> https://bitbucket.org/scons/scons/wiki/UnitTests
>
> As the documentation above points out, options always begin with hyphen
> characters, while variables are passed as key-value pairs separated by
> an equal-sign. Is that convention affected by your statement above about
> options now being called variables ? And what about
>
> >     However, if I try to add the "--python" option as a variable key,
> >     I get
> >     the error "scons: *** Illegal Variables.Add() key `--python'".
> >
>
> I.e. how can I define the "--python" option ? I used to use
> "AddOption()" (which is still documented and works fine), but now want
> to extract the help text when invoking Help(), but since Options() is
> deprecated and Variables().add("--python", ...) doesn't work, I'm not
> sure what to use for that.
>
> Thanks,
>         Stefan
>
>
> --
>
>       ...ich hab' noch einen Koffer in Berlin...
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20160102/f34ba1ec/attachment.html>


More information about the Scons-users mailing list