| |
---|
| | |
---|
| | PROGNAME = "tren.py" |
---|
| | BASENAME = PROGNAME.split(".py")[0] |
---|
| | PROGENV = BASENAME.upper() |
---|
| | RCSID = "$Id: tren.py,v 1.184 2010/03/10 22:18:20 tundra Exp $" |
---|
| | RCSID = "$Id: tren.py,v 1.185 2010/03/10 23:37:27 tundra Exp $" |
---|
| | VERSION = RCSID.split()[2] |
---|
| | |
---|
| | # Copyright Information |
---|
| | |
---|
| |
---|
| | ##### |
---|
| | |
---|
| | def __init__(self, targs): |
---|
| | |
---|
| | # Keep track of all the new filenames we write (or would have) |
---|
| | # so test mode can correctly report just what the the progam |
---|
| | # *would* do. Without this, backup generation is not properly |
---|
| | # reported in test mode. |
---|
| | |
---|
| | self.NewNames = [] |
---|
| | |
---|
| | # Dictionary of all rename targets and their stat info |
---|
| | |
---|
| | self.RenNames = {} |
---|
| | |
---|
| |
---|
| | # ourselves so that filename length limits are observed and |
---|
| | # backups-of-backups are preserved. |
---|
| | |
---|
| | doit = True |
---|
| | if os.path.exists(fullnew): |
---|
| | if os.path.exists(fullnew) or fullnew in self.NewNames: |
---|
| | |
---|
| | if ProgramOptions[FORCERENAME]: |
---|
| | |
---|
| | # Create the backup |
---|
| |
---|
| | doit = False |
---|
| | |
---|
| | if doit: |
---|
| | |
---|
| | self.NewNames.append(fullnew) |
---|
| | InfoMsg(indent + iRENAMING % (fullold, fullnew)) |
---|
| | |
---|
| | if not ProgramOptions[TESTMODE]: |
---|
| | |
---|
| |
---|
| | |
---|
| | if precision < 1: |
---|
| | ErrorMsg(eTOKRANDIG % str(precision)) |
---|
| | |
---|
| | fmt = '"%0' + str(precision) + 'd" % random.randint(0, pow(10, precision))' |
---|
| | fmt = '"%0' + str(precision) + 'd" % random.randint(0, pow(10, precision)-1)' |
---|
| | r[2] = eval(fmt) |
---|
| | |
---|
| | ### |
---|
| | # Sequence Renaming Tokens |
---|
| |
---|
| | |