[PATCH v2] scripts/spdxcheck: add friendly error message for missing ply module
From: 3237174131
Date: Thu Aug 27 2026 - 01:52:22 EST
Changes since v1:
- Remove email headers from patch body
The spdxcheck.py script requires the 'ply' Python module, but when
it is missing, the script crashes with a raw ImportError traceback.
This is especially problematic in CI environments where the error
is not immediately obvious.
Add a friendly error message that tells the user exactly what is
needed and how to install it.
Signed-off-by: Xia Zhoxin <3237174131@xxxxxx>
---
scripts/spdxcheck.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py
--- a/scripts/spdxcheck.py
+++ b/scripts/spdxcheck.py
@@ -5,7 +5,13 @@
from argparse import ArgumentParser
-from ply import lex, yacc
+try:
+ from ply import lex, yacc
+except ImportError as e:
+ import sys
+ sys.stderr.write('Error: %s\n' % e)
+ sys.stderr.write('Please install the ply module (e.g., pip install ply)\n')
+ sys.exit(1)
import locale
import traceback
import fnmatch