scripts: dictionary: rename parser module to avoid name collision
The parser module collides with a module in python called parser.
Doesn't seem to be a problem in Linux but for some reason the
search/include order in Windows causes python to import the wrong
parser. The change is to rename the module to dictionary_parser
to avoid the name space collision.
fixes: #36339
Signed-off-by: David Leach <david.leach@nxp.com>
diff --git a/scripts/logging/dictionary/database_gen.py b/scripts/logging/dictionary/database_gen.py
index 52749cd..d0f6d28 100755
--- a/scripts/logging/dictionary/database_gen.py
+++ b/scripts/logging/dictionary/database_gen.py
@@ -18,8 +18,8 @@
import struct
import sys
-import parser.log_database
-from parser.log_database import LogDatabase
+import dictionary_parser.log_database
+from dictionary_parser.log_database import LogDatabase
import elftools
from elftools.elf.elffile import ELFFile
@@ -175,7 +175,7 @@
database.set_tgt_bits(64 if "CONFIG_64BIT" in kconfigs else 32)
# Architecture
- for name, arch in parser.log_database.ARCHS.items():
+ for name, arch in dictionary_parser.log_database.ARCHS.items():
if arch['kconfig'] in kconfigs:
database.set_arch(name)
break
@@ -194,7 +194,7 @@
# Some architectures may put static strings into additional sections.
# So need to extract them too.
- arch_data = parser.log_database.ARCHS[database.get_arch()]
+ arch_data = dictionary_parser.log_database.ARCHS[database.get_arch()]
if "extra_string_section" in arch_data:
string_sections.extend(arch_data['extra_string_section'])
diff --git a/scripts/logging/dictionary/parser/__init__.py b/scripts/logging/dictionary/dictionary_parser/__init__.py
similarity index 100%
rename from scripts/logging/dictionary/parser/__init__.py
rename to scripts/logging/dictionary/dictionary_parser/__init__.py
diff --git a/scripts/logging/dictionary/parser/log_database.py b/scripts/logging/dictionary/dictionary_parser/log_database.py
similarity index 100%
rename from scripts/logging/dictionary/parser/log_database.py
rename to scripts/logging/dictionary/dictionary_parser/log_database.py
diff --git a/scripts/logging/dictionary/parser/log_parser.py b/scripts/logging/dictionary/dictionary_parser/log_parser.py
similarity index 100%
rename from scripts/logging/dictionary/parser/log_parser.py
rename to scripts/logging/dictionary/dictionary_parser/log_parser.py
diff --git a/scripts/logging/dictionary/parser/log_parser_v1.py b/scripts/logging/dictionary/dictionary_parser/log_parser_v1.py
similarity index 100%
rename from scripts/logging/dictionary/parser/log_parser_v1.py
rename to scripts/logging/dictionary/dictionary_parser/log_parser_v1.py
diff --git a/scripts/logging/dictionary/parser/utils.py b/scripts/logging/dictionary/dictionary_parser/utils.py
similarity index 100%
rename from scripts/logging/dictionary/parser/utils.py
rename to scripts/logging/dictionary/dictionary_parser/utils.py
diff --git a/scripts/logging/dictionary/log_parser.py b/scripts/logging/dictionary/log_parser.py
index bfbe379..273b0cc 100755
--- a/scripts/logging/dictionary/log_parser.py
+++ b/scripts/logging/dictionary/log_parser.py
@@ -16,8 +16,8 @@
import logging
import sys
-import parser
-from parser.log_database import LogDatabase
+import dictionary_parser
+from dictionary_parser.log_database import LogDatabase
LOGGER_FORMAT = "%(message)s"
@@ -63,7 +63,7 @@
if args.hex:
if args.rawhex:
# Simply log file with only hexadecimal data
- logdata = parser.utils.convert_hex_file_to_bin(args.logfile)
+ logdata = dictionary_parser.utils.convert_hex_file_to_bin(args.logfile)
else:
hexdata = ''
@@ -109,7 +109,7 @@
logfile.close()
- log_parser = parser.get_parser(database)
+ log_parser = dictionary_parser.get_parser(database)
if log_parser is not None:
logger.debug("# Build ID: %s", database.get_build_id())
logger.debug("# Target: %s, %d-bit", database.get_arch(), database.get_tgt_bits())