summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/GenFds/Vtf.py
diff options
context:
space:
mode:
authorCarsey, Jaben <jaben.carsey@intel.com>2018-10-24 01:29:19 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-10-25 20:14:49 +0800
commit9e47e6f90880e090cd81f585abd7a6c553fbce10 (patch)
treec280e390d282db4c41d64718b366c1c3e64dc9ba /BaseTools/Source/Python/GenFds/Vtf.py
parent0019375fbc89e4d7cfebe29e288b74731bd9f456 (diff)
downloadedk2-9e47e6f90880e090cd81f585abd7a6c553fbce10.zip
edk2-9e47e6f90880e090cd81f585abd7a6c553fbce10.tar.gz
edk2-9e47e6f90880e090cd81f585abd7a6c553fbce10.tar.bz2
BaseTools/GenFds: cleanup GenFds
1) remove wildcard imports and use explicit imports 2) refactor to use shared variables from Common/DataType 3) rename to not shadow imports 4) don't assign a variable in a loop (just do final assignment) 5) remove spaces, parens, unused or commented out code, etc. 6) merge unnecessary parent classes into child 7) refactor to share DXE and PEI apriori GUIDs from one place this includes changes to Build and EOT files 8) for PEP8, dont use __ for custom methods. Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bob C Feng <bob.c.feng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/GenFds/Vtf.py')
-rw-r--r--BaseTools/Source/Python/GenFds/Vtf.py48
1 files changed, 25 insertions, 23 deletions
diff --git a/BaseTools/Source/Python/GenFds/Vtf.py b/BaseTools/Source/Python/GenFds/Vtf.py
index 5cb2d4a..9dcd48b 100644
--- a/BaseTools/Source/Python/GenFds/Vtf.py
+++ b/BaseTools/Source/Python/GenFds/Vtf.py
@@ -18,21 +18,24 @@
from __future__ import absolute_import
from .GenFdsGlobalVariable import GenFdsGlobalVariable
import Common.LongFilePathOs as os
-from CommonDataClass.FdfClass import VtfClassObject
from Common.LongFilePathSupport import OpenLongFilePath as open
-T_CHAR_LF = '\n'
+from Common.DataType import TAB_LINE_BREAK
## generate VTF
#
#
-class Vtf (VtfClassObject):
+class Vtf (object):
## The constructor
#
# @param self The object pointer
#
def __init__(self):
- VtfClassObject.__init__(self)
+ self.KeyArch = None
+ self.ArchList = None
+ self.UiName = None
+ self.ResetBin = None
+ self.ComponentStatementList = []
## GenVtf() method
#
@@ -44,7 +47,6 @@ class Vtf (VtfClassObject):
#
def GenVtf(self, FdAddressDict) :
self.GenBsfInf()
- OutputFile = os.path.join(GenFdsGlobalVariable.FvDir, self.UiName + '.Vtf')
BaseAddArg = self.GetBaseAddressArg(FdAddressDict)
OutputArg, VtfRawDict = self.GenOutputArg()
@@ -69,57 +71,57 @@ class Vtf (VtfClassObject):
FvList = self.GetFvList()
self.BsfInfName = os.path.join(GenFdsGlobalVariable.FvDir, self.UiName + '.inf')
BsfInf = open(self.BsfInfName, 'w+')
- if self.ResetBin is not None:
- BsfInf.writelines ("[OPTIONS]" + T_CHAR_LF)
+ if self.ResetBin:
+ BsfInf.writelines ("[OPTIONS]" + TAB_LINE_BREAK)
BsfInf.writelines ("IA32_RST_BIN" + \
" = " + \
GenFdsGlobalVariable.MacroExtend(GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.ResetBin)) + \
- T_CHAR_LF)
- BsfInf.writelines (T_CHAR_LF)
+ TAB_LINE_BREAK)
+ BsfInf.writelines (TAB_LINE_BREAK)
- BsfInf.writelines ("[COMPONENTS]" + T_CHAR_LF)
+ BsfInf.writelines ("[COMPONENTS]" + TAB_LINE_BREAK)
for ComponentObj in self.ComponentStatementList :
BsfInf.writelines ("COMP_NAME" + \
" = " + \
ComponentObj.CompName + \
- T_CHAR_LF)
+ TAB_LINE_BREAK)
if ComponentObj.CompLoc.upper() == 'NONE':
BsfInf.writelines ("COMP_LOC" + \
" = " + \
'N' + \
- T_CHAR_LF)
+ TAB_LINE_BREAK)
- elif ComponentObj.FilePos is not None:
+ elif ComponentObj.FilePos:
BsfInf.writelines ("COMP_LOC" + \
" = " + \
ComponentObj.FilePos + \
- T_CHAR_LF)
+ TAB_LINE_BREAK)
else:
Index = FvList.index(ComponentObj.CompLoc.upper())
if Index == 0:
BsfInf.writelines ("COMP_LOC" + \
" = " + \
'F' + \
- T_CHAR_LF)
+ TAB_LINE_BREAK)
elif Index == 1:
BsfInf.writelines ("COMP_LOC" + \
" = " + \
'S' + \
- T_CHAR_LF)
+ TAB_LINE_BREAK)
BsfInf.writelines ("COMP_TYPE" + \
" = " + \
ComponentObj.CompType + \
- T_CHAR_LF)
+ TAB_LINE_BREAK)
BsfInf.writelines ("COMP_VER" + \
" = " + \
ComponentObj.CompVer + \
- T_CHAR_LF)
+ TAB_LINE_BREAK)
BsfInf.writelines ("COMP_CS" + \
" = " + \
ComponentObj.CompCs + \
- T_CHAR_LF)
+ TAB_LINE_BREAK)
BinPath = ComponentObj.CompBin
if BinPath != '-':
@@ -127,7 +129,7 @@ class Vtf (VtfClassObject):
BsfInf.writelines ("COMP_BIN" + \
" = " + \
BinPath + \
- T_CHAR_LF)
+ TAB_LINE_BREAK)
SymPath = ComponentObj.CompSym
if SymPath != '-':
@@ -135,12 +137,12 @@ class Vtf (VtfClassObject):
BsfInf.writelines ("COMP_SYM" + \
" = " + \
SymPath + \
- T_CHAR_LF)
+ TAB_LINE_BREAK)
BsfInf.writelines ("COMP_SIZE" + \
" = " + \
ComponentObj.CompSize + \
- T_CHAR_LF)
- BsfInf.writelines (T_CHAR_LF)
+ TAB_LINE_BREAK)
+ BsfInf.writelines (TAB_LINE_BREAK)
BsfInf.close()