[CLI] Make qmk doctor more lenient about system config (#13804)

This commit is contained in:
ruro 2021-07-31 07:43:42 +03:00 committed by GitHub
parent 6d82c92476
commit 52dad230d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -159,6 +159,6 @@ def check_git_repo():
This is a decent enough indicator that the qmk_firmware directory is a This is a decent enough indicator that the qmk_firmware directory is a
proper Git repository, rather than a .zip download from GitHub. proper Git repository, rather than a .zip download from GitHub.
""" """
dot_git_dir = QMK_FIRMWARE / '.git' dot_git = QMK_FIRMWARE / '.git'
return CheckStatus.OK if dot_git_dir.is_dir() else CheckStatus.WARNING return CheckStatus.OK if dot_git.exists() else CheckStatus.WARNING

View File

@ -41,7 +41,12 @@ def check_udev_rules():
"""Make sure the udev rules look good. """Make sure the udev rules look good.
""" """
rc = CheckStatus.OK rc = CheckStatus.OK
udev_dir = Path("/etc/udev/rules.d/") udev_dirs = [
Path("/usr/lib/udev/rules.d/"),
Path("/usr/local/lib/udev/rules.d/"),
Path("/run/udev/rules.d/"),
Path("/etc/udev/rules.d/"),
]
desired_rules = { desired_rules = {
'atmel-dfu': { 'atmel-dfu': {
_udev_rule("03eb", "2fef"), # ATmega16U2 _udev_rule("03eb", "2fef"), # ATmega16U2
@ -90,8 +95,8 @@ def check_udev_rules():
'tmk': {_deprecated_udev_rule("feed")} 'tmk': {_deprecated_udev_rule("feed")}
} }
if udev_dir.exists(): if any(udev_dir.exists() for udev_dir in udev_dirs):
udev_rules = [rule_file for rule_file in udev_dir.glob('*.rules')] udev_rules = [rule_file for udev_dir in udev_dirs for rule_file in udev_dir.glob('*.rules')]
current_rules = set() current_rules = set()
# Collect all rules from the config files # Collect all rules from the config files
@ -117,7 +122,8 @@ def check_udev_rules():
cli.log.warning("{fg_yellow}Missing or outdated udev rules for '%s' boards. Run 'sudo cp %s/util/udev/50-qmk.rules /etc/udev/rules.d/'.", bootloader, QMK_FIRMWARE) cli.log.warning("{fg_yellow}Missing or outdated udev rules for '%s' boards. Run 'sudo cp %s/util/udev/50-qmk.rules /etc/udev/rules.d/'.", bootloader, QMK_FIRMWARE)
else: else:
cli.log.warning("{fg_yellow}'%s' does not exist. Skipping udev rule checking...", udev_dir) cli.log.warning("{fg_yellow}Can't find udev rules, skipping udev rule checking...")
cli.log.debug("Checked directories: %s", ', '.join(str(udev_dir) for udev_dir in udev_dirs))
return rc return rc