summaryrefslogtreecommitdiff
path: root/tools/scripts/addheader.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/scripts/addheader.py')
-rw-r--r--tools/scripts/addheader.py56
1 files changed, 28 insertions, 28 deletions
diff --git a/tools/scripts/addheader.py b/tools/scripts/addheader.py
index fac35372de..573d5182f5 100644
--- a/tools/scripts/addheader.py
+++ b/tools/scripts/addheader.py
@@ -1,4 +1,4 @@
-header="""\
+header = """\
/*************************************************************************/
/* $filename */
/*************************************************************************/
@@ -29,44 +29,44 @@ header="""\
/*************************************************************************/
"""
-f = open("files","rb")
+f = open("files", "rb")
fname = f.readline()
-while (fname!=""):
+while (fname != ""):
- fr = open(fname.strip(),"rb")
+ fr = open(fname.strip(), "rb")
l = fr.readline()
- bc=False
+ bc = False
fsingle = fname.strip()
- if (fsingle.find("/")!=-1):
- fsingle=fsingle[fsingle.rfind("/")+1:]
- rep_fl="$filename"
- rep_fi=fsingle
- len_fl=len(rep_fl)
- len_fi=len(rep_fi)
- if (len_fi<len_fl):
- for x in range(len_fl-len_fi):
- rep_fi+=" "
- elif (len_fl<len_fi):
- for x in range(len_fi-len_fl):
- rep_fl+=" "
- if (header.find(rep_fl)!=-1):
- text=header.replace(rep_fl,rep_fi)
+ if (fsingle.find("/") != -1):
+ fsingle = fsingle[fsingle.rfind("/") + 1:]
+ rep_fl = "$filename"
+ rep_fi = fsingle
+ len_fl = len(rep_fl)
+ len_fi = len(rep_fi)
+ if (len_fi < len_fl):
+ for x in range(len_fl - len_fi):
+ rep_fi += " "
+ elif (len_fl < len_fi):
+ for x in range(len_fi - len_fl):
+ rep_fl += " "
+ if (header.find(rep_fl) != -1):
+ text = header.replace(rep_fl, rep_fi)
else:
- text=header.replace("$filename",fsingle)
+ text = header.replace("$filename", fsingle)
- while (l!=""):
- if ((l.find("//")!=0 and l.find("/*")!=0 and l.strip()!="") or bc):
- text+=l
- bc=True
- l=fr.readline()
+ while (l != ""):
+ if ((l.find("//") != 0 and l.find("/*") != 0 and l.strip() != "") or bc):
+ text += l
+ bc = True
+ l = fr.readline()
fr.close()
- fr=open(fname.strip(),"wb")
+ fr = open(fname.strip(), "wb")
fr.write(text)
fr.close()
- #print(text)
- fname=f.readline()
+ # print(text)
+ fname = f.readline()