| |
---|
| | # Program Information |
---|
| | |
---|
| | PROGNAME = "tren.py" |
---|
| | PROGENV = PROGNAME.split(".py")[0].upper() |
---|
| | RCSID = "$Id: tren.py,v 1.114 2010/01/27 18:04:55 tundra Exp $" |
---|
| | RCSID = "$Id: tren.py,v 1.115 2010/01/27 23:32:30 tundra Exp $" |
---|
| | VERSION = RCSID.split()[2] |
---|
| | |
---|
| | # Copyright Information |
---|
| | |
---|
| |
---|
| | |
---|
| | MAXLINELEN = 75 # Maximum length of printed line |
---|
| | PADCHAR = " " # Padding character |
---|
| | PADWIDTH = 30 # Column width |
---|
| | SEQPAD = 13 # Padding to use when dumping sequence tables |
---|
| | WRAPINDENT = 8 # Extra indent on wrapped lines |
---|
| | |
---|
| | |
---|
| | ##### |
---|
| |
---|
| | dCMDLINE = "Command Line" |
---|
| | dCURSTATE = "Current State Of Program Options" |
---|
| | dDEBUG = "DEBUG" |
---|
| | dDUMPOBJ = "Dumping Object %s" |
---|
| | dELLIPSIS = "..." |
---|
| | dINCLUDING = "Including file '%s'" |
---|
| | dPAIR = "Option/Target Pair" |
---|
| | dPROGENV = "$" + PROGENV |
---|
| | dRESOLVEDOPTS = "Resolved Command Line" |
---|
| |
---|
| | stat = os.stat(fullname) |
---|
| | self.RenNames[fullname] = [basename, stat] |
---|
| | |
---|
| | self.cmdorder.append(t) |
---|
| | self.ctimes[stat[ST_CTIME]] = fullname |
---|
| | self.sizes[stat[ST_SIZE]] = fullname |
---|
| | |
---|
| | time = stat[ST_CTIME] |
---|
| | if time in self.ctimes: |
---|
| | self.ctimes[time].append(fullname) |
---|
| | else: |
---|
| | self.ctimes[time] = [fullname] |
---|
| | |
---|
| | size = stat[ST_SIZE] |
---|
| | if size in self.sizes: |
---|
| | self.sizes[size].append(fullname) |
---|
| | else: |
---|
| | self.sizes[size] = [fullname] |
---|
| | |
---|
| | |
---|
| | # Sort the relevant sequence renaming token lists |
---|
| | |
---|
| |
---|
| | for l in list: |
---|
| | l = str(l) |
---|
| | retval += l + ((padwidth - len(l)) * padchar) |
---|
| | |
---|
| | return retval.strip() |
---|
| | return retval |
---|
| | |
---|
| | # End of 'ColumnPad()' |
---|
| | |
---|
| | |
---|
| |
---|
| | |
---|
| | for name in obj.RenNames: |
---|
| | DebugMsg(name) |
---|
| | for item in obj.RenNames[name]: |
---|
| | DebugMsg(ColumnPad([dELLIPSIS, item])) |
---|
| | DebugMsg(ColumnPad([" ", item])) |
---|
| | |
---|
| | # Dump command line sequence |
---|
| | |
---|
| | DebugMsg(dSEQCMD) |
---|
| | for item in obj.cmdorder: |
---|
| | DebugMsg(ColumnPad([dELLIPSIS, item])) |
---|
| | DebugMsg(dSEQCMD) |
---|
| | for item in obj.cmdorder: |
---|
| | DebugMsg(ColumnPad([" ", item])) |
---|
| | |
---|
| | # Dump creation date sequence |
---|
| | |
---|
| | DebugMsg(dSEQCTIME) |
---|
| | for item in obj.ByCtime: |
---|
| | DebugMsg(ColumnPad([dELLIPSIS, " %s %s %s" % (item, ARROW, obj.ctimes[item])])) |
---|
| | DebugMsg(dSEQCTIME) |
---|
| | for item in obj.ByCtime: |
---|
| | itemarrow = ColumnPad([item, ARROW], padwidth=SEQPAD) |
---|
| | DebugMsg(ColumnPad([" ", " %s %s" % (itemarrow, obj.ctimes[item])])) |
---|
| | |
---|
| | # Dump size sequence |
---|
| | |
---|
| | DebugMsg(dSEQSIZE) |
---|
| | for item in obj.BySize: |
---|
| | DebugMsg(ColumnPad([dELLIPSIS, " %s %s %s" % (item, ARROW, obj.sizes[item])])) |
---|
| | DebugMsg(dSEQSIZE) |
---|
| | for item in obj.BySize: |
---|
| | itemarrow = ColumnPad([item, ARROW], padwidth=SEQPAD) |
---|
| | DebugMsg(ColumnPad([" ", " %s %s" % (itemarrow, obj.sizes[item])])) |
---|
| | |
---|
| | DebugMsg(SEPARATOR + "\n\n") |
---|
| | |
---|
| | # End of 'DumpRenameObj()' |
---|
| |
---|
| | # Create and populate an object with rename targets. |
---|
| | # We have to do this here so that subsequent |
---|
| | # renaming tokens references can be resolved. |
---|
| | |
---|
| | targs = RenameTargets(args) |
---|
| | targs = None |
---|
| | if args: |
---|
| | targs = RenameTargets(args) |
---|
| | |
---|
| | |
---|
| | # Now process the options |
---|
| | |
---|
| |
---|
| | if opt == "-x": |
---|
| | REGEX = True |
---|
| | |
---|
| | |
---|
| | # Release the target container |
---|
| | del targs |
---|
| | |
---|
| | # Release the target container if we created one |
---|
| | if targs: |
---|
| | del targs |
---|
| | |
---|
| | |