summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/GenFds/Capsule.py
diff options
context:
space:
mode:
authorGary Lin <glin@suse.com>2018-07-13 18:18:33 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-07-16 11:22:13 +0800
commitbfa65b61dde887a9586e070101202bd37e3221fd (patch)
treeb0cabc40d2e0a2fc084fef0113260639567790cb /BaseTools/Source/Python/GenFds/Capsule.py
parent15e20228258c1714cd90207a52101a5b1b54cd2c (diff)
downloadedk2-bfa65b61dde887a9586e070101202bd37e3221fd.tar.gz
edk2-bfa65b61dde887a9586e070101202bd37e3221fd.tar.bz2
edk2-bfa65b61dde887a9586e070101202bd37e3221fd.zip
BaseTools: Use absolute import in GenFds
Based on "futurize -f libfuturize.fixes.fix_absolute_import" Since circular import is not allowed after adopting absolute import, the following changes are applied to break the circles. * BaseTools/Source/Python/GenFds/Capsule.py - Delay "from .GenFds import GenFds" until GenCapsule() - Delay "from .GenFds import FindExtendTool" until GenFmpCapsule() To break the circle: AutoGen.AutoGen => GenFds.FdfParser => GenFds.Capsule => GenFds.GenFds => GenFds.FdfParser * BaseTools/Source/Python/GenFds/Fd.py - Delay "from .GenFds import GenFds" until GenFd() To break the circle: AutoGen.AutoGen => GenFds.FdfParser => GenFds.Fd => GenFds.GenFds => GenFds.FdfParser * BaseTools/Source/Python/GenFds/Fv.py - Delay "from .GenFds import GenFds" until AddToBuffer() To break the circle: AutoGen.AutoGen => GenFds.FdfParser => GenFds.Fd => GenFds.Fv => GenFds.GenFds => GenFds.FdfParser * BaseTools/Source/Python/GenFds/GuidSection.py - Delay "from .GenFds import FindExtendTool" until GuidSection() To break the circle: AutoGen.AutoGen => GenFds.FdfParser => GenFds.Fd => GenFds.Fv => GenFds.AprioriSection => GenFds.FfsFileStatement => GenFds.GuidSection => GenFds.GenFds => GenFds.FdfParser * BaseTools/Source/Python/GenFds/OptRomInfStatement.py - Delay "from . import OptionRom" until __GetOptRomParams() To break the circle: AutoGen.AutoGen => GenFds.FdfParser => GenFds.OptionRom => GenFds.OptRomInfStatement => GenFds.OptionRom * BaseTools/Source/Python/GenFds/OptionRom.py - Remove the unused "from GenFds import GenFds" To break the circle: AutoGen.AutoGen => GenFds.FdfParser => GenFds.OptionRom => 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/Capsule.py')
-rw-r--r--BaseTools/Source/Python/GenFds/Capsule.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/BaseTools/Source/Python/GenFds/Capsule.py b/BaseTools/Source/Python/GenFds/Capsule.py
index 35a25bd380..27932ef002 100644
--- a/BaseTools/Source/Python/GenFds/Capsule.py
+++ b/BaseTools/Source/Python/GenFds/Capsule.py
@@ -15,17 +15,16 @@
##
# Import Modules
#
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from __future__ import absolute_import
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import CapsuleClassObject
import Common.LongFilePathOs as os
import subprocess
from io import BytesIO
from Common.Misc import SaveFileOnChange
-from GenFds import GenFds
from Common.Misc import PackRegistryFormatGuid
import uuid
from struct import pack
-from GenFds import FindExtendTool
from Common import EdkLogger
from Common.BuildToolError import *
@@ -66,6 +65,7 @@ class Capsule (CapsuleClassObject) :
# UINT32 CapsuleImageSize;
# } EFI_CAPSULE_HEADER;
#
+ from .GenFds import FindExtendTool
Header = BytesIO()
#
# Use FMP capsule GUID: 6DCBD5ED-E82D-4C44-BDA1-7194199AD92A
@@ -201,6 +201,7 @@ class Capsule (CapsuleClassObject) :
# @retval string Generated Capsule file path
#
def GenCapsule(self):
+ from .GenFds import GenFds
if self.UiCapsuleName.upper() + 'cap' in GenFds.ImageBinDict:
return GenFds.ImageBinDict[self.UiCapsuleName.upper() + 'cap']