Fix a bug in case log file is not specified
authorqhuang8 <qhuang8@c2973edb-eda0-4c78-bc6a-9341b269661f>
Thu, 28 Jan 2010 13:16:28 +0000 (13:16 +0000)
committerqhuang8 <qhuang8@c2973edb-eda0-4c78-bc6a-9341b269661f>
Thu, 28 Jan 2010 13:16:28 +0000 (13:16 +0000)
git-svn-id: https://edk2-buildtools.svn.sourceforge.net/svnroot/edk2-buildtools/trunk/BaseTools@1823 c2973edb-eda0-4c78-bc6a-9341b269661f

Source/Python/Eot/Eot.py

index cac9319..e21ca7f 100644 (file)
@@ -59,6 +59,26 @@ class Eot(object):
         self.FvFileList = FvFileList\r
         self.MapFileList = MapFileList\r
         \r
+        # Check workspace environment\r
+        if "EFI_SOURCE" not in os.environ:\r
+            if "EDK_SOURCE" not in os.environ:\r
+                pass\r
+            else:\r
+                EotGlobalData.gEDK_SOURCE = os.path.normpath(os.getenv("EDK_SOURCE"))\r
+        else:\r
+            EotGlobalData.gEFI_SOURCE = os.path.normpath(os.getenv("EFI_SOURCE"))\r
+            EotGlobalData.gEDK_SOURCE = os.path.join(EotGlobalData.gEFI_SOURCE, 'Edk')\r
+\r
+        if "WORKSPACE" not in os.environ:\r
+            EdkLogger.error("EOT", BuildToolError.ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found",\r
+                            ExtraData="WORKSPACE")\r
+        else:\r
+            EotGlobalData.gWORKSPACE = os.path.normpath(os.getenv("WORKSPACE"))\r
+\r
+        EotGlobalData.gMACRO['WORKSPACE'] = EotGlobalData.gWORKSPACE\r
+        EotGlobalData.gMACRO['EFI_SOURCE'] = EotGlobalData.gEFI_SOURCE\r
+        EotGlobalData.gMACRO['EDK_SOURCE'] = EotGlobalData.gEDK_SOURCE\r
+\r
         # Parse the options and args\r
         if CommandLineOption:\r
             self.ParseOption()\r
@@ -170,6 +190,8 @@ class Eot(object):
     #\r
     def ConvertLogFile(self, LogFile):\r
         newline = []\r
+        lfr = None\r
+        lfw = None\r
         if LogFile:\r
             lfr = open(LogFile, 'rb')\r
             lfw = open(LogFile + '.new', 'wb')\r
@@ -518,25 +540,6 @@ class Eot(object):
     #\r
     def ParseOption(self):\r
         (Options, Target) = self.EotOptionParser()\r
-        # Check workspace envirnoment\r
-        if "EFI_SOURCE" not in os.environ:\r
-            if "EDK_SOURCE" not in os.environ:\r
-                pass\r
-            else:\r
-                EotGlobalData.gEDK_SOURCE = os.path.normpath(os.getenv("EDK_SOURCE"))\r
-        else:\r
-            EotGlobalData.gEFI_SOURCE = os.path.normpath(os.getenv("EFI_SOURCE"))\r
-            EotGlobalData.gEDK_SOURCE = os.path.join(EotGlobalData.gEFI_SOURCE, 'Edk')\r
-\r
-        if "WORKSPACE" not in os.environ:\r
-            EdkLogger.error("EOT", BuildToolError.ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found",\r
-                            ExtraData="WORKSPACE")\r
-        else:\r
-            EotGlobalData.gWORKSPACE = os.path.normpath(os.getenv("WORKSPACE"))\r
-\r
-        EotGlobalData.gMACRO['WORKSPACE'] = EotGlobalData.gWORKSPACE\r
-        EotGlobalData.gMACRO['EFI_SOURCE'] = EotGlobalData.gEFI_SOURCE\r
-        EotGlobalData.gMACRO['EDK_SOURCE'] = EotGlobalData.gEDK_SOURCE\r
 \r
         # Set log level\r
         self.SetLogLevel(Options)\r