[Scons-users] Fwd: How to access SCons ARGUMENTS in helper package?
Ben Farmer
ben.farmer at gmail.com
Wed Oct 18 19:40:04 EDT 2023
Hi mailing list!
I hope this email is not too annoying, but the user guide said this was the
place to ask questions.
So, I am trying to understand how to retrieve command line arguments, that
have been saved into Variables by doing e.g.
opts = Variables()
opts.AddVariables(...)
According to the docs at
https://scons.org/doc/production/HTML/scons-user/ch10s02.html I think it
says I should retrieve variable values by doing
ARGUMENTS.get('myarg', <default value>)
However I just get
scons: Reading SConscript files ...
NameError: name 'ARGUMENTS' is not defined
when I try to run this with SCons.
I'm kind of a SCons noob though and I don't really understand how SCons
works or what it is doing. I know Python well and the things scons does
don't make sense to me as a python developer. Looks like it kind of isn't
exactly Python, just Python powered? I should not view the SConstruct files
as Python scripts? Because indeed they don't seem to ever "import" any of
the stuff they use. I guess SCons just handles that behind the scenes?
I assume my problem is that actually I am trying to do my ARGUMENTS.get
call inside a python "tools" package that we use in my team, that defines a
bunch of stuff for SCons to do across multiple projects. And that "tools"
package is a straight-up Python package that is imported into the
SConstruct file. So I guess it is not receiving whatever auto-magic
treatment the SConstruct files get to make these global variables/functions
available to them, and I need to somehow import them via the SCons Python
API? However I searched the SCons API docs and couldn't find anything about
ARGUMENTS, so maybe I am supposed to do this some other way via the API?
I'm just very confused about how this is supposed to work, and I seem to
have missed some crucial part of the docs that explains it I guess. Any
help much appreciated!
Regards,
Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20231019/be8fdea3/attachment.htm>
More information about the Scons-users
mailing list