summaryrefslogtreecommitdiffstats
path: root/lib/python/qmk/cli/chibios/confmigrate.py
diff options
context:
space:
mode:
authorZach White <skullydazed@gmail.com>2021-02-27 12:00:50 -0800
committerGitHub <noreply@github.com>2021-02-27 12:00:50 -0800
commit1581ea48dcd48d0d3f42cc09b388c468aedec45d (patch)
tree2d028036a4bf80c2e47b952931544f95ba2174e9 /lib/python/qmk/cli/chibios/confmigrate.py
parent23ed6c4ec0bfb27612da8a7b78d1b484acc23f3f (diff)
Fix develop (#12039)
Fixes file encoding errors on Windows, and layouts not correctly merging into info.json. * force utf8 encoding * correctly merge layouts and layout aliases * show what aliases point to
Diffstat (limited to 'lib/python/qmk/cli/chibios/confmigrate.py')
-rw-r--r--lib/python/qmk/cli/chibios/confmigrate.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/python/qmk/cli/chibios/confmigrate.py b/lib/python/qmk/cli/chibios/confmigrate.py
index 3e348b2b07..89995931a4 100644
--- a/lib/python/qmk/cli/chibios/confmigrate.py
+++ b/lib/python/qmk/cli/chibios/confmigrate.py
@@ -40,7 +40,7 @@ file_header = """\
def collect_defines(filepath):
- with open(filepath, 'r') as f:
+ with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
define_search = re.compile(r'(?m)^#\s*define\s+(?:.*\\\r?\n)*.*$', re.MULTILINE)
value_search = re.compile(r'^#\s*define\s+(?P<name>[a-zA-Z0-9_]+(\([^\)]*\))?)\s*(?P<value>.*)', re.DOTALL)
@@ -146,17 +146,17 @@ def chibios_confmigrate(cli):
if cli.args.input.name == "chconf.h" and ("CHCONF_H" in input_defs["dict"] or "_CHCONF_H_" in input_defs["dict"] or cli.args.force):
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", encoding='utf-8') as out_file:
migrate_chconf_h(to_override, outfile=out_file)
elif cli.args.input.name == "halconf.h" and ("HALCONF_H" in input_defs["dict"] or "_HALCONF_H_" in input_defs["dict"] or cli.args.force):
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", encoding='utf-8') as out_file:
migrate_halconf_h(to_override, outfile=out_file)
elif cli.args.input.name == "mcuconf.h" and ("MCUCONF_H" in input_defs["dict"] or "_MCUCONF_H_" in input_defs["dict"] or cli.args.force):
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", encoding='utf-8') as out_file:
migrate_mcuconf_h(to_override, outfile=out_file)