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>
This commit is contained in:
@ -15,18 +15,18 @@
|
||||
##
|
||||
# Import Modules
|
||||
#
|
||||
import Region
|
||||
import Fv
|
||||
from __future__ import absolute_import
|
||||
from . import Region
|
||||
from . import Fv
|
||||
import Common.LongFilePathOs as os
|
||||
from io import BytesIO
|
||||
import sys
|
||||
from struct import *
|
||||
from GenFdsGlobalVariable import GenFdsGlobalVariable
|
||||
from .GenFdsGlobalVariable import GenFdsGlobalVariable
|
||||
from CommonDataClass.FdfClass import FDClassObject
|
||||
from Common import EdkLogger
|
||||
from Common.BuildToolError import *
|
||||
from Common.Misc import SaveFileOnChange
|
||||
from GenFds import GenFds
|
||||
from Common.DataType import BINARY_FILE_TYPE_FV
|
||||
|
||||
## generate FD
|
||||
@ -47,6 +47,7 @@ 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']
|
||||
|
||||
|
Reference in New Issue
Block a user