use unix lineendings even on windows

This commit is contained in:
Zach White 2021-01-08 17:21:55 -08:00
parent 543e663c68
commit 69e5e15ccc
2 changed files with 5 additions and 5 deletions

View file

@ -145,17 +145,17 @@ def chibios_confmigrate(cli):
if "CHCONF_H" in input_defs["dict"] or "_CHCONF_H_" in input_defs["dict"]: if "CHCONF_H" in input_defs["dict"] or "_CHCONF_H_" in input_defs["dict"]:
migrate_chconf_h(to_override, outfile=sys.stdout) migrate_chconf_h(to_override, outfile=sys.stdout)
if cli.args.overwrite: if cli.args.overwrite:
with open(cli.args.input, "w") as out_file: with open(cli.args.input, "w", newline='\n') as out_file:
migrate_chconf_h(to_override, outfile=out_file) migrate_chconf_h(to_override, outfile=out_file)
elif "HALCONF_H" in input_defs["dict"] or "_HALCONF_H_" in input_defs["dict"]: elif "HALCONF_H" in input_defs["dict"] or "_HALCONF_H_" in input_defs["dict"]:
migrate_halconf_h(to_override, outfile=sys.stdout) migrate_halconf_h(to_override, outfile=sys.stdout)
if cli.args.overwrite: if cli.args.overwrite:
with open(cli.args.input, "w") as out_file: with open(cli.args.input, "w", newline='\n') as out_file:
migrate_halconf_h(to_override, outfile=out_file) migrate_halconf_h(to_override, outfile=out_file)
elif "MCUCONF_H" in input_defs["dict"] or "_MCUCONF_H_" in input_defs["dict"]: elif "MCUCONF_H" in input_defs["dict"] or "_MCUCONF_H_" in input_defs["dict"]:
migrate_mcuconf_h(to_override, outfile=sys.stdout) migrate_mcuconf_h(to_override, outfile=sys.stdout)
if cli.args.overwrite: if cli.args.overwrite:
with open(cli.args.input, "w") as out_file: with open(cli.args.input, "w", newline='\n') as out_file:
migrate_mcuconf_h(to_override, outfile=out_file) migrate_mcuconf_h(to_override, outfile=out_file)

View file

@ -140,7 +140,7 @@ def kle2json(cli):
keyboard_dir.mkdir(exist_ok=True, parents=True) keyboard_dir.mkdir(exist_ok=True, parents=True)
info_json_file = keyboard_dir / 'info.json' info_json_file = keyboard_dir / 'info.json'
json.dump(kb_info_json, info_json_file.open('w'), indent=4, separators=(', ', ': '), sort_keys=False, cls=InfoJSONEncoder) json.dump(kb_info_json, info_json_file.open('w', newline='\n'), indent=4, separators=(', ', ': '), sort_keys=False, cls=InfoJSONEncoder)
cli.log.info('Wrote file {fg_cyan}%s', info_json_file) cli.log.info('Wrote file {fg_cyan}%s', info_json_file)
# Generate and write a keymap # Generate and write a keymap
@ -165,5 +165,5 @@ def kle2json(cli):
} }
keymap_path.mkdir(exist_ok=True, parents=True) keymap_path.mkdir(exist_ok=True, parents=True)
json.dump(keymap_json, keymap_file.open('w'), indent=4, separators=(', ', ': '), sort_keys=False) json.dump(keymap_json, keymap_file.open('w', newline='\n'), indent=4, separators=(', ', ': '), sort_keys=False)
cli.log.info('Wrote file %s', keymap_file) cli.log.info('Wrote file %s', keymap_file)