SEESenv/scripts/changenames.py
author amit@thunder
Mon, 01 Mar 2010 15:23:42 +0530
changeset 40 ef147a79b098
child 41 e54725be4df6
permissions -rw-r--r--
Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40
ef147a79b098 Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff changeset
     1
import glob
ef147a79b098 Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff changeset
     2
import subprocess
ef147a79b098 Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff changeset
     3
import re
ef147a79b098 Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff changeset
     4
import time
ef147a79b098 Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff changeset
     5
ef147a79b098 Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff changeset
     6
names= glob.glob('/home/hg/repos/SEES-hacks/temp/ch1*.html')
ef147a79b098 Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff changeset
     7
for name in names:
ef147a79b098 Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff changeset
     8
    reg_obj=re.compile('/home/hg/repos/SEES-hacks/temp/ch1[0-9].*.html')
ef147a79b098 Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff changeset
     9
    if (reg_obj.match(name)):
ef147a79b098 Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff changeset
    10
        changed_name=re.sub('ch1','chn1',name)
ef147a79b098 Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff changeset
    11
    else:
ef147a79b098 Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff changeset
    12
        changed_name=name    
ef147a79b098 Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff changeset
    13
    command="cp %s %s" %(name ,changed_name)
ef147a79b098 Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff changeset
    14
    subprocess.Popen(command,shell=True)
ef147a79b098 Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff changeset
    15
    time.sleep(2)