From dfedb440f02c941bf2717e6f892f06e81acf607f Mon Sep 17 00:00:00 2001 From: Dmytro Bagrii Date: Thu, 3 Jul 2025 13:51:00 +0300 Subject: [PATCH] Option to disable udev rules check This introduces "disable_udev_rules_check" option in Linux environment. If set to True, udev rules are not checked. This allows to suppress annoying warnings when 99-platformio-udev.rules is not installed intentionally. If set to False (default), udev rules are checked as before. --- platformio/app.py | 7 +++++++ platformio/fs.py | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/platformio/app.py b/platformio/app.py index 7d2f1ea9b7..5031409a74 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -26,6 +26,7 @@ from platformio.package.lockfile import LockFile from platformio.project.config import ProjectConfig from platformio.project.helpers import get_default_projects_dir +from platformio.util import get_systype def projects_dir_validate(projects_dir): @@ -65,6 +66,12 @@ def projects_dir_validate(projects_dir): }, } +if "linux" in get_systype(): + DEFAULT_SETTINGS["disable_udev_rules_check"] = { + "description": "Disable udev rules check", + "value": False + } + SESSION_VARS = { "command_ctx": None, "caller_id": None, diff --git a/platformio/fs.py b/platformio/fs.py index c70a554e75..9eeab4d506 100644 --- a/platformio/fs.py +++ b/platformio/fs.py @@ -24,7 +24,7 @@ import click -from platformio import exception +from platformio import exception, app from platformio.compat import IS_WINDOWS @@ -120,7 +120,7 @@ def _rules_to_set(rules_path): result.add(line) return result - if "linux" not in get_systype(): + if "linux" not in get_systype() or app.get_setting("disable_udev_rules_check"): return None installed_rules = [ "/etc/udev/rules.d/99-platformio-udev.rules",