diff options
Diffstat (limited to 'scripts/FileGenerator.py')
-rw-r--r-- | scripts/FileGenerator.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/scripts/FileGenerator.py b/scripts/FileGenerator.py index bedb16b2f..d35c93955 100644 --- a/scripts/FileGenerator.py +++ b/scripts/FileGenerator.py @@ -143,16 +143,16 @@ def UpdateLineInPlistFile(path, key, value): lines = [] keyCurrent = "" with codecs.open(path, "rb", "utf-8") as f: - for l in f.readlines(): - ls = l.strip() + for line in f.readlines(): + ls = line.strip() if ls.startswith("<key>"): keyCurrent = ls.replace("<key>", "").replace("</key>", "") elif ls.startswith("<string>"): if keyCurrent == key: - start, tag, rest = l.partition("<string>") + start, tag, rest = line.partition("<string>") _val, etag, end = rest.partition("</string>") - l = start + tag + value + etag + end - lines.append(l) + line = start + tag + value + etag + end + lines.append(line) contents = "".join(lines) UpdateFile(path, contents) @@ -160,13 +160,13 @@ def UpdateLineInFile(path, linePrefix, lineReplace): lines = [] updated = False with codecs.open(path, "r", "utf-8") as f: - for l in f.readlines(): - l = l.rstrip() - if not updated and l.startswith(linePrefix): + for line in f.readlines(): + line = line.rstrip() + if not updated and line.startswith(linePrefix): lines.append(lineReplace) updated = True else: - lines.append(l) + lines.append(line) if not updated: print(f"{path}:0: Can't find '{linePrefix}'") contents = lineEnd.join(lines) + lineEnd @@ -176,7 +176,7 @@ def ReadFileAsList(path): """Read all the lnes in the file and return as a list of strings without line ends. """ with codecs.open(path, "r", "utf-8") as f: - return [l.rstrip('\n') for l in f] + return [line.rstrip('\n') for line in f] def UpdateFileFromLines(path, lines, lineEndToUse): """Join the lines with the lineEndToUse then update file if the result is different. @@ -194,19 +194,19 @@ def FindSectionInList(lines, markers): start = -1 end = -1 state = 0 - for i, l in enumerate(lines): - if markers[0] in l: + for i, line in enumerate(lines): + if markers[0] in line: if markers[1]: state = 1 else: start = i+1 state = 2 elif state == 1: - if markers[1] in l: + if markers[1] in line: start = i+1 state = 2 elif state == 2: - if markers[2] in l: + if markers[2] in line: end = i state = 3 # Check that section was found |