Skip to content

Commit 4946825

Browse files
committed
Add comments and clean up
1 parent 5ac7a6f commit 4946825

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

check_tools/config-update.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,19 @@ def main(file):
105105
print("\t------- Tag: %s -------" % tag)
106106

107107
start_of_config_block = file.find('Name:', start)
108-
updated_config = str(file[ : start_of_config_block]) # + "Configuration parameters\n------------------------\n")
108+
updated_config = str(file[ : start_of_config_block])
109109
for line in out.splitlines():
110110
if 'Name' in line and tag in line:
111111
updated_config += line
112112

113113
# Collect all text until next parameter name. If there's no following 'Name:' token, its the last
114-
# config option, match to 'Macros' instead to termiante the block
115-
if out.find('Name:', out.find(line) + 4) > 0:
116-
updated_config += out[out.find('\n', out.find(line)) : out.find('Name:', out.find(line) + 4)]
114+
# config option, match to 'Macros' instead to termiante the block. Offset starting index to avoid finding
115+
# the current line's 'Name:' token.
116+
eol = out.find('\n', out.find(line))
117+
if out.find('Name:', out.find(line) + len('Name:')) > 0:
118+
updated_config += out[eol : out.find('Name:', out.find(line) + len('Name:'))]
117119
else:
118-
updated_config += out[out.find('\n', out.find(line)) : out.find('Macros', out.find(line) + 4)]
120+
updated_config += out[eol : out.find('Macros', out.find(line))]
119121

120122
updated_config += str(file[end:])
121123
else:

0 commit comments

Comments
 (0)