aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRyan <[email protected]>2024-06-20 04:43:23 +1000
committerGitHub <[email protected]>2024-06-19 19:43:23 +0100
commit0a5b8928202078a7a64b7fadf11b0fc25a26b4a6 (patch)
tree75082f19e672cab32d62bc4bdf7b06b4a0bf7624 /lib
parent53a0cdc4467fb688faa2708fe75daa26686e918d (diff)
downloadqmk_firmware-0a5b8928202078a7a64b7fadf11b0fc25a26b4a6.tar.gz
qmk_firmware-0a5b8928202078a7a64b7fadf11b0fc25a26b4a6.zip
[CLI] Force `dump_lines()` to always use Unix line endings (#23954)
Diffstat (limited to 'lib')
-rw-r--r--lib/python/qmk/commands.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/python/qmk/commands.py b/lib/python/qmk/commands.py
index 3db8353bfd..873380c28b 100644
--- a/lib/python/qmk/commands.py
+++ b/lib/python/qmk/commands.py
@@ -102,7 +102,9 @@ def dump_lines(output_file, lines, quiet=True):
output_file.parent.mkdir(parents=True, exist_ok=True)
if output_file.exists():
output_file.replace(output_file.parent / (output_file.name + '.bak'))
- output_file.write_text(generated, encoding='utf-8')
+ with open(output_file, 'w', encoding='utf-8', newline='\n') as f:
+ f.write(generated)
+ # output_file.write_text(generated, encoding='utf-8', newline='\n') # `newline` needs Python 3.10
if not quiet:
cli.log.info(f'Wrote {output_file.name} to {output_file}.')