]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/Vtf.py
BaseTools/GenFds: cleanup GenFds
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / Vtf.py
index 5cb2d4acfb1cc1eed456618768fb3614bffee5fb..9dcd48b2d812c03803c7d3cad09dce6c6361db5c 100644 (file)
 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
-T_CHAR_LF = '\n'\r
+from Common.DataType import TAB_LINE_BREAK\r
 \r
 ## generate VTF\r
 #\r
 #\r
-class Vtf (VtfClassObject):\r
+class Vtf (object):\r
 \r
     ## The constructor\r
     #\r
     #   @param  self        The object pointer\r
     #\r
     def __init__(self):\r
-        VtfClassObject.__init__(self)\r
+        self.KeyArch = None\r
+        self.ArchList = None\r
+        self.UiName = None\r
+        self.ResetBin = None\r
+        self.ComponentStatementList = []\r
 \r
     ## GenVtf() method\r
     #\r
@@ -44,7 +47,6 @@ class Vtf (VtfClassObject):
     #\r
     def GenVtf(self, FdAddressDict) :\r
         self.GenBsfInf()\r
-        OutputFile = os.path.join(GenFdsGlobalVariable.FvDir, self.UiName + '.Vtf')\r
         BaseAddArg = self.GetBaseAddressArg(FdAddressDict)\r
         OutputArg, VtfRawDict = self.GenOutputArg()\r
 \r
@@ -69,57 +71,57 @@ 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 is not None:\r
-            BsfInf.writelines ("[OPTIONS]" + T_CHAR_LF)\r
+        if self.ResetBin:\r
+            BsfInf.writelines ("[OPTIONS]" + TAB_LINE_BREAK)\r
             BsfInf.writelines ("IA32_RST_BIN" + \\r
                                " = " + \\r
                                GenFdsGlobalVariable.MacroExtend(GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.ResetBin)) + \\r
-                               T_CHAR_LF)\r
-            BsfInf.writelines (T_CHAR_LF)\r
+                               TAB_LINE_BREAK)\r
+            BsfInf.writelines (TAB_LINE_BREAK)\r
 \r
-        BsfInf.writelines ("[COMPONENTS]" + T_CHAR_LF)\r
+        BsfInf.writelines ("[COMPONENTS]" + TAB_LINE_BREAK)\r
 \r
         for ComponentObj in self.ComponentStatementList :\r
             BsfInf.writelines ("COMP_NAME" + \\r
                                " = " + \\r
                                ComponentObj.CompName + \\r
-                               T_CHAR_LF)\r
+                               TAB_LINE_BREAK)\r
             if ComponentObj.CompLoc.upper() == 'NONE':\r
                 BsfInf.writelines ("COMP_LOC" + \\r
                                    " = " + \\r
                                    'N' + \\r
-                                   T_CHAR_LF)\r
+                                   TAB_LINE_BREAK)\r
 \r
-            elif ComponentObj.FilePos is not None:\r
+            elif ComponentObj.FilePos:\r
                 BsfInf.writelines ("COMP_LOC" + \\r
                                    " = " + \\r
                                    ComponentObj.FilePos + \\r
-                                   T_CHAR_LF)\r
+                                   TAB_LINE_BREAK)\r
             else:\r
                 Index = FvList.index(ComponentObj.CompLoc.upper())\r
                 if Index == 0:\r
                     BsfInf.writelines ("COMP_LOC" + \\r
                                        " = " + \\r
                                        'F' + \\r
-                                       T_CHAR_LF)\r
+                                       TAB_LINE_BREAK)\r
                 elif Index == 1:\r
                     BsfInf.writelines ("COMP_LOC" + \\r
                                        " = " + \\r
                                        'S' + \\r
-                                       T_CHAR_LF)\r
+                                       TAB_LINE_BREAK)\r
 \r
             BsfInf.writelines ("COMP_TYPE" + \\r
                                " = " + \\r
                                ComponentObj.CompType + \\r
-                               T_CHAR_LF)\r
+                               TAB_LINE_BREAK)\r
             BsfInf.writelines ("COMP_VER" + \\r
                                " = " + \\r
                                ComponentObj.CompVer + \\r
-                               T_CHAR_LF)\r
+                               TAB_LINE_BREAK)\r
             BsfInf.writelines ("COMP_CS" + \\r
                                " = " + \\r
                                ComponentObj.CompCs + \\r
-                               T_CHAR_LF)\r
+                               TAB_LINE_BREAK)\r
 \r
             BinPath = ComponentObj.CompBin\r
             if BinPath != '-':\r
@@ -127,7 +129,7 @@ class Vtf (VtfClassObject):
             BsfInf.writelines ("COMP_BIN" + \\r
                                " = " + \\r
                                BinPath + \\r
-                               T_CHAR_LF)\r
+                               TAB_LINE_BREAK)\r
 \r
             SymPath = ComponentObj.CompSym\r
             if SymPath != '-':\r
@@ -135,12 +137,12 @@ class Vtf (VtfClassObject):
             BsfInf.writelines ("COMP_SYM" + \\r
                                " = " + \\r
                                SymPath + \\r
-                               T_CHAR_LF)\r
+                               TAB_LINE_BREAK)\r
             BsfInf.writelines ("COMP_SIZE" + \\r
                                " = " + \\r
                                ComponentObj.CompSize + \\r
-                               T_CHAR_LF)\r
-            BsfInf.writelines (T_CHAR_LF)\r
+                               TAB_LINE_BREAK)\r
+            BsfInf.writelines (TAB_LINE_BREAK)\r
 \r
         BsfInf.close()\r
 \r