diff options
Diffstat (limited to 'lib/python/qmk/cli/chibios/confmigrate.py')
-rw-r--r-- | lib/python/qmk/cli/chibios/confmigrate.py | 8 |
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 3e348b2b0..89995931a 100644 --- a/lib/python/qmk/cli/chibios/confmigrate.py +++ b/lib/python/qmk/cli/chibios/confmigrate.py | |||
@@ -40,7 +40,7 @@ file_header = """\ | |||
40 | 40 | ||
41 | 41 | ||
42 | def collect_defines(filepath): | 42 | def collect_defines(filepath): |
43 | with open(filepath, 'r') as f: | 43 | with open(filepath, 'r', encoding='utf-8') as f: |
44 | content = f.read() | 44 | content = f.read() |
45 | define_search = re.compile(r'(?m)^#\s*define\s+(?:.*\\\r?\n)*.*$', re.MULTILINE) | 45 | define_search = re.compile(r'(?m)^#\s*define\s+(?:.*\\\r?\n)*.*$', re.MULTILINE) |
46 | value_search = re.compile(r'^#\s*define\s+(?P<name>[a-zA-Z0-9_]+(\([^\)]*\))?)\s*(?P<value>.*)', re.DOTALL) | 46 | 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): | |||
146 | 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): | 146 | 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): |
147 | migrate_chconf_h(to_override, outfile=sys.stdout) | 147 | migrate_chconf_h(to_override, outfile=sys.stdout) |
148 | if cli.args.overwrite: | 148 | if cli.args.overwrite: |
149 | with open(cli.args.input, "w") as out_file: | 149 | with open(cli.args.input, "w", encoding='utf-8') as out_file: |
150 | migrate_chconf_h(to_override, outfile=out_file) | 150 | migrate_chconf_h(to_override, outfile=out_file) |
151 | 151 | ||
152 | 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): | 152 | 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): |
153 | migrate_halconf_h(to_override, outfile=sys.stdout) | 153 | migrate_halconf_h(to_override, outfile=sys.stdout) |
154 | if cli.args.overwrite: | 154 | if cli.args.overwrite: |
155 | with open(cli.args.input, "w") as out_file: | 155 | with open(cli.args.input, "w", encoding='utf-8') as out_file: |
156 | migrate_halconf_h(to_override, outfile=out_file) | 156 | migrate_halconf_h(to_override, outfile=out_file) |
157 | 157 | ||
158 | 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): | 158 | 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): |
159 | migrate_mcuconf_h(to_override, outfile=sys.stdout) | 159 | migrate_mcuconf_h(to_override, outfile=sys.stdout) |
160 | if cli.args.overwrite: | 160 | if cli.args.overwrite: |
161 | with open(cli.args.input, "w") as out_file: | 161 | with open(cli.args.input, "w", encoding='utf-8') as out_file: |
162 | migrate_mcuconf_h(to_override, outfile=out_file) | 162 | migrate_mcuconf_h(to_override, outfile=out_file) |