diff options
author | Ryan <[email protected]> | 2022-03-05 00:25:24 +1100 |
---|---|---|
committer | GitHub <[email protected]> | 2022-03-04 13:25:24 +0000 |
commit | ace0603f4f060783ea91c224c0caec6c1b799f15 (patch) | |
tree | e97bc1c3e37d11e7daa0c4a1e5db0dacb5f01475 /lib/python/qmk/info.py | |
parent | f634fddd344a456c3eff8014d9d58a2d764d7a8c (diff) | |
download | qmk_firmware-ace0603f4f060783ea91c224c0caec6c1b799f15.tar.gz qmk_firmware-ace0603f4f060783ea91c224c0caec6c1b799f15.zip |
Change data driven "str" type to represent a quoted string literal (#16516)
* Change data driven "str" type to represent a quoted string literal
* Update docs
Diffstat (limited to 'lib/python/qmk/info.py')
-rw-r--r-- | lib/python/qmk/info.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index b86eaa059f..c399a9f321 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -411,7 +411,7 @@ def _extract_config_h(info_data): for config_key, info_dict in info_config_map.items(): info_key = info_dict['info_key'] - key_type = info_dict.get('value_type', 'str') + key_type = info_dict.get('value_type', 'raw') try: if config_key in config_c and info_dict.get('to_json', True): @@ -443,6 +443,9 @@ def _extract_config_h(info_data): elif key_type == 'int': dotty_info[info_key] = int(config_c[config_key]) + elif key_type == 'str': + dotty_info[info_key] = config_c[config_key].strip('"') + elif key_type == 'bcd_version': major = int(config_c[config_key][2:4]) minor = int(config_c[config_key][4]) @@ -491,7 +494,7 @@ def _extract_rules_mk(info_data): for rules_key, info_dict in info_rules_map.items(): info_key = info_dict['info_key'] - key_type = info_dict.get('value_type', 'str') + key_type = info_dict.get('value_type', 'raw') try: if rules_key in rules and info_dict.get('to_json', True): @@ -523,6 +526,9 @@ def _extract_rules_mk(info_data): elif key_type == 'int': dotty_info[info_key] = int(rules[rules_key]) + elif key_type == 'str': + dotty_info[info_key] = rules[rules_key].strip('"') + else: dotty_info[info_key] = rules[rules_key] |