[Scons-users] issue with variant-dir

Jason Kenny dragon512 at live.com
Fri Aug 5 09:04:35 EDT 2016


What is printed out for paths is often misleading in SCons for the Node.
More so when using VariantDir 

If you do something more complex, I have found that I would monkey patch the
node object with a id method/property. This printed out the value of the
node in question. It saved me days of confusion when I do work on Parts.

If you want a basic patch it looks like this:

def _get_FSID(self):
    try:
        return self.attributes.__FSID
    except AttributeError:
        result = SCons.Node.FS.get_default_fs().Dir('#').rel_path(self)
        if os.path.isabs(result) or result.startswith('..'):
            result = self.abspath
        result = result.replace('\\', '/')
        self.attributes.__FSID = result
        return result

def _get_ValueID(self):
    return "{0}".format(self.value)

def _get_AliasID(self):
    return self.name

SCons.Node.FS.Base.ID=property(_get_FSID)
SCons.Node.Python.Value.ID=property(_get_ValueID)
SCons.Node.Alias.Alias.ID=property(_get_AliasID)


Whenever I print out the node I us node.ID
I found this helped me prevent confusion.

Jason



-----Original Message-----
From: Scons-users [mailto:scons-users-bounces at scons.org] On Behalf Of Stefan
Seefeld
Sent: Friday, August 5, 2016 7:21 AM
To: scons-users at scons.org
Subject: Re: [Scons-users] issue with variant-dir

On 05.08.2016 06:15, William Blevins wrote:
> Stefan,
>
> It seems to be an issue when combining copying a directory with 
> variant_dir specifically. In all honesty, variant_dir is like magic to 
> me. I don't have knowledge of how target/sources are remapped under 
> the hood.
>
> The prints from Copy are technically wrong even when its working 
> (since it shows the source in the variant_dir path), so it's not even 
> obvious from the command line. If the copy_func gets the correct 
> target/source then it should work fine.

Thanks; I'm glad I'm not the only one wondering about this. It was driving
me crazy during debugging...

        Stefan


-- 

      ...ich hab' noch einen Koffer in Berlin...

_______________________________________________
Scons-users mailing list
Scons-users at scons.org
https://pairlist4.pair.net/mailman/listinfo/scons-users


More information about the Scons-users mailing list