From 697e69a6d5e17911ad8feeaded1b158040eaf36f Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Thu, 7 Nov 2024 22:57:51 -0800 Subject: [PATCH] Warn on broken symlinks instead of error Bazel creates broken symlinks in the build folder. Fixes #293. --- wpiformat/wpiformat/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wpiformat/wpiformat/__init__.py b/wpiformat/wpiformat/__init__.py index 27dc877..e2e0009 100644 --- a/wpiformat/wpiformat/__init__.py +++ b/wpiformat/wpiformat/__init__.py @@ -439,8 +439,11 @@ def main(): # Throw an error if any files or directories don't exist for f in files: if not os.path.exists(f): - print(f"error: {f}: No such file or directory") - sys.exit(1) + if not os.path.islink(f): + print(f"error: {f}: No such file or directory") + sys.exit(1) + else: + print(f"warning: {f}: Broken symlink") # Convert relative paths of files to absolute paths files = [os.path.abspath(name) for name in files]