diff options
author | Gary Lin <glin@suse.com> | 2018-07-13 18:18:36 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-07-16 11:22:14 +0800 |
commit | 7de0083812245ec2d0b35667ef4a1aa262e006e0 (patch) | |
tree | 5f97dd6ba212bd20e8abd83b12872e50c9101967 /BaseTools/Source/Python/GenFds/Fd.py | |
parent | 89a69d4b643803d0b52945ca0620376e79f51ed7 (diff) | |
download | edk2-7de0083812245ec2d0b35667ef4a1aa262e006e0.tar.gz edk2-7de0083812245ec2d0b35667ef4a1aa262e006e0.tar.bz2 edk2-7de0083812245ec2d0b35667ef4a1aa262e006e0.zip |
BaseTools: Move ImageBinDict to GenFdsGlobalVariable.py
Move "ImageBinDict" from GenFds.py to GenFdsGlobalVariable.py so that we
can remove the requirement to import GenFds.GenFds in Capsule.py, Fd.py and
Fv.py. This breaks the following circular imports:
* GenFds.FdfParser => GenFds.Capsule => GenFds.GenFds => GenFds.FdfParser
* GenFds.FdfParser => GenFds.Fd => GenFds.GenFds => GenFds.FdfParser
* GenFds.FdfParser => GenFds.Fd => GenFds.Fv => GenFds.GenFds =>
GenFds.FdfParser
Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/GenFds/Fd.py')
-rw-r--r-- | BaseTools/Source/Python/GenFds/Fd.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/BaseTools/Source/Python/GenFds/Fd.py b/BaseTools/Source/Python/GenFds/Fd.py index 53318c9ea5..bfae121798 100644 --- a/BaseTools/Source/Python/GenFds/Fd.py +++ b/BaseTools/Source/Python/GenFds/Fd.py @@ -47,9 +47,8 @@ class FD(FDClassObject): # @retval string Generated FD file name
#
def GenFd (self, Flag = False):
- from .GenFds import GenFds
- if self.FdUiName.upper() + 'fd' in GenFds.ImageBinDict:
- return GenFds.ImageBinDict[self.FdUiName.upper() + 'fd']
+ if self.FdUiName.upper() + 'fd' in GenFdsGlobalVariable.ImageBinDict:
+ return GenFdsGlobalVariable.ImageBinDict[self.FdUiName.upper() + 'fd']
#
# Print Information
@@ -94,7 +93,7 @@ class FD(FDClassObject): PadRegion.Offset = PreviousRegionStart + PreviousRegionSize
PadRegion.Size = RegionObj.Offset - PadRegion.Offset
if not Flag:
- PadRegion.AddToBuffer(TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
+ PadRegion.AddToBuffer(TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
PreviousRegionStart = RegionObj.Offset
PreviousRegionSize = RegionObj.Size
#
@@ -103,7 +102,7 @@ class FD(FDClassObject): if PreviousRegionSize > self.Size:
pass
GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')
- RegionObj.AddToBuffer (TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
+ RegionObj.AddToBuffer (TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
FdBuffer = BytesIO('')
PreviousRegionStart = -1
@@ -124,7 +123,7 @@ class FD(FDClassObject): PadRegion.Offset = PreviousRegionStart + PreviousRegionSize
PadRegion.Size = RegionObj.Offset - PadRegion.Offset
if not Flag:
- PadRegion.AddToBuffer(FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
+ PadRegion.AddToBuffer(FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
PreviousRegionStart = RegionObj.Offset
PreviousRegionSize = RegionObj.Size
#
@@ -138,7 +137,7 @@ class FD(FDClassObject): # Call each region's AddToBuffer function
#
GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')
- RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict, Flag=Flag)
+ RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.vtfRawDict, self.DefineVarDict, Flag=Flag)
#
# Write the buffer contents to Fd file
#
@@ -146,7 +145,7 @@ class FD(FDClassObject): if not Flag:
SaveFileOnChange(FdFileName, FdBuffer.getvalue())
FdBuffer.close()
- GenFds.ImageBinDict[self.FdUiName.upper() + 'fd'] = FdFileName
+ GenFdsGlobalVariable.ImageBinDict[self.FdUiName.upper() + 'fd'] = FdFileName
return FdFileName
## generate VTF
|