[Scons-users] untar builder fails with error
Mats Wichmann
mats at wichmann.us
Tue Nov 8 10:40:40 EST 2022
On 11/8/22 08:21, daggs wrote:
> I've decided to debug it on my home setup, it uses scons 4.4.0 and python 3.10.8
> the code I'm using is this: https://dpaste.com/CA5CGYWNC and I'm getting this:
> dagg at NCC-5001D ~/workspace/scons_untar $ scons .
> scons: Reading SConscript files ...
> AttributeError: 'map' object has no attribute 'side_effect':
> File "/home/dagg/workspace/scons_untar/SConstruct", line 40:
> thirdPartyEnvironment.UnTar(source="apr-1.3.3")
> File "/usr/lib/python3.10/site-packages/SCons/Environment.py", line 238:
> return super().__call__(target, source, *args, **kw)
> File "/usr/lib/python3.10/site-packages/SCons/Util.py", line 737:
> return self.method(*nargs, **kwargs)
> File "/usr/lib/python3.10/site-packages/SCons/Builder.py", line 663:
> return self._execute(env, target, source, OverrideWarner(kw), ekw)
> File "/usr/lib/python3.10/site-packages/SCons/Builder.py", line 579:
> _node_errors(self, env, tlist, slist)
> File "/usr/lib/python3.10/site-packages/SCons/Builder.py", line 291:
> if t.side_effect:
In Python 3, the map function returns a map object, which is an
iterable, not a list. You can iterate over it - which is the usual
operation - but not otherwise do much with it. You will have to create a
list out of the result of mapping (we could argue that SCons' logic
should accept any iterable here but that's a different story).
>>> x = [1, 2, 3]
>>> y = map(str, x)
>>> print(y)
<map object at 0x7ff5e5590d00>
>>> print(list(y))
['1', '2', '3']
So probably this will help:
newTargets = list(map(tarInfoToNode, tarFileContents))
More information about the Scons-users
mailing list