diff --git a/tren.py b/tren.py index 105c65e..0b7ec90 100755 --- a/tren.py +++ b/tren.py @@ -8,7 +8,7 @@ PROGNAME = "tren.py" BASENAME = PROGNAME.split(".py")[0] PROGENV = BASENAME.upper() -RCSID = "$Id: tren.py,v 1.142 2010/02/05 03:00:24 tundra Exp $" +RCSID = "$Id: tren.py,v 1.143 2010/02/05 03:48:17 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -441,11 +441,10 @@ for target in self.SortViews[ORDERBYCMDLINE]: - newname, pathname = self.RenNames[target][BASE], self.RenNames[target][PATHNAME] + basename, pathname = self.RenNames[target][BASE], self.RenNames[target][PATHNAME] for renrequest in self.RenRequests: old, new = self.ResolveRenameStrings(renrequest[OLD], renrequest[NEW]) - oldstrings = [] # Build a list of indexes to every occurence of the old string, @@ -455,24 +454,21 @@ # This means to *replace the entire* old name with new. if not old: - oldstrings = [0,] - newname = "" + old = basename - # Handle case where an old is non-null - else: - name = newname + # Collapse case if requested - # Collapse case if requested - if not renrequest[CASESENSITIVE]: + name = basename + if not renrequest[CASESENSITIVE]: - name = name.lower() - old = old.lower() + name = name.lower() + old = old.lower() - i = name.find(old) - while i >= 0: + i = name.find(old) + while i >= 0: - oldstrings.append(i) - i = name.find(old, i + len(old)) + oldstrings.append(i) + i = name.find(old, i + len(old)) # If we found any maching strings, replace them @@ -489,9 +485,9 @@ oldstrings.reverse() for i in oldstrings: - newname = newname[:i] + new + newname[i + len(old):] + basename = basename[:i] + new + basename[i + len(old):] - print ColumnPad([target, pathname + newname], padwidth = 50) + print ColumnPad([target, pathname + basename], padwidth = 50) # End of 'Rename()' @@ -692,7 +688,7 @@ # code below will break. OPTIONS = " ".join(OPTIONS).replace(INCL, INCL+" ").split() - + # Resolve include file references allowing for nested includes. # This has to be done here separate from the command line options so # that getopt() processing below will "see" the included statements. @@ -796,7 +792,6 @@ if envopt: OPTIONS = envopt.split() + OPTIONS - # Check for debug manually to see if we want # debug info about includes