BaseTools/Source/Python/Common/ToolDefClassObject.py:
authorjljusten <jljusten@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 17 Oct 2007 17:36:43 +0000 (17:36 +0000)
committerjljusten <jljusten@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 17 Oct 2007 17:36:43 +0000 (17:36 +0000)
  Allow ENV(foo) to be used on non-'DEFINE' lines.  This allows ENV(foo) to
  be used on lines that define tool paths.

git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@828 7335b38e-4728-0410-8992-fb3ffe349368

Source/Python/Common/ToolDefClassObject.py

index 592e276..30325a6 100755 (executable)
@@ -69,14 +69,6 @@ class ToolDefClassObject(object):
 \r
             MacroDefinition = gMacroDefPattern.findall(Name)\r
             if MacroDefinition != []:\r
 \r
             MacroDefinition = gMacroDefPattern.findall(Name)\r
             if MacroDefinition != []:\r
-                EnvReference = gEnvRefPattern.findall(Value)\r
-                for Ref in EnvReference:\r
-                    if Ref not in self.MacroDictionary:\r
-                        EdkLogger.error("tools_def.txt parser", PARSER_ERROR,\r
-                                        "Environment [%s] has not been defined" % Ref,\r
-                                        File=FileName, Line=Index+1)\r
-                    Value = Value.replace(Ref, self.MacroDictionary[Ref])\r
-\r
                 Value = self.ExpandMacros(Value)\r
 \r
                 MacroName = MacroDefinition[0].strip()\r
                 Value = self.ExpandMacros(Value)\r
 \r
                 MacroName = MacroDefinition[0].strip()\r
@@ -131,6 +123,14 @@ class ToolDefClassObject(object):
 \r
     def ExpandMacros(self, Value):\r
 \r
 \r
     def ExpandMacros(self, Value):\r
 \r
+        EnvReference = gEnvRefPattern.findall(Value)\r
+        for Ref in EnvReference:\r
+            if Ref not in self.MacroDictionary:\r
+                EdkLogger.error("tools_def.txt parser", PARSER_ERROR,\r
+                                "Environment [%s] has not been defined" % Ref,\r
+                                File=FileName, Line=Index+1)\r
+            Value = Value.replace(Ref, self.MacroDictionary[Ref])\r
+\r
         MacroReference = gMacroRefPattern.findall(Value)\r
         for Ref in MacroReference:\r
             if Ref not in self.MacroDictionary:\r
         MacroReference = gMacroRefPattern.findall(Value)\r
         for Ref in MacroReference:\r
             if Ref not in self.MacroDictionary:\r