Bug 1794697 - Pass newline=\n when esmifying r=arai DONTBUILD

Python's `open('w')` by default uses system default line ending which is `\r\n` in Windows. `newline=\n` helps us to keep using `\n` everywhere.

Differential Revision: https://phabricator.services.mozilla.com/D159502
This commit is contained in:
Kagami Sascha Rosylight 2022-10-17 15:08:32 +00:00
parent e85a18c1f8
commit 5f853f4031

View File

@ -485,7 +485,7 @@ def try_rename_in(command_context, path, target, jsm_name, esm_name, jsm_path):
if modified:
info(f" {str(target_path)}")
info(f" {jsm_name} => {esm_name}")
with open(target_path, "w") as f:
with open(target_path, "w", newline="\n") as f:
f.write(content)
return True
@ -520,7 +520,7 @@ def try_rename_components_conf(command_context, path, jsm_name, esm_name):
info(f" {jsm_name} => {esm_name}")
content = prop_re.sub(r"'esModule':\1" + esm_name, content)
with open(target_path, "w") as f:
with open(target_path, "w", newline="\n") as f:
f.write(content)
return True
@ -538,7 +538,7 @@ def esmify_path(jsm_path):
def rename_single_file(command_context, vcs_utils, jsm_path):
"""Rename `jsm_path` to .sys.mjs, and fix refereces to the file in build and
"""Rename `jsm_path` to .sys.mjs, and fix references to the file in build and
test definitions."""
def warn(text):