From de0a765010677f128c841c90e9bf0b82304b6b13 Mon Sep 17 00:00:00 2001 From: Junjie Mao Date: Tue, 14 Mar 2023 21:46:08 +0800 Subject: [PATCH] config_tools: adapt to elementpath >= 4.0.0 Starting from elementpath 4.0.0, the XPath2Parser class no longer has a SYMBOLS member and completeness checking based on that are removed as well. This patch updates the elementpath_overlay in the config tools to fix the compilation issue when using recent elementpath versions. Tracked-On: #8368 Signed-off-by: Junjie Mao --- .../scenario_config/elementpath_overlay.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/misc/config_tools/scenario_config/elementpath_overlay.py b/misc/config_tools/scenario_config/elementpath_overlay.py index 0010fe496..e64f7c2fd 100644 --- a/misc/config_tools/scenario_config/elementpath_overlay.py +++ b/misc/config_tools/scenario_config/elementpath_overlay.py @@ -21,16 +21,17 @@ import library.rdt as rdt BaseParser = elementpath.XPath2Parser class CustomParser(BaseParser): - SYMBOLS = BaseParser.SYMBOLS | { - # Bit-wise operations - 'bitwise-and', + if hasattr(BaseParser, "SYMBOLS"): + SYMBOLS = BaseParser.SYMBOLS | { + # Bit-wise operations + 'bitwise-and', - 'bits-of', - 'has', - 'duplicate-values', + 'bits-of', + 'has', + 'duplicate-values', - 'number-of-clos-id-needed', - } + 'number-of-clos-id-needed', + } method = CustomParser.method function = CustomParser.function