summaryrefslogtreecommitdiff
path: root/BaseTools/Source
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
parent15e20228258c1714cd90207a52101a5b1b54cd2c (diff)
downloadedk2-bfa65b61dde887a9586e070101202bd37e3221fd.zip
edk2-bfa65b61dde887a9586e070101202bd37e3221fd.tar.gz
edk2-bfa65b61dde887a9586e070101202bd37e3221fd.tar.bz2
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')
-rw-r--r--BaseTools/Source/Python/GenFds/AprioriSection.py5
-rw-r--r--BaseTools/Source/Python/GenFds/Capsule.py7
-rw-r--r--BaseTools/Source/Python/GenFds/CapsuleData.py5
-rw-r--r--BaseTools/Source/Python/GenFds/CompressSection.py7
-rw-r--r--BaseTools/Source/Python/GenFds/DataSection.py7
-rw-r--r--BaseTools/Source/Python/GenFds/DepexSection.py7
-rw-r--r--BaseTools/Source/Python/GenFds/EfiSection.py7
-rw-r--r--BaseTools/Source/Python/GenFds/Fd.py9
-rw-r--r--BaseTools/Source/Python/GenFds/FdfParser.py55
-rw-r--r--BaseTools/Source/Python/GenFds/FfsFileStatement.py11
-rw-r--r--BaseTools/Source/Python/GenFds/FfsInfStatement.py19
-rw-r--r--BaseTools/Source/Python/GenFds/Fv.py11
-rw-r--r--BaseTools/Source/Python/GenFds/FvImageSection.py7
-rw-r--r--BaseTools/Source/Python/GenFds/GenFds.py11
-rw-r--r--BaseTools/Source/Python/GenFds/GuidSection.py11
-rw-r--r--BaseTools/Source/Python/GenFds/OptRomFileStatement.py3
-rw-r--r--BaseTools/Source/Python/GenFds/OptRomInfStatement.py16
-rw-r--r--BaseTools/Source/Python/GenFds/OptionRom.py6
-rw-r--r--BaseTools/Source/Python/GenFds/Region.py3
-rw-r--r--BaseTools/Source/Python/GenFds/RuleComplexFile.py3
-rw-r--r--BaseTools/Source/Python/GenFds/RuleSimpleFile.py3
-rw-r--r--BaseTools/Source/Python/GenFds/Section.py3
-rw-r--r--BaseTools/Source/Python/GenFds/UiSection.py7
-rw-r--r--BaseTools/Source/Python/GenFds/VerSection.py7
-rw-r--r--BaseTools/Source/Python/GenFds/Vtf.py3
25 files changed, 127 insertions, 106 deletions
diff --git a/BaseTools/Source/Python/GenFds/AprioriSection.py b/BaseTools/Source/Python/GenFds/AprioriSection.py
index b3e7b5f..7196f7f 100644
--- a/BaseTools/Source/Python/GenFds/AprioriSection.py
+++ b/BaseTools/Source/Python/GenFds/AprioriSection.py
@@ -15,11 +15,12 @@
##
# Import Modules
#
+from __future__ import absolute_import
from struct import *
import Common.LongFilePathOs as os
from io import BytesIO
-import FfsFileStatement
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from . import FfsFileStatement
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import AprioriSectionClassObject
from Common.StringUtils import *
from Common.Misc import SaveFileOnChange, PathClass
diff --git a/BaseTools/Source/Python/GenFds/Capsule.py b/BaseTools/Source/Python/GenFds/Capsule.py
index 35a25bd..27932ef 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']
diff --git a/BaseTools/Source/Python/GenFds/CapsuleData.py b/BaseTools/Source/Python/GenFds/CapsuleData.py
index 9d17bf5..0caba89 100644
--- a/BaseTools/Source/Python/GenFds/CapsuleData.py
+++ b/BaseTools/Source/Python/GenFds/CapsuleData.py
@@ -15,8 +15,9 @@
##
# Import Modules
#
-import Ffs
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from __future__ import absolute_import
+from . import Ffs
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
from io import BytesIO
from struct import pack
import os
diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py b/BaseTools/Source/Python/GenFds/CompressSection.py
index 4ae14f2..aaaabf8 100644
--- a/BaseTools/Source/Python/GenFds/CompressSection.py
+++ b/BaseTools/Source/Python/GenFds/CompressSection.py
@@ -15,11 +15,12 @@
##
# Import Modules
#
-from Ffs import Ffs
-import Section
+from __future__ import absolute_import
+from .Ffs import Ffs
+from . import Section
import subprocess
import Common.LongFilePathOs as os
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import CompressSectionClassObject
from Common.DataType import *
diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Source/Python/GenFds/DataSection.py
index 29caa00..a6387b0 100644
--- a/BaseTools/Source/Python/GenFds/DataSection.py
+++ b/BaseTools/Source/Python/GenFds/DataSection.py
@@ -15,10 +15,11 @@
##
# Import Modules
#
-import Section
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from __future__ import absolute_import
+from . import Section
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
import subprocess
-from Ffs import Ffs
+from .Ffs import Ffs
import Common.LongFilePathOs as os
from CommonDataClass.FdfClass import DataSectionClassObject
from Common.Misc import PeImageClass
diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools/Source/Python/GenFds/DepexSection.py
index f42162d..b2d123b 100644
--- a/BaseTools/Source/Python/GenFds/DepexSection.py
+++ b/BaseTools/Source/Python/GenFds/DepexSection.py
@@ -15,10 +15,11 @@
##
# Import Modules
#
-import Section
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from __future__ import absolute_import
+from . import Section
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
import subprocess
-from Ffs import Ffs
+from .Ffs import Ffs
import Common.LongFilePathOs as os
from CommonDataClass.FdfClass import DepexSectionClassObject
from AutoGen.GenDepex import DependencyExpression
diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/Python/GenFds/EfiSection.py
index 9223268..623b77d 100644
--- a/BaseTools/Source/Python/GenFds/EfiSection.py
+++ b/BaseTools/Source/Python/GenFds/EfiSection.py
@@ -15,11 +15,12 @@
##
# Import Modules
#
+from __future__ import absolute_import
from struct import *
-import Section
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from . import Section
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
import subprocess
-from Ffs import Ffs
+from .Ffs import Ffs
import Common.LongFilePathOs as os
from CommonDataClass.FdfClass import EfiSectionClassObject
from Common import EdkLogger
diff --git a/BaseTools/Source/Python/GenFds/Fd.py b/BaseTools/Source/Python/GenFds/Fd.py
index 552719f..53318c9 100644
--- a/BaseTools/Source/Python/GenFds/Fd.py
+++ b/BaseTools/Source/Python/GenFds/Fd.py
@@ -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']
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index e2e6df7..5ff2e20 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -17,35 +17,36 @@
# Import Modules
#
from __future__ import print_function
+from __future__ import absolute_import
import re
-import Fd
-import Region
-import Fv
-import AprioriSection
-import FfsInfStatement
-import FfsFileStatement
-import VerSection
-import UiSection
-import FvImageSection
-import DataSection
-import DepexSection
-import CompressSection
-import GuidSection
-import Capsule
-import CapsuleData
-import Rule
-import RuleComplexFile
-import RuleSimpleFile
-import EfiSection
-import Vtf
-import ComponentStatement
-import OptionRom
-import OptRomInfStatement
-import OptRomFileStatement
+from . import Fd
+from . import Region
+from . import Fv
+from . import AprioriSection
+from . import FfsInfStatement
+from . import FfsFileStatement
+from . import VerSection
+from . import UiSection
+from . import FvImageSection
+from . import DataSection
+from . import DepexSection
+from . import CompressSection
+from . import GuidSection
+from . import Capsule
+from . import CapsuleData
+from . import Rule
+from . import RuleComplexFile
+from . import RuleSimpleFile
+from . import EfiSection
+from . import Vtf
+from . import ComponentStatement
+from . import OptionRom
+from . import OptRomInfStatement
+from . import OptRomFileStatement
import string
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
from Common.BuildToolError import *
from Common import EdkLogger
from Common.Misc import PathClass
@@ -60,8 +61,8 @@ from Common.Misc import tdict
from Common.MultipleWorkspace import MultipleWorkspace as mws
import Common.LongFilePathOs as os
from Common.LongFilePathSupport import OpenLongFilePath as open
-from Capsule import EFI_CERT_TYPE_PKCS7_GUID
-from Capsule import EFI_CERT_TYPE_RSA2048_SHA256_GUID
+from .Capsule import EFI_CERT_TYPE_PKCS7_GUID
+from .Capsule import EFI_CERT_TYPE_RSA2048_SHA256_GUID
from Common.RangeExpression import RangeExpression
##define T_CHAR_SPACE ' '
diff --git a/BaseTools/Source/Python/GenFds/FfsFileStatement.py b/BaseTools/Source/Python/GenFds/FfsFileStatement.py
index 5f31ac0..4c35aac 100644
--- a/BaseTools/Source/Python/GenFds/FfsFileStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsFileStatement.py
@@ -15,19 +15,20 @@
##
# Import Modules
#
-import Ffs
-import Rule
+from __future__ import absolute_import
+from . import Ffs
+from . import Rule
import Common.LongFilePathOs as os
from io import BytesIO
import subprocess
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import FileStatementClassObject
from Common import EdkLogger
from Common.BuildToolError import *
from Common.Misc import GuidStructureByteArrayToGuidString
-from GuidSection import GuidSection
-from FvImageSection import FvImageSection
+from .GuidSection import GuidSection
+from .FvImageSection import FvImageSection
from Common.Misc import SaveFileOnChange
from struct import *
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index adb9a95..56bb966 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -16,17 +16,18 @@
##
# Import Modules
#
-import Rule
+from __future__ import absolute_import
+from . import Rule
import Common.LongFilePathOs as os
from io import BytesIO
from struct import *
-from GenFdsGlobalVariable import GenFdsGlobalVariable
-import Ffs
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+from . import Ffs
import subprocess
import sys
-import Section
-import RuleSimpleFile
-import RuleComplexFile
+from . import Section
+from . import RuleSimpleFile
+from . import RuleComplexFile
from CommonDataClass.FdfClass import FfsInfStatementClassObject
from Common.MultipleWorkspace import MultipleWorkspace as mws
from Common.StringUtils import *
@@ -36,15 +37,15 @@ from Common.Misc import ProcessDuplicatedInf
from Common.Misc import GetVariableOffset
from Common import EdkLogger
from Common.BuildToolError import *
-from GuidSection import GuidSection
-from FvImageSection import FvImageSection
+from .GuidSection import GuidSection
+from .FvImageSection import FvImageSection
from Common.Misc import PeImageClass
from AutoGen.GenDepex import DependencyExpression
from PatchPcdValue.PatchPcdValue import PatchBinaryFile
from Common.LongFilePathSupport import CopyLongFilePath
from Common.LongFilePathSupport import OpenLongFilePath as open
import Common.GlobalData as GlobalData
-from DepexSection import DepexSection
+from .DepexSection import DepexSection
from Common.Misc import SaveFileOnChange
from Common.Expression import *
from Common.DataType import *
diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py
index 798c20a..097f51f 100644
--- a/BaseTools/Source/Python/GenFds/Fv.py
+++ b/BaseTools/Source/Python/GenFds/Fv.py
@@ -1,3 +1,4 @@
+from __future__ import absolute_import
## @file
# process FV generation
#
@@ -20,11 +21,10 @@ import subprocess
from io import BytesIO
from struct import *
-import Ffs
-import AprioriSection
-import FfsFileStatement
-from GenFdsGlobalVariable import GenFdsGlobalVariable
-from GenFds import GenFds
+from . import Ffs
+from . import AprioriSection
+from . import FfsFileStatement
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import FvClassObject
from Common.Misc import SaveFileOnChange, PackGUID
from Common.LongFilePathSupport import CopyLongFilePath
@@ -70,6 +70,7 @@ class FV (FvClassObject):
#
def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', VtfDict=None, MacroDict = {}, Flag=False) :
+ from .GenFds import GenFds
if BaseAddress is None and self.UiFvName.upper() + 'fv' in GenFds.ImageBinDict:
return GenFds.ImageBinDict[self.UiFvName.upper() + 'fv']
diff --git a/BaseTools/Source/Python/GenFds/FvImageSection.py b/BaseTools/Source/Python/GenFds/FvImageSection.py
index b4f1f33..04556fc 100644
--- a/BaseTools/Source/Python/GenFds/FvImageSection.py
+++ b/BaseTools/Source/Python/GenFds/FvImageSection.py
@@ -15,11 +15,12 @@
##
# Import Modules
#
-import Section
+from __future__ import absolute_import
+from . import Section
from io import BytesIO
-from Ffs import Ffs
+from .Ffs import Ffs
import subprocess
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
import Common.LongFilePathOs as os
from CommonDataClass.FdfClass import FvImageSectionClassObject
from Common import EdkLogger
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index b90b50e..c0b60b9 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -16,17 +16,18 @@
# Import Modules
#
from __future__ import print_function
+from __future__ import absolute_import
from optparse import OptionParser
import sys
import Common.LongFilePathOs as os
import linecache
-import FdfParser
+from . import FdfParser
import Common.BuildToolError as BuildToolError
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
from Workspace.WorkspaceDatabase import WorkspaceDatabase
from Workspace.BuildClassObject import PcdClassObject
-import RuleComplexFile
-from EfiSection import EfiSection
+from . import RuleComplexFile
+from .EfiSection import EfiSection
from io import BytesIO
import Common.TargetTxtClassObject as TargetTxtClassObject
import Common.ToolDefClassObject as ToolDefClassObject
@@ -40,7 +41,7 @@ from Common.Misc import ClearDuplicatedInf
from Common.Misc import GuidStructureStringToGuidString
from Common.BuildVersion import gBUILD_VERSION
from Common.MultipleWorkspace import MultipleWorkspace as mws
-import FfsFileStatement
+from . import FfsFileStatement
import glob
from struct import unpack
diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Source/Python/GenFds/GuidSection.py
index c55fb34..e41c2fd 100644
--- a/BaseTools/Source/Python/GenFds/GuidSection.py
+++ b/BaseTools/Source/Python/GenFds/GuidSection.py
@@ -16,19 +16,19 @@
##
# Import Modules
#
-import Section
+from __future__ import absolute_import
+from . import Section
import subprocess
-from Ffs import Ffs
+from .Ffs import Ffs
import Common.LongFilePathOs as os
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import GuidSectionClassObject
from Common import ToolDefClassObject
import sys
from Common import EdkLogger
from Common.BuildToolError import *
-from FvImageSection import FvImageSection
+from .FvImageSection import FvImageSection
from Common.LongFilePathSupport import OpenLongFilePath as open
-from GenFds import FindExtendTool
from Common.DataType import *
## generate GUIDed section
@@ -131,6 +131,7 @@ class GuidSection(GuidSectionClassObject) :
ExternalTool = None
ExternalOption = None
if self.NameGuid is not None:
+ from .GenFds import FindExtendTool
ExternalTool, ExternalOption = FindExtendTool(self.KeyStringList, self.CurrentArchList, self.NameGuid)
#
diff --git a/BaseTools/Source/Python/GenFds/OptRomFileStatement.py b/BaseTools/Source/Python/GenFds/OptRomFileStatement.py
index 8b6d2a1..e56174e 100644
--- a/BaseTools/Source/Python/GenFds/OptRomFileStatement.py
+++ b/BaseTools/Source/Python/GenFds/OptRomFileStatement.py
@@ -15,9 +15,10 @@
##
# Import Modules
#
+from __future__ import absolute_import
import Common.LongFilePathOs as os
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
##
#
#
diff --git a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py
index dff8235..dfeba5d 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
-
-
diff --git a/BaseTools/Source/Python/GenFds/OptionRom.py b/BaseTools/Source/Python/GenFds/OptionRom.py
index 18f3fbd..bb7071f 100644
--- a/BaseTools/Source/Python/GenFds/OptionRom.py
+++ b/BaseTools/Source/Python/GenFds/OptionRom.py
@@ -15,12 +15,12 @@
##
# Import Modules
#
+from __future__ import absolute_import
import Common.LongFilePathOs as os
import subprocess
-import OptRomInfStatement
-from GenFdsGlobalVariable import GenFdsGlobalVariable
-from GenFds import GenFds
+from . import OptRomInfStatement
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import OptionRomClassObject
from Common.Misc import SaveFileOnChange
from Common import EdkLogger
diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Source/Python/GenFds/Region.py
index 33e4ac8..7f94b3d 100644
--- a/BaseTools/Source/Python/GenFds/Region.py
+++ b/BaseTools/Source/Python/GenFds/Region.py
@@ -15,8 +15,9 @@
##
# Import Modules
#
+from __future__ import absolute_import
from struct import *
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
from io import BytesIO
import string
from CommonDataClass.FdfClass import RegionClassObject
diff --git a/BaseTools/Source/Python/GenFds/RuleComplexFile.py b/BaseTools/Source/Python/GenFds/RuleComplexFile.py
index 36c483f..c357fed 100644
--- a/BaseTools/Source/Python/GenFds/RuleComplexFile.py
+++ b/BaseTools/Source/Python/GenFds/RuleComplexFile.py
@@ -15,7 +15,8 @@
##
# Import Modules
#
-import Rule
+from __future__ import absolute_import
+from . import Rule
from CommonDataClass.FdfClass import RuleComplexFileClassObject
## complex rule
diff --git a/BaseTools/Source/Python/GenFds/RuleSimpleFile.py b/BaseTools/Source/Python/GenFds/RuleSimpleFile.py
index 061f984..7aa184e 100644
--- a/BaseTools/Source/Python/GenFds/RuleSimpleFile.py
+++ b/BaseTools/Source/Python/GenFds/RuleSimpleFile.py
@@ -15,7 +15,8 @@
##
# Import Modules
#
-import Rule
+from __future__ import absolute_import
+from . import Rule
from CommonDataClass.FdfClass import RuleSimpleFileClassObject
## simple rule
diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/Python/GenFds/Section.py
index ca4705a..19a7000 100644
--- a/BaseTools/Source/Python/GenFds/Section.py
+++ b/BaseTools/Source/Python/GenFds/Section.py
@@ -15,8 +15,9 @@
##
# Import Modules
#
+from __future__ import absolute_import
from CommonDataClass.FdfClass import SectionClassObject
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
import Common.LongFilePathOs as os, glob
from Common import EdkLogger
from Common.BuildToolError import *
diff --git a/BaseTools/Source/Python/GenFds/UiSection.py b/BaseTools/Source/Python/GenFds/UiSection.py
index 2805009..24f2f3c 100644
--- a/BaseTools/Source/Python/GenFds/UiSection.py
+++ b/BaseTools/Source/Python/GenFds/UiSection.py
@@ -15,11 +15,12 @@
##
# Import Modules
#
-import Section
-from Ffs import Ffs
+from __future__ import absolute_import
+from . import Section
+from .Ffs import Ffs
import subprocess
import Common.LongFilePathOs as os
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import UiSectionClassObject
from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.DataType import *
diff --git a/BaseTools/Source/Python/GenFds/VerSection.py b/BaseTools/Source/Python/GenFds/VerSection.py
index 456a430..db71fe9 100644
--- a/BaseTools/Source/Python/GenFds/VerSection.py
+++ b/BaseTools/Source/Python/GenFds/VerSection.py
@@ -15,11 +15,12 @@
##
# Import Modules
#
-from Ffs import Ffs
-import Section
+from __future__ import absolute_import
+from .Ffs import Ffs
+from . import Section
import Common.LongFilePathOs as os
import subprocess
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import VerSectionClassObject
from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.DataType import SUP_MODULE_SEC
diff --git a/BaseTools/Source/Python/GenFds/Vtf.py b/BaseTools/Source/Python/GenFds/Vtf.py
index 83abc98..5cb2d4a 100644
--- a/BaseTools/Source/Python/GenFds/Vtf.py
+++ b/BaseTools/Source/Python/GenFds/Vtf.py
@@ -15,7 +15,8 @@
##
# Import Modules
#
-from GenFdsGlobalVariable import GenFdsGlobalVariable
+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