Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Zimmermann <[email protected]>
---
.../Source/Python/Common/ToolDefClassObject.py | 35
+++++++++++++++++-----
1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py
b/BaseTools/Source/Python/Common/ToolDefClassObject.py
index 07e6696..964b863 100644
--- a/BaseTools/Source/Python/Common/ToolDefClassObject.py
+++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py
@@ -58,6 +58,23 @@ class ToolDefClassObject(object):
# @param Filename: Input value for full path of tools_def.txt
#
def LoadToolDefFile(self, FileName):
+ self.ToolsDefTxtDatabase = {
+ TAB_TOD_DEFINES_TARGET : [],
+ TAB_TOD_DEFINES_TOOL_CHAIN_TAG : [],
+ TAB_TOD_DEFINES_TARGET_ARCH : [],
+ TAB_TOD_DEFINES_COMMAND_TYPE : []
+ }
+
+ self.IncludeToolDefFile(FileName)
+
+
+ ## IncludeToolDefFile
+ #
+ # Load target.txt file and parse it as if it's contents were inside
the main file
+ #
+ # @param Filename: Input value for full path of tools_def.txt
+ #
+ def IncludeToolDefFile(self, FileName):
FileContent = []
if os.path.isfile(FileName):
try:
@@ -68,17 +85,21 @@ class ToolDefClassObject(object):
else:
EdkLogger.error("tools_def.txt parser", FILE_NOT_FOUND,
ExtraData=FileName)
- self.ToolsDefTxtDatabase = {
- TAB_TOD_DEFINES_TARGET : [],
- TAB_TOD_DEFINES_TOOL_CHAIN_TAG : [],
- TAB_TOD_DEFINES_TARGET_ARCH : [],
- TAB_TOD_DEFINES_COMMAND_TYPE : []
- }
-
for Index in range(len(FileContent)):
Line = FileContent[Index].strip()
if Line == "" or Line[0] == '#':
continue
+
+ if Line.startswith("!include"):
+ IncFile = Line[8:].strip()
+ Done, IncFile = self.ExpandMacros(IncFile)
+ if not Done:
+ EdkLogger.error("tools_def.txt parser",
ATTRIBUTE_NOT_AVAILABLE,
+ "Macro or Environment has not been
defined",
+ ExtraData=IncFile[4:-1], File=FileName,
Line=Index+1)
+ self.IncludeToolDefFile(IncFile)
+ continue
+
NameValuePair = Line.split("=", 1)
if len(NameValuePair) != 2:
EdkLogger.warn("tools_def.txt parser", "Line %d: not
correct assignment statement, skipped" % (Index + 1))
--
2.8.2
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel