Changeset 6912 for lang/python

Show
Ignore:
Timestamp:
02/19/08 14:40:24 (5 years ago)
Author:
yuin
Message:

/lang/python/tasktools/trunk/tasktools.py: fix bug: when tasks created with "Standard Command" name(e.g. clean, build), could not see it in the --help-commands.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/python/tasktools/trunk/tasktools.py

    r6908 r6912  
    2121import distutils.dist 
    2222from distutils.dist import Distribution 
    23 import distutils.command 
     23import distutils.command as scommands 
    2424 
    2525__version__ = "1.0.0" 
     
    3030_cmds = _Odict() 
    3131_namespace = [] 
     32_old_scommands = scommands.__all__ 
    3233 
    3334_get_ns = lambda:_namespace and _va["nssep"].join(_namespace)+_va["nssep"] or "" 
     
    3940    _va["nssep"] = ":" 
    4041    _clear_commands() 
     42    scommands.__all__ = [] 
    4143    distutils.dist.command_re = re.compile("[a-zA-Z0-9_:]+") 
    4244    Distribution.common_usage = "" 
    4345    def new_print_command_list (self, commands, header, max_length): 
    44       if header == "Standard commands": return  
     46      if header == "Standard commands" and not scommands.__all__ : return 
    4547      if "extra" in header.lower() : header = "Commands" 
    4648      return self.old_print_command_list(commands, header, max_length) 
     
    8890    if "sub_commands" in d: 
    8991      cls.description += "\n\tsub commands:\n"+"\n".join("\t\t"+i for i,j in d["sub_commands"]) 
     92    if name in _old_scommands and name not in scommands.__all__: scommands.__all__.append(name) 
    9093    if class_name != "Task" : _cmds[name] = cls 
    9194    return cls