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")
|
|
|
|
makefile.write(re.sub("Appname:="+oldname,"Appname:="+newname,maketxt))
|
|
|
|
makefile.close()
|
|
|
|
|
|
|
|
for filename in ["./Makefile","./dat/"+newname+".desktop"]:
|
|
|
|
replaceInFile(oldname,newname,filename)
|
|
|
|
|
2015-02-21 14:19:19 +00:00
|
|
|
|
|
|
|
namefile=open("./appname.txt","w")
|
|
|
|
namefile.write(newname+"\n")
|
|
|
|
namefile.close()
|