]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/Vtf.py
Revert BaseTools: PYTHON3 migration
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / Vtf.py
index 06e3d275c381da60d3520cdd2b45ccd5ebef1568..5cb2d4acfb1cc1eed456618768fb3614bffee5fb 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process VTF generation\r
 #\r
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -15,7 +15,8 @@
 ##\r
 # Import Modules\r
 #\r
-from GenFdsGlobalVariable import GenFdsGlobalVariable\r
+from __future__ import absolute_import\r
+from .GenFdsGlobalVariable import GenFdsGlobalVariable\r
 import Common.LongFilePathOs as os\r
 from CommonDataClass.FdfClass import VtfClassObject\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
@@ -25,7 +26,7 @@ T_CHAR_LF = '\n'
 #\r
 #\r
 class Vtf (VtfClassObject):\r
-    \r
+\r
     ## The constructor\r
     #\r
     #   @param  self        The object pointer\r
@@ -46,7 +47,7 @@ class Vtf (VtfClassObject):
         OutputFile = os.path.join(GenFdsGlobalVariable.FvDir, self.UiName + '.Vtf')\r
         BaseAddArg = self.GetBaseAddressArg(FdAddressDict)\r
         OutputArg, VtfRawDict = self.GenOutputArg()\r
-        \r
+\r
         Cmd = (\r
             'GenVtf',\r
             ) + OutputArg + (\r
@@ -55,9 +56,9 @@ class Vtf (VtfClassObject):
 \r
         GenFdsGlobalVariable.CallExternalTool(Cmd, "GenFv -Vtf Failed!")\r
         GenFdsGlobalVariable.SharpCounter = 0\r
-        \r
+\r
         return VtfRawDict\r
-        \r
+\r
     ## GenBsfInf() method\r
     #\r
     #   Generate inf used to generate VTF\r
@@ -68,7 +69,7 @@ class Vtf (VtfClassObject):
         FvList = self.GetFvList()\r
         self.BsfInfName = os.path.join(GenFdsGlobalVariable.FvDir, self.UiName + '.inf')\r
         BsfInf = open(self.BsfInfName, 'w+')\r
-        if self.ResetBin != None:\r
+        if self.ResetBin is not None:\r
             BsfInf.writelines ("[OPTIONS]" + T_CHAR_LF)\r
             BsfInf.writelines ("IA32_RST_BIN" + \\r
                                " = " + \\r
@@ -89,7 +90,7 @@ class Vtf (VtfClassObject):
                                    'N' + \\r
                                    T_CHAR_LF)\r
 \r
-            elif ComponentObj.FilePos != None:\r
+            elif ComponentObj.FilePos is not None:\r
                 BsfInf.writelines ("COMP_LOC" + \\r
                                    " = " + \\r
                                    ComponentObj.FilePos + \\r
@@ -154,7 +155,7 @@ class Vtf (VtfClassObject):
         for component in self.ComponentStatementList :\r
             if component.CompLoc.upper() != 'NONE' and not (component.CompLoc.upper() in FvList):\r
                 FvList.append(component.CompLoc.upper())\r
-                \r
+\r
         return FvList\r
 \r
     ## GetBaseAddressArg() method\r
@@ -173,13 +174,13 @@ class Vtf (VtfClassObject):
                 '-s', '0x%x' % Size,\r
                 )\r
         return CmdStr\r
-    \r
+\r
     ## GenOutputArg() method\r
     #\r
     #   Get output arguments for GenVtf\r
     #\r
     #   @param  self        The object pointer\r
-    #                 \r
+    #\r
     def GenOutputArg(self):\r
         FvVtfDict = {}\r
         OutputFileName = ''\r
@@ -192,6 +193,6 @@ class Vtf (VtfClassObject):
             OutputFileName = os.path.join(GenFdsGlobalVariable.FvDir, OutputFileName)\r
             Arg += ('-o', OutputFileName)\r
             FvVtfDict[FvObj.upper()] = OutputFileName\r
-            \r
+\r
         return Arg, FvVtfDict\r
-                \r
+\r