scons icon indicating copy to clipboard operation
scons copied to clipboard

CHANGED_TARGETS has no properties

Open bdbaddog opened this issue 7 years ago • 12 comments

This issue was originally created at: 2010-01-11 15:52:39. This issue was reported by: coppro.

coppro said at 2010-01-11 15:52:39

The CHANGED_TARGETS variable (and I assume CHANGED_SOURCES, UNCHANGED_SOURCES, and UNCHANGED_TARGETS, though I don't have time to check) does not have any of the properties such as suffix or abspath that TARGETS does. The documentation implies that they do, and there is no real reason for them not to.

gregnoel said at 2010-02-03 14:55:48

Bug party triage.

bdbaddog avatar Jan 02 '18 14:01 bdbaddog

Flagging as doc issue for now, and assigning so I take a look.

mwichmann avatar Dec 23 '23 16:12 mwichmann

I don't think the docs imply this. They're just lists (well, they're TSList, which is a subclass of UserList), and don't provide any unusual attributes. Individual nodes in the lists, if they happen to be nodes, should have these.

@bdbaddog - invalid / close?

TSList has the note:

we subclass collections.UserList purely so that the is_Sequence() function will identify an object of this class as a list during variable expansion. We're not really using any collections.UserList methods in practice

mwichmann avatar Dec 23 '23 19:12 mwichmann

I'd say this is a bug.

bdbaddog avatar Dec 23 '23 21:12 bdbaddog

You'll have to explain... the various *TARGETS and *SOURCES variables are just lists, why should they have attributes that only make sense in the context of an individual node (i.e. member of list)? The manpage doesn't seem to say otherwise, despite what the bugreport claims.

            self.lvars = {
                'CHANGED_SOURCES' : TSList(self._get_changed_sources),
                'CHANGED_TARGETS' : TSList(self._get_changed_targets),
                'SOURCE' : TSObject(self._get_source),
                'SOURCES' : TSList(self._get_sources),
                'TARGET' : TSObject(self._get_target),
                'TARGETS' : TSList(self._get_targets),
                'UNCHANGED_SOURCES' : TSList(self._get_unchanged_sources),
                'UNCHANGED_TARGETS' : TSList(self._get_unchanged_targets),
            }

mwichmann avatar Dec 23 '23 21:12 mwichmann

From subst:

        # away soon anyway.  We just let these expand to $TARGETS
        # because that's "good enough" for the use of ToolSurrogates
        # (see test/ToolSurrogate.py) to generate documentation.
        dict['CHANGED_SOURCES'] = '$SOURCES'
        dict['UNCHANGED_SOURCES'] = '$SOURCES'```

bdbaddog avatar Dec 23 '23 21:12 bdbaddog

subst is overwriting those..

bdbaddog avatar Dec 23 '23 21:12 bdbaddog

lovely

mwichmann avatar Dec 23 '23 21:12 mwichmann

commnet lines 293,294, 319,320, and then it seems to work.

bdbaddog avatar Dec 23 '23 21:12 bdbaddog

okay, I see there's a TargetsAndSources class which defers but eventually does produce a NodeList - the Util one, which does return the requested attribute from each member. So I guess that was designed to work as the OP expected.

mwichmann avatar Dec 24 '23 20:12 mwichmann

Never pursued this to its conclusion... so the "lines 293,294,319,320" refers to Subst, namely:

        dict['CHANGED_TARGETS'] = '$TARGETS'                                   
        dict['UNCHANGED_TARGETS'] = '$TARGETS'                                 
#...and...     
        dict['CHANGED_SOURCES'] = '$SOURCES'                                   
        dict['UNCHANGED_SOURCES'] = '$SOURCES' 

If so, the comment in there suggests this setting is needed for something (i.e. commenting out the lines may not be right), what do we do about that?

        # This is a total cheat, but hopefully this dictionary goes            
        # away soon anyway.  We just let these expand to $TARGETS              
        # because that's "good enough" for the use of ToolSurrogates           
        # (see test/ToolSurrogate.py) to generate documentation.    

mwichmann avatar May 07 '24 14:05 mwichmann

The comment is wrong I believe. and predates setting those values elsewhere... if I remember correctly.

bdbaddog avatar May 07 '24 18:05 bdbaddog