[Scons-users] Help needed with "Options"

Eric Fahlgren ericfahlgren at gmail.com
Tue Jan 14 10:28:51 EST 2020


This is certainly Python 2, but only looks like it needs a couple of fixes
to work with Py3 and modern SCons.

1) Change "Options" to "Variables".
2) Change "AddOptions" to "AddVariables".
3) Rework line 180 to put list() calls around each range() call.  In Python
2, the range function returned a list (which supported "+" as the
concatenation operator).  In Python 3, range returns a range object (an
iterator), which doesn't support concatenation, so you need to cast them to
lists:

for itr in
range(0,4)+range(5,9)+range(10,14)+range(15,19)+range(20,24)+range(25,29):

rewrite as

for itr in list(range(0,4))+ list(range(5,9))+ list(range(10,14))+
list(range(15,19))+ list(range(20,24))+list(range(25,29)):

I think that should get it going, but then not being able to run it, I
can't be sure.


On Tue, Jan 14, 2020 at 6:34 AM Mats Wichmann <mats at wichmann.us> wrote:

> On 1/14/20 6:13 AM, Sophie Lagarde wrote:
> > Hi,
> >
> > I am using a code I did not develop by myself. It is basically a python
> > code, I am working on python 3 with anaconda. I installed the scons
> > package with anaconda, and when I am making "conda list", it does appear
> > in the list (version 3.1.2).
> >
> > My problem is that when I want to run the code, scons is not happy (in
> > my SConstruct file) with the following line:
> >
> > opts = Options(config)
> > scons: Reading SConscript files ...
> > NameError: name 'Options' is not defined
> >
> > And I don't know why. My guess is that this function ("Options") existed
> > in previous version, but does not exist anymore (I found references to
> > it in SCons User Guide 0.97 and 0.98
>
> Yes, it was removed quite a while ago, replaced by "Variables".
>
> You can read about the ways to collect information from the command line
> here:
>
>
> https://scons.org/doc/3.1.2/HTML/scons-user.html#sect-command-line-variables
>
> but if you're very new to Python as well, that may not be enough
> information. The User Guide is written from the viewpoint that you don't
> have to be experienced in Python, but my opinion is that mostly works if
> you read it from the beginning, further along it seems to expect a
> little more experience, so jumping right into chapter 10 may or may not
> prove helpful.
>
> I'm new enough to scons that Options were *never* around, but I believe
> the transition from Options -> Variables was fairly gentle.
>
> Someone here will hopefully be able to take a look at your SConstruct
> presently.  There will likely be a few other transitions as well, the
> use of Options suggests the script is quite old, and you've indicated
> you are using Python 3, which was only supported since SCons 3.x, so any
> work related to that was going to have to happen anyway.
>
> _______________________________________________
> 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/20200114/d6b9aee7/attachment-0001.html>


More information about the Scons-users mailing list