1
0
Fork 0

QMK Userspace (#22222)

Co-authored-by: Duncan Sutherland <dunk2k_2000@hotmail.com>
This commit is contained in:
Nick Brassel 2023-11-28 07:53:43 +11:00 committed by GitHub
parent 094357c403
commit 5501e804ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 1085 additions and 111 deletions

View file

@ -10,6 +10,8 @@ from qmk.constants import QMK_FIRMWARE, INTERMEDIATE_OUTPUT_PREFIX
from qmk.commands import find_make, get_make_parallel_args, parse_configurator_json
from qmk.keyboard import keyboard_folder
from qmk.info import keymap_json
from qmk.keymap import locate_keymap
from qmk.path import is_under_qmk_firmware, is_under_qmk_userspace
class BuildTarget:
@ -158,6 +160,20 @@ class KeyboardKeymapBuildTarget(BuildTarget):
for key, value in env_vars.items():
compile_args.append(f'{key}={value}')
# Need to override the keymap path if the keymap is a userspace directory.
# This also ensures keyboard aliases as per `keyboard_aliases.hjson` still work if the userspace has the keymap
# in an equivalent historical location.
keymap_location = locate_keymap(self.keyboard, self.keymap)
if is_under_qmk_userspace(keymap_location) and not is_under_qmk_firmware(keymap_location):
keymap_directory = keymap_location.parent
compile_args.extend([
f'MAIN_KEYMAP_PATH_1={keymap_directory}',
f'MAIN_KEYMAP_PATH_2={keymap_directory}',
f'MAIN_KEYMAP_PATH_3={keymap_directory}',
f'MAIN_KEYMAP_PATH_4={keymap_directory}',
f'MAIN_KEYMAP_PATH_5={keymap_directory}',
])
return compile_args