From 6380844ec697cedfc576739cac3900d883b66b10 Mon Sep 17 00:00:00 2001 From: Jack Rosenthal Date: Wed, 9 Aug 2023 16:24:14 -0600 Subject: [PATCH] FROMPULL: scripts: zephyr_module: Tolerate symlinks Currently, this script will blow up when given a symlink for a path (e.g., to a kconfig file). This is annoying, as when wrapping the build system in a hermetic build system like Bazel, Bazel likes to limit the input file set by creating symlinks. Resolve the path, if it is a file once resolved, then it's OK. https://github.com/zephyrproject-rtos/zephyr/pull/61352 BUG=b:274648575 TEST=CQ Change-Id: Ic002946737bb41025e09b1b5dec33fb29dab7987 Signed-off-by: Jack Rosenthal Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/4771184 Reviewed-by: Aaron Massey --- scripts/zephyr_module.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/zephyr_module.py b/scripts/zephyr_module.py index 938d0e4cd5b..db58bcea23c 100755 --- a/scripts/zephyr_module.py +++ b/scripts/zephyr_module.py @@ -162,10 +162,10 @@ def validate_setting(setting, module_path, filename=None): if setting is not None: if filename is not None: - checkfile = os.path.join(module_path, setting, filename) + checkfile = Path(module_path) / setting / filename else: - checkfile = os.path.join(module_path, setting) - if not os.path.isfile(checkfile): + checkfile = Path(module_path) / setting + if not checkfile.resolve().is_file(): return False return True