Re: untar builder fails with error

Mats Wichmann <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <[email protected]>
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?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.