From bfa65b61dde887a9586e070101202bd37e3221fd Mon Sep 17 00:00:00 2001 From: Gary Lin Date: Fri, 13 Jul 2018 18:18:33 +0800 Subject: 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 Cc: Liming Gao Signed-off-by: Gary Lin Reviewed-by: Jaben Carsey --- BaseTools/Source/Python/GenFds/OptRomInfStatement.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'BaseTools/Source/Python/GenFds/OptRomInfStatement.py') diff --git a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py index dff8235ef7..dfeba5d0b1 100644 --- a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py +++ b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py @@ -15,16 +15,16 @@ ## # Import Modules # -import RuleSimpleFile -import RuleComplexFile -import Section -import OptionRom +from __future__ import absolute_import +from . import RuleSimpleFile +from . import RuleComplexFile +from . import Section import Common.GlobalData as GlobalData from Common.DataType import * from Common.StringUtils import * -from FfsInfStatement import FfsInfStatement -from GenFdsGlobalVariable import GenFdsGlobalVariable +from .FfsInfStatement import FfsInfStatement +from .GenFdsGlobalVariable import GenFdsGlobalVariable ## # @@ -45,7 +45,7 @@ class OptRomInfStatement (FfsInfStatement): # @param self The object pointer # def __GetOptRomParams(self): - + from . import OptionRom if self.OverrideAttribs is None: self.OverrideAttribs = OptionRom.OverrideAttribs() @@ -150,5 +150,3 @@ class OptRomInfStatement (FfsInfStatement): OutputFileList.extend(FileList) return OutputFileList - - -- cgit v1.2.3