Review Board 2.0.15


scons: show sources and targets when building.

Review Request #366 - Created Jan. 3, 2011 and submitted

Information
Steve Reinhardt
gem5
Reviewers
Default
ali, gblack, nate, stever
scons: show sources and targets when building.

I like the brevity of Ali's recent change, but the ambiguity of
sometimes showing the source and sometimes the target is a little
confusing.  This patch makes scons typically list all sources and
all targets for each action, with the common path prefix factored
out for brevity.  It's a little more verbose now but also more
informative.
quick regressions pass
Review request changed
Updated (Jan. 6, 2011, 3:15 a.m.)

Change Summary:

Added a screenshot to show color scheme.
Ship it!
Posted (Jan. 6, 2011, 3:42 a.m.)
We've beaten this to death, so I don't care about any of my comments enough to hold you up if you don't want to deal with them at all.
SConstruct (Diff revision 3)
 
 
Can you derive from object?  I really hate classic classes as they make various things annoying and the cause is not always obvious.
  1. No problem, it was just an oversight.
SConstruct (Diff revision 3)
 
 
I hate lines like this.  I'll register my annoyance, but won't continue further discussion.
  1. This is one of the few places I feel like lines like this are useful... this whole colorization thing already chews up way too many lines for the value it brings IMO :-).  I'm also tempted to do this:
    
        def color_pfx(self, s):  return self.color(self.pfx_color, s)
        def color_srcs(self, s): return self.color(self.srcs_color, s)
        def color_tgts(self, s): return self.color(self.tgts_color, s)
    
    just because I hate repetitive stuff chewing up vertical screen space.
SConstruct (Diff revision 3)
 
 
This is probably pedantic, but these could be @classmethod (and self should be cls)
  1. Yea, I knew that, but I didn't see any point to it, so I figured why bother with the extra verbiage.  If there's an advantage to it I'd be glad to do it though.  The one thing I would like would be to define color() in a way where I could use it immediately, so I could do 'Arrow = color(arrow_color, " -> ")' instead of the current expression, but I couldn't find a reasonable way to get that to work.
SConstruct (Diff revision 3)
 
 
99 seems like a lot and goes against the idea of being concise.  I don't care much though.

Would anyone object to [%-8s] instead?  the right justified seems odd.
  1. The 99 is just a practical approximation of infinity, not meant to be hit in practice... the main idea is to give a parameter you can explicitly set if you don't want all (or any) of the sources listed, so I can cleanly replace the TRANSFORM_NOSRC and TRANSFORM_1SRC things I had in the earlier version.
SConstruct (Diff revision 3)
 
 
out of curiosity, can you do the following instead?
main['CCCOMSTR'] = TRANSFORM("CC")

Certainly, I am pretty sure that the parameter to MakeAction/Action could be the callable and not the string.  (String substitution just slows down SCons)
  1. TRANSFORM("CC") doesn't work, but Transform("CC") does.  I had tried this before and it didn't work so I gave up on it, but I must have had some other error at the time.
Posted (Jan. 6, 2011, 4:45 a.m.)



  
SConstruct (Diff revision 3)
 
 
Wow, we're having fun with this bikeshed, no?  Which color is it? (Feel free to ignore me at any time)

    if use_colors:
        try:
            from curses import setupterm, tigetstr, tparm
            setupterm()
            setaf = tigetstr('setaf')
        except:
            use_colors = False

    if not use_colors:
        def tparm(*args):
            return ''

    Blue = tparm(setaf, 4)
    Yellow = tparm(setaf, 3)
    Bold = tparm(tigetstr('bold'))
    Normal = tparm(tigetstr('sgr0'))

    # all specific color settings should be here and nowhere else
    tool_color = Blue
    pfx_color = Yellow
    srcs_color = Yellow + Bold
    arrow_color = Blue + Bold
    tgts_color = Yellow + Bold

Seems to me that Arrow and the various color functions are overkill. (and the self.tool = self.color(...)

seems like that should be self.tool = tool and the final line of Transform should be:

return ' [%8s] %s %s %s' % (self.tool_color + self.tool, self.srcs_color + fmt(srcs), self.arrow_color + '->',
self.tgts_color + fmt(tgts)) + self.Normal
SConstruct (Diff revision 3)
 
 
Yeah, I was just wondering if we wanted to limit to say 5 otherwise, but no big deal.
SConstruct (Diff revision 3)
 
 
Oops, that's what I meant.
Posted (Jan. 6, 2011, 12:45 p.m.)
How about leaving the tool name grey?

Ali