Skip to content

Commit

Permalink
Fixed an undefined variable issue
Browse files Browse the repository at this point in the history
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1228 7335b38e-4728-0410-8992-fb3ffe349368
  • Loading branch information
jwang36 committed May 15, 2008
1 parent 50b5216 commit 0aa339a
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions Source/Python/Common/ToolDefClassObject.py
Expand Up @@ -32,7 +32,7 @@
## ToolDefClassObject
#
# This class defined content used in file tools_def.txt
#
#
# @param object: Inherited from object class
# @param Filename: Input value for full path of tools_def.txt
#
Expand Down Expand Up @@ -91,14 +91,22 @@ def LoadToolDefFile(self, FileName):

MacroDefinition = gMacroDefPattern.findall(Name)
if MacroDefinition != []:
Value = self.ExpandMacros(Value)
Done, Value = self.ExpandMacros(Value)
if not Done:
EdkLogger.error("tools_def.txt parser", ATTRIBUTE_NOT_AVAILABLE,
"Macro or Environment has not been defined",
ExtraData=Value[4:-1], File=FileName, Line=Index+1)

MacroName = MacroDefinition[0].strip()
self.MacroDictionary["DEF(%s)" % MacroName] = Value
EdkLogger.debug(EdkLogger.DEBUG_8, "Line %d: Found macro: %s = %s" % ((Index + 1), MacroName, Value))
continue

Value = self.ExpandMacros(Value)
Done, Value = self.ExpandMacros(Value)
if not Done:
EdkLogger.error("tools_def.txt parser", ATTRIBUTE_NOT_AVAILABLE,
"Macro or Environment has not been defined",
ExtraData=Value[4:-1], File=FileName, Line=Index+1)

List = Name.split('_')
if len(List) != 5:
Expand Down Expand Up @@ -155,20 +163,16 @@ def ExpandMacros(self, Value):
EnvReference = gEnvRefPattern.findall(Value)
for Ref in EnvReference:
if Ref not in self.MacroDictionary:
EdkLogger.error("tools_def.txt parser", RESOURCE_NOT_AVAILABLE,
ExtraData="Environment [%s] has not been defined" % Ref,
File=FileName, Line=Index+1)
return False, Ref
Value = Value.replace(Ref, self.MacroDictionary[Ref])

MacroReference = gMacroRefPattern.findall(Value)
for Ref in MacroReference:
if Ref not in self.MacroDictionary:
EdkLogger.error("tools_def.txt parser", RESOURCE_NOT_AVAILABLE,
ExtraData="Macro [%s] has not been defined" % Ref,
File=FileName, Line=Index+1)
return False, Ref
Value = Value.replace(Ref, self.MacroDictionary[Ref])

return Value
return True, Value

## ToolDefDict
#
Expand Down

0 comments on commit 0aa339a

Please sign in to comment.