Re: untar builder fails with error

Mats Wichmann <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <[email protected]>
On 11/4/22 08:33, daggs wrote:
> Greetings,
> 
> I"m trying to implement the untar builder from https://github.com/SCons/scons/wiki/UnTarBuilder on scons v3.1.2.bee7caf9defd6e108fc2998a2520ddb36a967691 (ubuntu 20.04)
> and I'm getting this error:
> AttributeError: 'TarInfo' object has no attribute 'target_peers':
>    File "/home/dagg/project/site_scons/build_utils.py", line 471:
>      env.Unpack(get_target(), deps_targets_list,
>    File "/usr/lib/scons/SCons/Environment.py", line 255:
>      return MethodWrapper.__call__(self, target, source, *args, **kw)
>    File "/usr/lib/scons/SCons/Environment.py", line 219:
>      return self.method(*nargs, **kwargs)
>    File "/usr/lib/scons/SCons/Builder.py", line 651:
>      return self._execute(env, target, source, OverrideWarner(kw), ekw)
>    File "/usr/lib/scons/SCons/Builder.py", line 570:
>      t.target_peers = tlist
> Compilation failed
> 
> has anyone encountered this issue? I cannot seem to be able to find target_peers in reference to python anywhere
> 
> the builder looks like this:
> import tarfile, os
> 
> def message(target, source, env):
>      return "Unpacking..."
> 
> def builder(target, source, env):
>      tar_file = tarfile.open(env['path'])
>      tar_file.extractall(env['target'])
>      tar_file.close()
> 
>      return None
> 
> def content_emitter(target, source, env):
>      fn = os.path.basename(str(source[0]))
>      print("Reading content...")
>      tar_file = tarfile.open(str(source[0]), "r")
>      new_targets = [ ent for ent in tar_file.getmembers() if ent.isfile() ]
>      tar_file.close()
>      print("Done")
> 
>      return (new_targets, source)
> 
> def generate(env, **kwargs):
>      unpacker = env.Builder(
>          action = env.Action(builder, message),
>          src_suffix = ".tar.bz2",
>          emitter = content_emitter,
>      )
> 
>      env.Append(BUILDERS = { 'Unpack' : unpacker })
> 
> def exists(env):
>      return True
> 
> Thanks,
> 
> dagg

I've used (a fork of) that one, but it's not been for like six years.

Current scons certainly has a target_peers in the node class, and it's 
actively used by the ninja tool. Ninja support, of course, is much newer 
than SCons 3.1.2 - can't really tell the history without more 
prospecting, maybe someone else knows.
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.