2015-02-21 14:19:19 +00:00
|
|
|
#!/usr/bin/python3 -u
|
|
|
|
|
|
|
|
import os,re,argparse
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser(description='namechange')
|
|
|
|
parser.add_argument('newname', metavar='name', type=str,
|
|
|
|
help='newname')
|
|
|
|
args=parser.parse_args()
|
|
|
|
|
|
|
|
newname=args.newname
|
|
|
|
oldname=open("./appname.txt").read()[:-1]
|
|
|
|
|
|
|
|
os.rename("./qml/"+oldname+".qml","./qml/"+newname+".qml")
|
|
|
|
os.rename("./dat/"+oldname+".desktop","./dat/"+newname+".desktop")
|
|
|
|
os.rename("./dat/"+oldname+".sh","./dat/"+newname+".sh")
|
|
|
|
|
2015-02-21 14:59:41 +00:00
|
|
|
def replaceInFile(oldname,newname,filename):
|
|
|
|
makefile=open(filename,"r")
|
|
|
|
maketxt=makefile.read()
|
|
|
|
makefile.close()
|
|
|
|
makefile=open(filename,"w")
|
2015-02-21 15:09:22 +00:00
|
|
|
makefile.write(re.sub(oldname,newname,maketxt))
|
2015-02-21 14:59:41 +00:00
|
|
|
makefile.close()
|
|
|
|
|
2015-03-08 17:38:02 +00:00
|
|
|
for filename in ["./Makefile","./dat/"+newname+".desktop","./dat/"+newname+".sh"]:
|
2015-02-21 14:59:41 +00:00
|
|
|
replaceInFile(oldname,newname,filename)
|
|
|
|
|
2015-02-21 14:19:19 +00:00
|
|
|
|
|
|
|
namefile=open("./appname.txt","w")
|
|
|
|
namefile.write(newname+"\n")
|
|
|
|
namefile.close()
|