[Scons-users] error on scons 3.1.1. nd python 3.5

daggs daggs at gmx.com
Fri Oct 25 10:10:30 EDT 2019


Greetings Mats,

> Sent: Friday, October 25, 2019 at 4:24 PM
> From: "Mats Wichmann" <mats at wichmann.us>
> To: scons-users at scons.org
> Subject: Re: [Scons-users] error on scons 3.1.1. nd python 3.5
>
> On 10/25/19 6:12 AM, daggs wrote:
> > Greetings Bill,
> > I do have custom builders.
> > I'm not sure what you mean by "your build system", can you elaborate please?
> > infact, now that I think of it, I'm in the process of migrating a 
> > project that worked on scons + python 2.7 to newer scons  python 3.5.
> > I remember that the old code used lambda and maybe map in the same 
> > manner within a func which scans a folder, looks for all files with a 
> > specific extension.
> > in addition, I have hte ability to run just the parts with the custom 
> > builders and not all the project, in that scenario, I don't see the error.
> > so this might be the issue.
> > I'll check an update,
> > Thanks for the help.
> 
> 
> >         AttributeError: 'map' object has no attribute 'get_state':
> ...
> >         "/home/daggs/workspace/scons_3.0/scons-3.1.1/bin/../engine/SCons/Taskmaster.py",
> >         line 860:
> >              childstate = child.get_state()
> > 
> >         what is is error and how can I solve it?
> 
> Indeed, as Bill noted, map() now returns a special object (map object), 
> which you can then iterate over, as opposed to the mapped list.  Part of 
> porting scons itself to Python 3 was wrapping nearly every instance of 
> map that is going to passed around in a list call (it's not needed if 
> you proceed to iterate over it, or use a join to create a string 
> representation, etc. but a lot of places made something by map and 
> returned it to the caller). So:
> 
> slist = map(str, source)
> 
> becomes
> 
> slist = list(map(str, source))
> 
> that is quick and it works although it does give right back the 
> speed/memory gains the Python developers tried to give us by not needing 
> to generate the whole list on the spot.
> 
> as an aside, I find I very rarely use map/filter any more, usually a 
> comprehension will be more expressive for me. I think the generic advice 
> may be map can be marginally faster, if performance is critical, but 
> only in the case where you have an existing function which is called (my 
> example above of calling str); if you need a lambda as the map function, 
> the comprehension will win.

thank you for the explanation, I expect your suggestion will solve my issue.
due to the nature of scons and the complexity of the project on hand, I was able to create a rather slim
and efficient deps tree, the map + lambda code is part of one of the main sub branches, when building the entire project for the first time, it will take up to 10 minutes to finish building it due to the first time all the deps are built.
in the rest of the builds, it will not matter much because linking of the same sub branch takes up to a minute.

I think I have all I need, thanks

Dagg.



More information about the Scons-users mailing list