Merge remote-tracking branch 'origin/master' into develop

master
zvecr 2024-03-13 00:30:09 +00:00
commit 66060f1935
1 changed files with 13 additions and 5 deletions

View File

@ -12,12 +12,20 @@ from qmk.errors import NoSuchKeyboardError
def is_keyboard(keyboard_name): def is_keyboard(keyboard_name):
"""Returns True if `keyboard_name` is a keyboard we can compile. """Returns True if `keyboard_name` is a keyboard we can compile.
""" """
if keyboard_name: if not keyboard_name:
keyboard_path = QMK_FIRMWARE / 'keyboards' / keyboard_name return False
rules_mk = keyboard_path / 'rules.mk'
keyboard_json = keyboard_path / 'keyboard.json'
return rules_mk.exists() or keyboard_json.exists() # keyboard_name values of 'c:/something' or '/something' trigger append issues
# due to "If the argument is an absolute path, the previous path is ignored"
# however it should always be a folder located under qmk_firmware/keyboards
if Path(keyboard_name).is_absolute():
return False
keyboard_path = QMK_FIRMWARE / 'keyboards' / keyboard_name
rules_mk = keyboard_path / 'rules.mk'
keyboard_json = keyboard_path / 'keyboard.json'
return rules_mk.exists() or keyboard_json.exists()
def under_qmk_firmware(path=Path(os.environ['ORIG_CWD'])): def under_qmk_firmware(path=Path(os.environ['ORIG_CWD'])):