diff options
author | Zach White <[email protected]> | 2021-02-27 12:00:50 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-27 12:00:50 -0800 |
commit | 1581ea48dcd48d0d3f42cc09b388c468aedec45d (patch) | |
tree | 2d028036a4bf80c2e47b952931544f95ba2174e9 /lib/python/qmk/c_parse.py | |
parent | 23ed6c4ec0bfb27612da8a7b78d1b484acc23f3f (diff) | |
download | qmk_firmware-1581ea48dcd48d0d3f42cc09b388c468aedec45d.tar.gz qmk_firmware-1581ea48dcd48d0d3f42cc09b388c468aedec45d.zip |
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/c_parse.py')
-rw-r--r-- | lib/python/qmk/c_parse.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/python/qmk/c_parse.py b/lib/python/qmk/c_parse.py index 89dd278b7e..d4f39c8839 100644 --- a/lib/python/qmk/c_parse.py +++ b/lib/python/qmk/c_parse.py @@ -46,7 +46,7 @@ def find_layouts(file): parsed_layouts = {} # Search the file for LAYOUT macros and aliases - file_contents = file.read_text() + file_contents = file.read_text(encoding='utf-8') file_contents = comment_remover(file_contents) file_contents = file_contents.replace('\\\n', '') @@ -87,12 +87,7 @@ def find_layouts(file): except ValueError: continue - # Populate our aliases - for alias, text in aliases.items(): - if text in parsed_layouts and 'KEYMAP' not in alias: - parsed_layouts[alias] = parsed_layouts[text] - - return parsed_layouts + return parsed_layouts, aliases def parse_config_h_file(config_h_file, config_h=None): @@ -104,7 +99,7 @@ def parse_config_h_file(config_h_file, config_h=None): config_h_file = Path(config_h_file) if config_h_file.exists(): - config_h_text = config_h_file.read_text() + config_h_text = config_h_file.read_text(encoding='utf-8') config_h_text = config_h_text.replace('\\\n', '') config_h_text = strip_multiline_comment(config_h_text) |