Browse Source

use unix lineendings even on windows

Zach White 5 years ago
parent
commit
69e5e15ccc
2 changed files with 5 additions and 5 deletions
  1. 3 3
      lib/python/qmk/cli/chibios/confmigrate.py
  2. 2 2
      lib/python/qmk/cli/kle2json.py

+ 3 - 3
lib/python/qmk/cli/chibios/confmigrate.py

@@ -145,17 +145,17 @@ def chibios_confmigrate(cli):
         if "CHCONF_H" in input_defs["dict"] or "_CHCONF_H_" in input_defs["dict"]:
             migrate_chconf_h(to_override, outfile=sys.stdout)
             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)
 
         elif "HALCONF_H" in input_defs["dict"] or "_HALCONF_H_" in input_defs["dict"]:
             migrate_halconf_h(to_override, outfile=sys.stdout)
             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)
 
         elif "MCUCONF_H" in input_defs["dict"] or "_MCUCONF_H_" in input_defs["dict"]:
             migrate_mcuconf_h(to_override, outfile=sys.stdout)
             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)

+ 2 - 2
lib/python/qmk/cli/kle2json.py

@@ -140,7 +140,7 @@ def kle2json(cli):
     keyboard_dir.mkdir(exist_ok=True, parents=True)
     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)
 
     # Generate and write a keymap
@@ -165,5 +165,5 @@ def kle2json(cli):
         }
         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)