Changeset 3669:800696a18ac3 in livinglogic.python.xist

Show
Ignore:
Timestamp:
12/30/08 21:30:40 (11 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Convert action classes back to names for the option default value.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/make.py

    r3668 r3669  
    22682268        """ 
    22692269 
     2270        def action2name(action): 
     2271            if action is None: 
     2272                return "none" 
     2273            elif action is Action: 
     2274                return "all" 
     2275            elif issubclass(FileAction, action) and issubclass(PhonyAction, action): 
     2276                return "filephony" 
     2277            elif issubclass(FileAction, action): 
     2278                return "file" 
     2279            elif issubclass(PhonyAction, action): 
     2280                return "phony" 
     2281            else: 
     2282                return "all" 
     2283 
    22702284        actions = ["all", "file", "phony", "filephony", "none"] 
    22712285        p = optparse.OptionParser(usage="usage: %prog [options] [targets]") 
     
    22752289        p.add_option("-C", "--nocolor", dest="color", help="No colored output", action="store_false", default=None) 
    22762290        p.add_option("-g", "--growl", dest="growl", help="Issue growl notification after the build?", action="store_true", default=None) 
    2277         p.add_option("-a", "--showaction", dest="showaction", help="Show actions (%s)?" % ", ".join(actions), choices=actions, default=self.showaction) 
    2278         p.add_option("-s", "--showstep", dest="showstep", help="Show steps (%s)?" % ", ".join(actions), choices=actions, default=self.showstep) 
    2279         p.add_option("-n", "--shownote", dest="shownote", help="Show notes (%s)?" % ", ".join(actions), choices=actions, default=self.shownote) 
    2280         p.add_option("-r", "--showregistration", dest="showregistration", help="Show registration (%s)?" % ", ".join(actions), choices=actions, default=self.showregistration) 
     2291        p.add_option("-a", "--showaction", dest="showaction", help="Show actions (%s)?" % ", ".join(actions), choices=actions, default=action2name(self.showaction)) 
     2292        p.add_option("-s", "--showstep", dest="showstep", help="Show steps (%s)?" % ", ".join(actions), choices=actions, default=action2name(self.showstep)) 
     2293        p.add_option("-n", "--shownote", dest="shownote", help="Show notes (%s)?" % ", ".join(actions), choices=actions, default=action2name(self.shownote)) 
     2294        p.add_option("-r", "--showregistration", dest="showregistration", help="Show registration (%s)?" % ", ".join(actions), choices=actions, default=action2name(self.showregistration)) 
    22812295        p.add_option("-i", "--showidle", dest="showidle", help="Show actions that didn't produce data?", action="store_true", default=self.showidle) 
    22822296        p.add_option("-d", "--showdata", dest="showdata", help="Show data?", action="store_true", default=self.showdata)