Implemented debug support for showing the sequence of renaming steps.
1 parent 82a1fc0 commit 54124266536cb1bab1b6dcd3c7dd1d11c29af514
@tundra tundra authored on 25 Aug 2010
Showing 1 changed file
View
15
tren.py
PROGNAME = "tren.py"
BASENAME = PROGNAME.split(".py")[0]
PROGENV = BASENAME.upper()
INCLENV = PROGENV + "INCL"
RCSID = "$Id: tren.py,v 1.225 2010/08/25 18:08:41 tundra Exp $"
RCSID = "$Id: tren.py,v 1.226 2010/08/25 18:54:38 tundra Exp $"
VERSION = RCSID.split()[2]
 
# Copyright Information
 
dDUMPOBJ = "Dumping Object %s"
dINCLFILES = "Included Files:"
dPROGENV = "$" + PROGENV
dRENREQ = "Renaming Request:"
dRENSEQ = "Renaming Sequence: %s"
dRENTARGET = "Rename Target:"
dRESOLVEDOPTS = "Resolved Command Line"
dSEPCHAR = "-" # Used for debug separator lines
dSORTVIEW = "Sort View:"
# This includes the renaming of any existing targets.
 
for target in self.SortViews[ORDERBYCMDLINE]:
 
rensequence = []
oldname, pathname = self.RenNames[target][BASE], self.RenNames[target][PATHNAME]
newname = oldname
name = oldname
 
# Keep track of incremental renaming for use by debug
rensequence.append(oldname)
for renrequest in self.RenRequests:
 
# Handle conventional string replacement renaming requests
 
 
# Any subsequent replacements operate on the modified name
name = newname
 
# Keep track of incremental renaming for use by debug
rensequence.append(newname)
# Show the incremental renaming steps if debug is on
 
if ProgramOptions[DEBUG]:
DebugMsg(dRENSEQ % ARROW.join(rensequence))
 
# Nothing to do, if old- and new names are the same
 
if newname != oldname:
self.__RenameIt(pathname, oldname, newname)