# HG changeset patch # User Brett Smith # Date 1241569678 14400 # Node ID fc00559c4ffa169e37fdb04cc13de204424169f1 # Parent b8316c2b36df9daf8672a0f54c51bce4c6cc896a Don't use str.rindex (not in Python 2.3); instead provide my own cheap version. diff -r b8316c2b36df -r fc00559c4ffa scripts/dtrx --- a/scripts/dtrx Tue May 05 20:14:36 2009 -0400 +++ b/scripts/dtrx Tue May 05 20:27:58 2009 -0400 @@ -491,6 +491,13 @@ list_command = ['7z', 'l'] border_re = re.compile('^[- ]+$') + def rindex(line, target): + for index in range(-1, -len(line) - 1, -1): + if line[index] == target: + return len(line) + index + raise ValueError("substring not found") + rindex = staticmethod(rindex) + def get_filenames(self): fn_index = None for line in NoPipeExtractor.get_filenames(self): @@ -498,7 +505,7 @@ if fn_index is not None: break else: - fn_index = line.rindex(' ') + 1 + fn_index = self.rindex(line, ' ') + 1 elif fn_index is not None: yield line[fn_index:] self.archive.close()