From 5f853f4031fbb77172f131d2cc31a000aca49abe Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Mon, 17 Oct 2022 15:08:32 +0000 Subject: [PATCH] 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 --- tools/esmify/mach_commands.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/esmify/mach_commands.py b/tools/esmify/mach_commands.py index 4e4f2382c270..52f450afc722 100644 --- a/tools/esmify/mach_commands.py +++ b/tools/esmify/mach_commands.py @@ -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):