Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion clang/www/make_cxx_dr_status
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,22 @@ out_html.append('''\
</html>
''')

out_file = open(output, 'w')
# Make an effort to remain consistent with the existing file.
# We can't pick one newline style and use it on Windows,
# because we can't be compatible with all 'autocrlf' modes at once.
def detect_newline_style(file_path):
if not os.path.exists(file_path):
return '\n'
f = open(file_path)
f.readline()
if f.newlines is None:
return '\n'
if isinstance(f.newlines, str):
return f.newlines
newline = f.newlines[0]
print(f"Existing '{file_path}' has inconsistent newlines; picking '{newline.encode('unicode_escape').decode('utf-8')}'")
return newline

out_file = open(output, 'w', newline=detect_newline_style(output))
out_file.write(''.join(out_html))
out_file.close()