diff options
Diffstat (limited to 'lib/python/qmk')
-rwxr-xr-x | lib/python/qmk/cli/generate/config_h.py | 6 | ||||
-rwxr-xr-x | lib/python/qmk/cli/generate/develop_pr_list.py | 14 | ||||
-rw-r--r-- | lib/python/qmk/cli/generate/version_h.py | 3 | ||||
-rwxr-xr-x | lib/python/qmk/cli/multibuild.py | 3 | ||||
-rw-r--r-- | lib/python/qmk/constants.py | 2 | ||||
-rw-r--r-- | lib/python/qmk/info.py | 28 | ||||
-rw-r--r-- | lib/python/qmk/tests/test_cli_commands.py | 2 |
7 files changed, 47 insertions, 11 deletions
diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py index f16dca1de8..6b1012fae7 100755 --- a/lib/python/qmk/cli/generate/config_h.py +++ b/lib/python/qmk/cli/generate/config_h.py @@ -108,6 +108,12 @@ def generate_config_items(kb_info_json, config_h_lines): config_h_lines.append(f'#ifndef {key}') config_h_lines.append(f'# define {key} {value}') config_h_lines.append(f'#endif // {key}') + elif key_type == 'bcd_version': + (major, minor, revision) = config_value.split('.') + config_h_lines.append('') + config_h_lines.append(f'#ifndef {config_key}') + config_h_lines.append(f'# define {config_key} 0x{major.zfill(2)}{minor}{revision}') + config_h_lines.append(f'#endif // {config_key}') else: config_h_lines.append('') config_h_lines.append(f'#ifndef {config_key}') diff --git a/lib/python/qmk/cli/generate/develop_pr_list.py b/lib/python/qmk/cli/generate/develop_pr_list.py index 07e46752a6..09236a7c42 100755 --- a/lib/python/qmk/cli/generate/develop_pr_list.py +++ b/lib/python/qmk/cli/generate/develop_pr_list.py @@ -12,6 +12,14 @@ fix_expr = re.compile(r'fix', flags=re.IGNORECASE) clean1_expr = re.compile(r'\[(develop|keyboard|keymap|core|cli|bug|docs|feature)\]', flags=re.IGNORECASE) clean2_expr = re.compile(r'^(develop|keyboard|keymap|core|cli|bug|docs|feature):', flags=re.IGNORECASE) +ignored_titles = ["Format code according to conventions"] + + +def _is_ignored(title): + for ignore in ignored_titles: + if ignore in title: + return + def _get_pr_info(cache, gh, pr_num): pull = cache.get(f'pull:{pr_num}') @@ -81,7 +89,9 @@ def generate_develop_pr_list(cli): else: normal_collection.append(info) - if "dependencies" in commit_info['pr_labels']: + if _is_ignored(commit_info['title']): + return + elif "dependencies" in commit_info['pr_labels']: fix_or_normal(commit_info, pr_list_bugs, pr_list_dependencies) elif "core" in commit_info['pr_labels']: fix_or_normal(commit_info, pr_list_bugs, pr_list_core) @@ -97,7 +107,7 @@ def generate_develop_pr_list(cli): match = git_expr.search(line) if match: pr_info = _get_pr_info(cache, gh, match.group("pr")) - commit_info = {'hash': match.group("hash"), 'title': match.group("title"), 'pr_num': int(match.group("pr")), 'pr_labels': [label.name for label in pr_info.labels.items]} + commit_info = {'hash': match.group("hash"), 'title': pr_info['title'], 'pr_num': int(match.group("pr")), 'pr_labels': [label.name for label in pr_info.labels.items]} _categorise_commit(commit_info) def _dump_commit_list(name, collection): diff --git a/lib/python/qmk/cli/generate/version_h.py b/lib/python/qmk/cli/generate/version_h.py index b8e52588c4..69341e36f0 100644 --- a/lib/python/qmk/cli/generate/version_h.py +++ b/lib/python/qmk/cli/generate/version_h.py @@ -20,6 +20,9 @@ def generate_version_h(cli): version_h = create_version_h(cli.args.skip_git, cli.args.skip_all) if cli.args.output: + cli.args.output.parent.mkdir(parents=True, exist_ok=True) + if cli.args.output.exists(): + cli.args.output.replace(cli.args.output.parent / (cli.args.output.name + '.bak')) cli.args.output.write_text(version_h) if not cli.args.quiet: diff --git a/lib/python/qmk/cli/multibuild.py b/lib/python/qmk/cli/multibuild.py index 85ed0fa1e9..ad059edff3 100755 --- a/lib/python/qmk/cli/multibuild.py +++ b/lib/python/qmk/cli/multibuild.py @@ -32,6 +32,7 @@ def _is_split(keyboard_name): @cli.argument('-c', '--clean', arg_only=True, action='store_true', help="Remove object files before compiling.") @cli.argument('-f', '--filter', arg_only=True, action='append', default=[], help="Filter the list of keyboards based on the supplied value in rules.mk. Supported format is 'SPLIT_KEYBOARD=yes'. May be passed multiple times.") @cli.argument('-km', '--keymap', type=str, default='default', help="The keymap name to build. Default is 'default'.") +@cli.argument('-e', '--env', arg_only=True, action='append', default=[], help="Set a variable to be passed to make. May be passed multiple times.") @cli.subcommand('Compile QMK Firmware for all keyboards.', hidden=False if cli.config.user.developer else True) def multibuild(cli): """Compile QMK Firmware against all keyboards. @@ -68,7 +69,7 @@ def multibuild(cli): all: {keyboard_safe}_binary {keyboard_safe}_binary: @rm -f "{QMK_FIRMWARE}/.build/failed.log.{keyboard_safe}" || true - +@$(MAKE) -C "{QMK_FIRMWARE}" -f "{QMK_FIRMWARE}/build_keyboard.mk" KEYBOARD="{keyboard_name}" KEYMAP="{cli.args.keymap}" REQUIRE_PLATFORM_KEY= COLOR=true SILENT=false \\ + +@$(MAKE) -C "{QMK_FIRMWARE}" -f "{QMK_FIRMWARE}/build_keyboard.mk" KEYBOARD="{keyboard_name}" KEYMAP="{cli.args.keymap}" REQUIRE_PLATFORM_KEY= COLOR=true SILENT=false {' '.join(cli.args.env)} \\ >>"{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" 2>&1 \\ || cp "{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" "{QMK_FIRMWARE}/.build/failed.log.{os.getpid()}.{keyboard_safe}" @{{ grep '\[ERRORS\]' "{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" >/dev/null 2>&1 && printf "Build %-64s \e[1;31m[ERRORS]\e[0m\\n" "{keyboard_name}:{cli.args.keymap}" ; }} \\ diff --git a/lib/python/qmk/constants.py b/lib/python/qmk/constants.py index 433b110523..00e453189f 100644 --- a/lib/python/qmk/constants.py +++ b/lib/python/qmk/constants.py @@ -13,7 +13,7 @@ QMK_FIRMWARE_UPSTREAM = 'qmk/qmk_firmware' MAX_KEYBOARD_SUBFOLDERS = 5 # Supported processor types -CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK66FX1M0', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F405', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32L412', 'STM32L422', 'STM32L433', 'STM32L443', 'GD32VF103', 'WB32F3G71' +CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK66FX1M0', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F405', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32L412', 'STM32L422', 'STM32L432', 'STM32L433', 'STM32L442', 'STM32L443', 'GD32VF103', 'WB32F3G71' LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85' diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index 9a07fc842f..905f10ecc2 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -387,6 +387,19 @@ def _extract_matrix_info(info_data, config_c): return info_data +# TODO: kill off usb.device_ver in favor of usb.device_version +def _extract_device_version(info_data): + if info_data.get('usb'): + if info_data['usb'].get('device_version') and not info_data['usb'].get('device_ver'): + (major, minor, revision) = info_data['usb']['device_version'].split('.', 3) + info_data['usb']['device_ver'] = f'0x{major.zfill(2)}{minor}{revision}' + if not info_data['usb'].get('device_version') and info_data['usb'].get('device_ver'): + major = int(info_data['usb']['device_ver'][2:4]) + minor = int(info_data['usb']['device_ver'][4]) + revision = int(info_data['usb']['device_ver'][5]) + info_data['usb']['device_version'] = f'{major}.{minor}.{revision}' + + def _extract_config_h(info_data): """Pull some keyboard information from existing config.h files """ @@ -430,6 +443,13 @@ def _extract_config_h(info_data): elif key_type == 'int': dotty_info[info_key] = int(config_c[config_key]) + elif key_type == 'bcd_version': + major = int(config_c[config_key][2:4]) + minor = int(config_c[config_key][4]) + revision = int(config_c[config_key][5]) + + dotty_info[info_key] = f'{major}.{minor}.{revision}' + else: dotty_info[info_key] = config_c[config_key] @@ -444,6 +464,7 @@ def _extract_config_h(info_data): _extract_split_main(info_data, config_c) _extract_split_transport(info_data, config_c) _extract_split_right_pins(info_data, config_c) + _extract_device_version(info_data) return info_data @@ -622,12 +643,7 @@ def arm_processor_rules(info_data, rules): info_data['protocol'] = 'ChibiOS' if 'bootloader' not in info_data: - if 'STM32' in info_data['processor']: - info_data['bootloader'] = 'stm32-dfu' - elif 'WB32' in info_data['processor']: - info_data['bootloader'] = 'wb32-dfu' - else: - info_data['bootloader'] = 'unknown' + info_data['bootloader'] = 'unknown' if 'STM32' in info_data['processor']: info_data['platform'] = 'STM32' diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py index 2973f81702..54b143c64f 100644 --- a/lib/python/qmk/tests/test_cli_commands.py +++ b/lib/python/qmk/tests/test_cli_commands.py @@ -113,7 +113,7 @@ def test_list_keymaps_community(): def test_list_keymaps_kb_only(): - result = check_subcommand('list-keymaps', '-kb', 'niu_mini') + result = check_subcommand('list-keymaps', '-kb', 'contra') check_returncode(result) assert 'default' and 'via' in result.stdout |