[Scons-users] untar builder fails with error

Mats Wichmann mats at wichmann.us
Sun Nov 6 15:20:27 EST 2022


On 11/6/22 11:18, daggs wrote:
> looks like this line change: new_targets = [ str(ent) for ent in tar_file.getmembers() if ent.isfile() ] works
> Dagg.

The sequence in the emitter in the Wiki page looked like this:

     tarContents = sourceTar.getmembers()
     tarFileContents = filter(lambda tarEntry: tarEntry.isfile(), 
tarContents)
     newTargets = map(tarInfoToNode, tarFileContents)

where:

def tarInfoToNode(tarInfoObject):
     return File(tarInfoObject.name)

Then your original version had this:

     new_targets = [ ent for ent in tar_file.getmembers() if ent.isfile() ]

that's pretty notably (now I actually look at it) missing the call to 
tarinfoToNode.

your new version is forcing to to string.

    new_targets = [ str(ent) for ent in tar_file.getmembers() if 
ent.isfile()

this improves things because before you were getting a list of tarInfo 
objects from getmembers(), effectively filtering out non-file entries - 
but such objects presumably aren't directly useful to SCons; now you're 
getting the string version, which is presumably the same as the .name 
attribute.  Any reason not to go ahead and convert those to File nodes 
at the same time?




More information about the Scons-users mailing list