Commit 6d326eae authored by Morten Ofstad's avatar Morten Ofstad
Browse files

Don't merge methods marked as IMPLEMENTED into the AUTOGEN section.

parent 1d8ad7ca
......@@ -15,14 +15,19 @@ for f in sourcefiles:
print("Merging: {}".format(t), end=' ')
source_contents = ''
target_contents = ''
with open(f, "rb") as infile:
with open(f, 'rb') as infile:
source_contents = infile.read().decode().replace('\r', '')
with open(t, 'rb') as targetfile:
target_contents = targetfile.read().decode().replace('\r', '')
target_lines = target_contents.splitlines()
implemented = [l[l.index(':')+1:].strip() for l in target_lines if '// IMPLEMENTED :' in l]
source_lines = source_contents.splitlines()
unimplemented = [l for l in source_lines if not l.strip() in implemented]
source_lines = '\n'.join(unimplemented) + '\n' if unimplemented else ''
if merge_begin in target_contents and merge_end in target_contents:
prefix = target_contents[:target_contents.index(merge_begin)+len(merge_begin)+1]
suffix = target_contents[target_contents.index(merge_end):]
merged = prefix + source_contents + suffix
merged = prefix + source_lines + suffix
if merged == target_contents:
print("[unchanged]")
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment