From nobody Sat Apr 27 22:55:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1531193491256712.6852100398016; Mon, 9 Jul 2018 20:31:31 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4059D20968915; Mon, 9 Jul 2018 20:31:28 -0700 (PDT) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AD96420336ABD for ; Mon, 9 Jul 2018 20:31:26 -0700 (PDT) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Tue, 10 Jul 2018 05:31:22 +0200 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org From: Gary Lin To: edk2-devel@lists.01.org Date: Tue, 10 Jul 2018 11:30:54 +0800 Message-Id: <20180710033107.32359-2-glin@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710033107.32359-1-glin@suse.com> References: <20180710033107.32359-1-glin@suse.com> Subject: [edk2] [PATCH 01/14] BaseTools: Treat GenFds.py as a python module X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Since GenFds.py import modules from its own directory, add "-m" to the python parameters so that they can import its own modules after adopting absolute import. Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/BinWrappers/PosixLike/GenFds | 2 +- BaseTools/BinWrappers/WindowsLike/GenFds.bat | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BaseTools/BinWrappers/PosixLike/GenFds b/BaseTools/BinWrappers= /PosixLike/GenFds index 01ae23ddeb4f..276c7ea20733 100755 --- a/BaseTools/BinWrappers/PosixLike/GenFds +++ b/BaseTools/BinWrappers/PosixLike/GenFds @@ -11,4 +11,4 @@ dir=3D$(dirname "$full_cmd") cmd=3D${full_cmd##*/} =20 export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@" +exec "${python_exe:-python}" -m $cmd.$cmd "$@" diff --git a/BaseTools/BinWrappers/WindowsLike/GenFds.bat b/BaseTools/BinWr= appers/WindowsLike/GenFds.bat index 9fbb704a6eb0..98095cfbd439 100644 --- a/BaseTools/BinWrappers/WindowsLike/GenFds.bat +++ b/BaseTools/BinWrappers/WindowsLike/GenFds.bat @@ -1,3 +1,4 @@ @setlocal @set ToolName=3D%~n0% -@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%Tool= Name%.py %* +@set PYTHONPATH=3D%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python +@%PYTHON_HOME%\python.exe -m %ToolName%.%ToolName% %* --=20 2.18.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Apr 27 22:55:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 153119349351397.43210903645411; Mon, 9 Jul 2018 20:31:33 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A55982096AEDC; Mon, 9 Jul 2018 20:31:29 -0700 (PDT) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4841821B02845 for ; Mon, 9 Jul 2018 20:31:28 -0700 (PDT) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Tue, 10 Jul 2018 05:31:24 +0200 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org From: Gary Lin To: edk2-devel@lists.01.org Date: Tue, 10 Jul 2018 11:30:55 +0800 Message-Id: <20180710033107.32359-3-glin@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710033107.32359-1-glin@suse.com> References: <20180710033107.32359-1-glin@suse.com> Subject: [edk2] [PATCH 02/14] BaseTools: Use absolute import in GenFds X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 =3D> GenFds.FdfParser =3D> GenFds.Capsule =3D> GenFds.Gen= Fds =3D> GenFds.FdfParser * BaseTools/Source/Python/GenFds/Fd.py - Delay "from .GenFds import GenFds" until GenFd() To break the circle: AutoGen.AutoGen =3D> GenFds.FdfParser =3D> GenFds.Fd =3D> GenFds.GenFds = =3D> GenFds.FdfParser * BaseTools/Source/Python/GenFds/Fv.py - Delay "from .GenFds import GenFds" until AddToBuffer() To break the circle: AutoGen.AutoGen =3D> GenFds.FdfParser =3D> GenFds.Fd =3D> GenFds.Fv =3D> GenFds.GenFds =3D> GenFds.FdfParser * BaseTools/Source/Python/GenFds/GuidSection.py - Delay "from .GenFds import FindExtendTool" until GuidSection() To break the circle: AutoGen.AutoGen =3D> GenFds.FdfParser =3D> GenFds.Fd =3D> GenFds.Fv =3D> GenFds.AprioriSection =3D> GenFds.FfsFileStatement =3D> GenFds.GuidSectio= n =3D> GenFds.GenFds =3D> GenFds.FdfParser * BaseTools/Source/Python/GenFds/OptRomInfStatement.py - Delay "from . import OptionRom" until __GetOptRomParams() To break the circle: AutoGen.AutoGen =3D> GenFds.FdfParser =3D> GenFds.OptionRom =3D> GenFds.OptRomInfStatement =3D> GenFds.OptionRom * BaseTools/Source/Python/GenFds/OptionRom.py - Remove the unused "from GenFds import GenFds" To break the circle: AutoGen.AutoGen =3D> GenFds.FdfParser =3D> GenFds.OptionRom =3D> GenFds.GenFds =3D> GenFds.FdfParser Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/Source/Python/GenFds/AprioriSection.py | 5 +- BaseTools/Source/Python/GenFds/Capsule.py | 7 +-- BaseTools/Source/Python/GenFds/CapsuleData.py | 5 +- BaseTools/Source/Python/GenFds/CompressSection.py | 7 +-- BaseTools/Source/Python/GenFds/DataSection.py | 7 +-- BaseTools/Source/Python/GenFds/DepexSection.py | 7 +-- BaseTools/Source/Python/GenFds/EfiSection.py | 7 +-- BaseTools/Source/Python/GenFds/Fd.py | 9 ++-- BaseTools/Source/Python/GenFds/FdfParser.py | 55 ++++++++++-----= ----- BaseTools/Source/Python/GenFds/FfsFileStatement.py | 11 ++-- BaseTools/Source/Python/GenFds/FfsInfStatement.py | 19 +++---- BaseTools/Source/Python/GenFds/Fv.py | 11 ++-- BaseTools/Source/Python/GenFds/FvImageSection.py | 7 +-- BaseTools/Source/Python/GenFds/GenFds.py | 11 ++-- BaseTools/Source/Python/GenFds/GuidSection.py | 11 ++-- BaseTools/Source/Python/GenFds/OptRomFileStatement.py | 3 +- BaseTools/Source/Python/GenFds/OptRomInfStatement.py | 16 +++--- BaseTools/Source/Python/GenFds/OptionRom.py | 6 +-- BaseTools/Source/Python/GenFds/Region.py | 3 +- BaseTools/Source/Python/GenFds/RuleComplexFile.py | 3 +- BaseTools/Source/Python/GenFds/RuleSimpleFile.py | 3 +- BaseTools/Source/Python/GenFds/Section.py | 3 +- BaseTools/Source/Python/GenFds/UiSection.py | 7 +-- BaseTools/Source/Python/GenFds/VerSection.py | 7 +-- BaseTools/Source/Python/GenFds/Vtf.py | 3 +- 25 files changed, 127 insertions(+), 106 deletions(-) diff --git a/BaseTools/Source/Python/GenFds/AprioriSection.py b/BaseTools/S= ource/Python/GenFds/AprioriSection.py index b3e7b5fc64a3..7196f7f2c753 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/P= ython/GenFds/Capsule.py index 35a25bd38037..27932ef0020c 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 * =20 @@ -66,6 +65,7 @@ class Capsule (CapsuleClassObject) : # UINT32 CapsuleImageSize; # } EFI_CAPSULE_HEADER; # + from .GenFds import FindExtendTool Header =3D 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'] =20 diff --git a/BaseTools/Source/Python/GenFds/CapsuleData.py b/BaseTools/Sour= ce/Python/GenFds/CapsuleData.py index 9d17bf5afe28..0caba8983d2e 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 4ae14f27b3e1..aaaabf84dca8 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 * =20 diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Sour= ce/Python/GenFds/DataSection.py index 29caa00c0d8d..a6387b07c582 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/Sou= rce/Python/GenFds/DepexSection.py index f42162d5a27e..b2d123bfc045 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/Sourc= e/Python/GenFds/EfiSection.py index 9223268749a1..623b77d27427 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 552719fa3114..53318c9ea5c0 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 =20 ## generate FD @@ -47,6 +47,7 @@ class FD(FDClassObject): # @retval string Generated FD file name # def GenFd (self, Flag =3D False): + from .GenFds import GenFds if self.FdUiName.upper() + 'fd' in GenFds.ImageBinDict: return GenFds.ImageBinDict[self.FdUiName.upper() + 'fd'] =20 diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index 67217c3b89e3..c890f2d3afb6 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 =20 -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 =20 -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 =20 ##define T_CHAR_SPACE ' ' diff --git a/BaseTools/Source/Python/GenFds/FfsFileStatement.py b/BaseTools= /Source/Python/GenFds/FfsFileStatement.py index 5f31ac03fcf4..4c35aac76a00 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 =20 -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 * =20 diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/= Source/Python/GenFds/FfsInfStatement.py index adb9a95bebfa..56bb966698ad 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 798c20a0f4ee..097f51f39e27 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 * =20 -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=3DNone, BlockSize=3D None, = BlockNum=3DNone, ErasePloarity=3D'1', VtfDict=3DNone, MacroDict =3D {}, Fla= g=3DFalse) : =20 + from .GenFds import GenFds if BaseAddress is None and self.UiFvName.upper() + 'fv' in GenFds.= ImageBinDict: return GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] =20 diff --git a/BaseTools/Source/Python/GenFds/FvImageSection.py b/BaseTools/S= ource/Python/GenFds/FvImageSection.py index b4f1f3340e99..04556fc87099 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/Py= thon/GenFds/GenFds.py index b90b50e53967..c0b60b9b3c1f 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 =20 diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Sour= ce/Python/GenFds/GuidSection.py index c55fb34f2b74..e41c2fd31e6c 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 * =20 ## generate GUIDed section @@ -131,6 +131,7 @@ class GuidSection(GuidSectionClassObject) : ExternalTool =3D None ExternalOption =3D None if self.NameGuid is not None: + from .GenFds import FindExtendTool ExternalTool, ExternalOption =3D FindExtendTool(self.KeyString= List, self.CurrentArchList, self.NameGuid) =20 # diff --git a/BaseTools/Source/Python/GenFds/OptRomFileStatement.py b/BaseTo= ols/Source/Python/GenFds/OptRomFileStatement.py index 8b6d2a1cb0bd..e56174ec3c86 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 =20 -from GenFdsGlobalVariable import GenFdsGlobalVariable +from .GenFdsGlobalVariable import GenFdsGlobalVariable ## # # diff --git a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py b/BaseToo= ls/Source/Python/GenFds/OptRomInfStatement.py index dff8235ef755..dfeba5d0b140 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 =20 from Common.DataType import * from Common.StringUtils import * -from FfsInfStatement import FfsInfStatement -from GenFdsGlobalVariable import GenFdsGlobalVariable +from .FfsInfStatement import FfsInfStatement +from .GenFdsGlobalVariable import GenFdsGlobalVariable =20 ## # @@ -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 =3D OptionRom.OverrideAttribs() =20 @@ -150,5 +150,3 @@ class OptRomInfStatement (FfsInfStatement): OutputFileList.extend(FileList) =20 return OutputFileList - - diff --git a/BaseTools/Source/Python/GenFds/OptionRom.py b/BaseTools/Source= /Python/GenFds/OptionRom.py index 18f3fbd0d7a2..bb7071fa7fca 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 =20 -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/Py= thon/GenFds/Region.py index 33e4ac8d3c37..7f94b3d66b55 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 36c483fbb207..c357fedbd3be 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 =20 ## complex rule diff --git a/BaseTools/Source/Python/GenFds/RuleSimpleFile.py b/BaseTools/S= ource/Python/GenFds/RuleSimpleFile.py index 061f984e6af4..7aa184e7d8bb 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 =20 ## simple rule diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/P= ython/GenFds/Section.py index ca4705a90c95..19a70009dcce 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 280500952b63..24f2f3ca938d 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/Sourc= e/Python/GenFds/VerSection.py index 456a430079bb..db71fe9653d4 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/Pytho= n/GenFds/Vtf.py index 83abc98f07c3..5cb2d4acfb1c 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 --=20 2.18.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Apr 27 22:55:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1531193496771569.8579492971752; Mon, 9 Jul 2018 20:31:36 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id CE79520968912; Mon, 9 Jul 2018 20:31:31 -0700 (PDT) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E65BB2096DCD4 for ; Mon, 9 Jul 2018 20:31:29 -0700 (PDT) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Tue, 10 Jul 2018 05:31:26 +0200 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org From: Gary Lin To: edk2-devel@lists.01.org Date: Tue, 10 Jul 2018 11:30:56 +0800 Message-Id: <20180710033107.32359-4-glin@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710033107.32359-1-glin@suse.com> References: <20180710033107.32359-1-glin@suse.com> Subject: [edk2] [PATCH 03/14] BaseTools: Move OverrideAttribs to OptRomInfStatement.py X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move "class OverrideAttribs" to OptRomInfStatement.py to remove "import OptionRom" which may form a circular import: GenFds.OptionRom =3D> GenFds.OptRomInfStatement =3D> GenFds.OptionRom Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/Source/Python/GenFds/FdfParser.py | 2 +- BaseTools/Source/Python/GenFds/OptRomInfStatement.py | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index c890f2d3afb6..8125ffaf32be 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -4440,7 +4440,7 @@ class FdfParser: # def __GetOptRomOverrides(self, Obj): if self.__IsToken('{'): - Overrides =3D OptionRom.OverrideAttribs() + Overrides =3D OptRomInfStatement.OverrideAttribs() while True: if self.__IsKeyword( "PCI_VENDOR_ID"): if not self.__IsToken( "=3D"): diff --git a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py b/BaseToo= ls/Source/Python/GenFds/OptRomInfStatement.py index dfeba5d0b140..e416b838d1e4 100644 --- a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py +++ b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py @@ -45,9 +45,8 @@ class OptRomInfStatement (FfsInfStatement): # @param self The object pointer # def __GetOptRomParams(self): - from . import OptionRom if self.OverrideAttribs is None: - self.OverrideAttribs =3D OptionRom.OverrideAttribs() + self.OverrideAttribs =3D OverrideAttribs() =20 if self.OverrideAttribs.NeedCompress is None: self.OverrideAttribs.NeedCompress =3D self.OptRomDefs.get ('PC= I_COMPRESS') @@ -150,3 +149,17 @@ class OptRomInfStatement (FfsInfStatement): OutputFileList.extend(FileList) =20 return OutputFileList + +class OverrideAttribs: + + ## The constructor + # + # @param self The object pointer + # + def __init__(self): + + self.PciVendorId =3D None + self.PciClassCode =3D None + self.PciDeviceId =3D None + self.PciRevision =3D None + self.NeedCompress =3D None --=20 2.18.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Apr 27 22:55:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1531193501033564.2103034029144; Mon, 9 Jul 2018 20:31:41 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 03ACD2096DCEF; Mon, 9 Jul 2018 20:31:34 -0700 (PDT) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D4C9E2096DCE8 for ; Mon, 9 Jul 2018 20:31:31 -0700 (PDT) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Tue, 10 Jul 2018 05:31:28 +0200 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org From: Gary Lin To: edk2-devel@lists.01.org Date: Tue, 10 Jul 2018 11:30:57 +0800 Message-Id: <20180710033107.32359-5-glin@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710033107.32359-1-glin@suse.com> References: <20180710033107.32359-1-glin@suse.com> Subject: [edk2] [PATCH 04/14] BaseTools: Move FindExtendTool to GenFdsGlobalVariable.py X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Importing "FindExtendTool" from GenFds.GenFds could create the following circular imports: * GenFds.FdfParser =3D> GenFds.Capsule =3D> GenFds.GenFds =3D> GenFds.FdfPa= rser * GenFds.FdfParser =3D> GenFds.Fd =3D> GenFds.Fv =3D> GenFds.AprioriSection= =3D> GenFds.FfsFileStatement =3D> GenFds.GuidSection =3D> GenFds.GenFds =3D> GenFds.FdfParser This commit moves "FindExtendTool" to GenFdsGlobalVariable.py to break the circles. Besides, FindExtendTool is tweaked slightly with the following changes: ToolDefClassObject.ToolDefDict =3D> ToolDefDict TAB_GUID =3D> DataType.TAB_GUID TAB_TOD_DEFINES_TARGET =3D> DataType.TAB_TOD_DEFINES_TARGET TAB_TOD_DEFINES_TOOL_CHAIN_TAG =3D> DataType.TAB_TOD_DEFINES_TOOL_CHAIN_TAG TAB_TOD_DEFINES_TARGET_ARCH =3D> DataType.TAB_TOD_DEFINES_TARGET_ARCH Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/Source/Python/GenFds/Capsule.py | 2 +- BaseTools/Source/Python/GenFds/GenFds.py | 92 --------------= ----- BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 94 ++++++++++++++= +++++- BaseTools/Source/Python/GenFds/GuidSection.py | 2 +- 4 files changed, 95 insertions(+), 95 deletions(-) diff --git a/BaseTools/Source/Python/GenFds/Capsule.py b/BaseTools/Source/P= ython/GenFds/Capsule.py index 27932ef0020c..8471cd5d0f7a 100644 --- a/BaseTools/Source/Python/GenFds/Capsule.py +++ b/BaseTools/Source/Python/GenFds/Capsule.py @@ -17,6 +17,7 @@ # from __future__ import absolute_import from .GenFdsGlobalVariable import GenFdsGlobalVariable +from .GenFdsGlobalVariable import FindExtendTool from CommonDataClass.FdfClass import CapsuleClassObject import Common.LongFilePathOs as os import subprocess @@ -65,7 +66,6 @@ class Capsule (CapsuleClassObject) : # UINT32 CapsuleImageSize; # } EFI_CAPSULE_HEADER; # - from .GenFds import FindExtendTool Header =3D BytesIO() # # Use FMP capsule GUID: 6DCBD5ED-E82D-4C44-BDA1-7194199AD92A diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Py= thon/GenFds/GenFds.py index c0b60b9b3c1f..865c5099d1eb 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -368,98 +368,6 @@ def SingleCheckCallback(option, opt_str, value, parser= ): else: parser.error("Option %s only allows one instance in command line!"= % option) =20 -## FindExtendTool() -# -# Find location of tools to process data -# -# @param KeyStringList Filter for inputs of section generation -# @param CurrentArchList Arch list -# @param NameGuid The Guid name -# -def FindExtendTool(KeyStringList, CurrentArchList, NameGuid): - ToolDb =3D ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir= ).ToolsDefTxtDatabase - # if user not specify filter, try to deduce it from global data. - if KeyStringList is None or KeyStringList =3D=3D []: - Target =3D GenFdsGlobalVariable.TargetName - ToolChain =3D GenFdsGlobalVariable.ToolChainTag - if ToolChain not in ToolDb['TOOL_CHAIN_TAG']: - EdkLogger.error("GenFds", GENFDS_ERROR, "Can not find external= tool because tool tag %s is not defined in tools_def.txt!" % ToolChain) - KeyStringList =3D [Target + '_' + ToolChain + '_' + CurrentArchLis= t[0]] - for Arch in CurrentArchList: - if Target + '_' + ToolChain + '_' + Arch not in KeyStringList: - KeyStringList.append(Target + '_' + ToolChain + '_' + Arch) - - if GenFdsGlobalVariable.GuidToolDefinition: - if NameGuid in GenFdsGlobalVariable.GuidToolDefinition: - return GenFdsGlobalVariable.GuidToolDefinition[NameGuid] - - ToolDefinition =3D ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable= .ConfDir).ToolsDefTxtDictionary - ToolPathTmp =3D None - ToolOption =3D None - ToolPathKey =3D None - ToolOptionKey =3D None - KeyList =3D None - for ToolDef in ToolDefinition.items(): - if NameGuid.lower() =3D=3D ToolDef[1].lower() : - KeyList =3D ToolDef[0].split('_') - Key =3D KeyList[0] + \ - '_' + \ - KeyList[1] + \ - '_' + \ - KeyList[2] - if Key in KeyStringList and KeyList[4] =3D=3D TAB_GUID: - ToolPathKey =3D Key + '_' + KeyList[3] + '_PATH' - ToolOptionKey =3D Key + '_' + KeyList[3] + '_FLAGS' - ToolPath =3D ToolDefinition.get(ToolPathKey) - ToolOption =3D ToolDefinition.get(ToolOptionKey) - if ToolPathTmp is None: - ToolPathTmp =3D ToolPath - else: - if ToolPathTmp !=3D ToolPath: - EdkLogger.error("GenFds", GENFDS_ERROR, "Don't kno= w which tool to use, %s or %s ?" % (ToolPathTmp, ToolPath)) - - BuildOption =3D {} - for Arch in CurrentArchList: - Platform =3D GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlob= alVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlo= balVariable.ToolChainTag] - # key is (ToolChainFamily, ToolChain, CodeBase) - for item in Platform.BuildOptions: - if '_PATH' in item[1] or '_FLAGS' in item[1] or '_GUID' in ite= m[1]: - if not item[0] or (item[0] and GenFdsGlobalVariable.ToolCh= ainFamily=3D=3D item[0]): - if item[1] not in BuildOption: - BuildOption[item[1]] =3D Platform.BuildOptions[ite= m] - if BuildOption: - ToolList =3D [TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHA= IN_TAG, TAB_TOD_DEFINES_TARGET_ARCH] - for Index in range(2, -1, -1): - for Key in list(BuildOption.keys()): - List =3D Key.split('_') - if List[Index] =3D=3D '*': - for String in ToolDb[ToolList[Index]]: - if String in [Arch, GenFdsGlobalVariable.Targe= tName, GenFdsGlobalVariable.ToolChainTag]: - List[Index] =3D String - NewKey =3D '%s_%s_%s_%s_%s' % tuple(List) - if NewKey not in BuildOption: - BuildOption[NewKey] =3D BuildOption[Ke= y] - continue - del BuildOption[Key] - elif List[Index] not in ToolDb[ToolList[Index]]: - del BuildOption[Key] - if BuildOption: - if not KeyList: - for Op in BuildOption: - if NameGuid =3D=3D BuildOption[Op]: - KeyList =3D Op.split('_') - Key =3D KeyList[0] + '_' + KeyList[1] +'_' + KeyList[2] - if Key in KeyStringList and KeyList[4] =3D=3D TAB_GUID: - ToolPathKey =3D Key + '_' + KeyList[3] + '_PATH' - ToolOptionKey =3D Key + '_' + KeyList[3] + '_FLAGS' - if ToolPathKey in BuildOption: - ToolPathTmp =3D BuildOption[ToolPathKey] - if ToolOptionKey in BuildOption: - ToolOption =3D BuildOption[ToolOptionKey] - - GenFdsGlobalVariable.GuidToolDefinition[NameGuid] =3D (ToolPathTmp, To= olOption) - return ToolPathTmp, ToolOption - ## Parse command line options # # Using standard Python module optparse to parse command line option of th= is tool. diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseT= ools/Source/Python/GenFds/GenFdsGlobalVariable.py index eeb3ec2197a8..52aa7a1538f7 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -27,7 +27,7 @@ from Common import EdkLogger from Common.Misc import SaveFileOnChange =20 from Common.TargetTxtClassObject import TargetTxtClassObject -from Common.ToolDefClassObject import ToolDefClassObject +from Common.ToolDefClassObject import ToolDefClassObject, ToolDefDict from AutoGen.BuildEngine import BuildRule import Common.DataType as DataType from Common.Misc import PathClass @@ -843,3 +843,95 @@ class GenFdsGlobalVariable: DebugLogger =3D staticmethod(DebugLogger) MacroExtend =3D staticmethod (MacroExtend) GetPcdValue =3D staticmethod(GetPcdValue) + +## FindExtendTool() +# +# Find location of tools to process data +# +# @param KeyStringList Filter for inputs of section generation +# @param CurrentArchList Arch list +# @param NameGuid The Guid name +# +def FindExtendTool(KeyStringList, CurrentArchList, NameGuid): + ToolDb =3D ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDataba= se + # if user not specify filter, try to deduce it from global data. + if KeyStringList is None or KeyStringList =3D=3D []: + Target =3D GenFdsGlobalVariable.TargetName + ToolChain =3D GenFdsGlobalVariable.ToolChainTag + if ToolChain not in ToolDb['TOOL_CHAIN_TAG']: + EdkLogger.error("GenFds", GENFDS_ERROR, "Can not find external= tool because tool tag %s is not defined in tools_def.txt!" % ToolChain) + KeyStringList =3D [Target + '_' + ToolChain + '_' + CurrentArchLis= t[0]] + for Arch in CurrentArchList: + if Target + '_' + ToolChain + '_' + Arch not in KeyStringList: + KeyStringList.append(Target + '_' + ToolChain + '_' + Arch) + + if GenFdsGlobalVariable.GuidToolDefinition: + if NameGuid in GenFdsGlobalVariable.GuidToolDefinition: + return GenFdsGlobalVariable.GuidToolDefinition[NameGuid] + + ToolDefinition =3D ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefT= xtDictionary + ToolPathTmp =3D None + ToolOption =3D None + ToolPathKey =3D None + ToolOptionKey =3D None + KeyList =3D None + for ToolDef in ToolDefinition.items(): + if NameGuid.lower() =3D=3D ToolDef[1].lower() : + KeyList =3D ToolDef[0].split('_') + Key =3D KeyList[0] + \ + '_' + \ + KeyList[1] + \ + '_' + \ + KeyList[2] + if Key in KeyStringList and KeyList[4] =3D=3D DataType.TAB_GUI= D: + ToolPathKey =3D Key + '_' + KeyList[3] + '_PATH' + ToolOptionKey =3D Key + '_' + KeyList[3] + '_FLAGS' + ToolPath =3D ToolDefinition.get(ToolPathKey) + ToolOption =3D ToolDefinition.get(ToolOptionKey) + if ToolPathTmp is None: + ToolPathTmp =3D ToolPath + else: + if ToolPathTmp !=3D ToolPath: + EdkLogger.error("GenFds", GENFDS_ERROR, "Don't kno= w which tool to use, %s or %s ?" % (ToolPathTmp, ToolPath)) + + BuildOption =3D {} + for Arch in CurrentArchList: + Platform =3D GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlob= alVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlo= balVariable.ToolChainTag] + # key is (ToolChainFamily, ToolChain, CodeBase) + for item in Platform.BuildOptions: + if '_PATH' in item[1] or '_FLAGS' in item[1] or '_GUID' in ite= m[1]: + if not item[0] or (item[0] and GenFdsGlobalVariable.ToolCh= ainFamily=3D=3D item[0]): + if item[1] not in BuildOption: + BuildOption[item[1]] =3D Platform.BuildOptions[ite= m] + if BuildOption: + ToolList =3D [DataType.TAB_TOD_DEFINES_TARGET, DataType.TAB_TO= D_DEFINES_TOOL_CHAIN_TAG, DataType.TAB_TOD_DEFINES_TARGET_ARCH] + for Index in range(2, -1, -1): + for Key in list(BuildOption.keys()): + List =3D Key.split('_') + if List[Index] =3D=3D '*': + for String in ToolDb[ToolList[Index]]: + if String in [Arch, GenFdsGlobalVariable.Targe= tName, GenFdsGlobalVariable.ToolChainTag]: + List[Index] =3D String + NewKey =3D '%s_%s_%s_%s_%s' % tuple(List) + if NewKey not in BuildOption: + BuildOption[NewKey] =3D BuildOption[Ke= y] + continue + del BuildOption[Key] + elif List[Index] not in ToolDb[ToolList[Index]]: + del BuildOption[Key] + if BuildOption: + if not KeyList: + for Op in BuildOption: + if NameGuid =3D=3D BuildOption[Op]: + KeyList =3D Op.split('_') + Key =3D KeyList[0] + '_' + KeyList[1] +'_' + KeyList[2] + if Key in KeyStringList and KeyList[4] =3D=3D DataType= .TAB_GUID: + ToolPathKey =3D Key + '_' + KeyList[3] + '_PATH' + ToolOptionKey =3D Key + '_' + KeyList[3] + '_FLAGS' + if ToolPathKey in BuildOption: + ToolPathTmp =3D BuildOption[ToolPathKey] + if ToolOptionKey in BuildOption: + ToolOption =3D BuildOption[ToolOptionKey] + + GenFdsGlobalVariable.GuidToolDefinition[NameGuid] =3D (ToolPathTmp, To= olOption) + return ToolPathTmp, ToolOption diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Sour= ce/Python/GenFds/GuidSection.py index e41c2fd31e6c..fd660737f421 100644 --- a/BaseTools/Source/Python/GenFds/GuidSection.py +++ b/BaseTools/Source/Python/GenFds/GuidSection.py @@ -22,6 +22,7 @@ import subprocess from .Ffs import Ffs import Common.LongFilePathOs as os from .GenFdsGlobalVariable import GenFdsGlobalVariable +from .GenFdsGlobalVariable import FindExtendTool from CommonDataClass.FdfClass import GuidSectionClassObject from Common import ToolDefClassObject import sys @@ -131,7 +132,6 @@ class GuidSection(GuidSectionClassObject) : ExternalTool =3D None ExternalOption =3D None if self.NameGuid is not None: - from .GenFds import FindExtendTool ExternalTool, ExternalOption =3D FindExtendTool(self.KeyString= List, self.CurrentArchList, self.NameGuid) =20 # --=20 2.18.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Apr 27 22:55:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1531193508325308.3036154307829; Mon, 9 Jul 2018 20:31:48 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2ECA72096DCEE; Mon, 9 Jul 2018 20:31:36 -0700 (PDT) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C6A1D2096DCED for ; Mon, 9 Jul 2018 20:31:33 -0700 (PDT) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Tue, 10 Jul 2018 05:31:30 +0200 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org From: Gary Lin To: edk2-devel@lists.01.org Date: Tue, 10 Jul 2018 11:30:58 +0800 Message-Id: <20180710033107.32359-6-glin@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710033107.32359-1-glin@suse.com> References: <20180710033107.32359-1-glin@suse.com> Subject: [edk2] [PATCH 05/14] BaseTools: Move ImageBinDict to GenFdsGlobalVariable.py X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 =3D> GenFds.Capsule =3D> GenFds.GenFds =3D> GenFds.FdfPa= rser * GenFds.FdfParser =3D> GenFds.Fd =3D> GenFds.GenFds =3D> GenFds.FdfParser * GenFds.FdfParser =3D> GenFds.Fd =3D> GenFds.Fv =3D> GenFds.GenFds =3D> GenFds.FdfParser Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/Source/Python/GenFds/Capsule.py | 7 +++---- BaseTools/Source/Python/GenFds/Fd.py | 15 +++++++-------- BaseTools/Source/Python/GenFds/Fv.py | 11 +++++------ BaseTools/Source/Python/GenFds/GenFds.py | 2 -- BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 3 +++ 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/BaseTools/Source/Python/GenFds/Capsule.py b/BaseTools/Source/P= ython/GenFds/Capsule.py index 8471cd5d0f7a..baa6e1dfa2ab 100644 --- a/BaseTools/Source/Python/GenFds/Capsule.py +++ b/BaseTools/Source/Python/GenFds/Capsule.py @@ -201,9 +201,8 @@ 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'] + if self.UiCapsuleName.upper() + 'cap' in GenFdsGlobalVariable.Imag= eBinDict: + return GenFdsGlobalVariable.ImageBinDict[self.UiCapsuleName.up= per() + 'cap'] =20 GenFdsGlobalVariable.InfLogger( "\nGenerate %s Capsule" %self.UiCa= psuleName) if ('CAPSULE_GUID' in self.TokensDict and @@ -237,7 +236,7 @@ class Capsule (CapsuleClassObject) : =20 GenFdsGlobalVariable.VerboseLogger( "\nGenerate %s Capsule Success= fully" %self.UiCapsuleName) GenFdsGlobalVariable.SharpCounter =3D 0 - GenFds.ImageBinDict[self.UiCapsuleName.upper() + 'cap'] =3D CapOut= putFile + GenFdsGlobalVariable.ImageBinDict[self.UiCapsuleName.upper() + 'ca= p'] =3D CapOutputFile return CapOutputFile =20 ## Generate inf file for capsule diff --git a/BaseTools/Source/Python/GenFds/Fd.py b/BaseTools/Source/Python= /GenFds/Fd.py index 53318c9ea5c0..bfae1217984a 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 =3D 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.ImageBinDi= ct: + return GenFdsGlobalVariable.ImageBinDict[self.FdUiName.upper()= + 'fd'] =20 # # Print Information @@ -94,7 +93,7 @@ class FD(FDClassObject): PadRegion.Offset =3D PreviousRegionStart + PreviousReg= ionSize PadRegion.Size =3D RegionObj.Offset - PadRegion.Offset if not Flag: - PadRegion.AddToBuffer(TempFdBuffer, self.BaseAddre= ss, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRa= wDict, self.DefineVarDict) + PadRegion.AddToBuffer(TempFdBuffer, self.BaseAddre= ss, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDi= ct, self.vtfRawDict, self.DefineVarDict) PreviousRegionStart =3D RegionObj.Offset PreviousRegionSize =3D RegionObj.Size # @@ -103,7 +102,7 @@ class FD(FDClassObject): if PreviousRegionSize > self.Size: pass GenFdsGlobalVariable.VerboseLogger('Call each region\'s Ad= dToBuffer function') - RegionObj.AddToBuffer (TempFdBuffer, self.BaseAddress, sel= f.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, = self.DefineVarDict) + RegionObj.AddToBuffer (TempFdBuffer, self.BaseAddress, sel= f.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, sel= f.vtfRawDict, self.DefineVarDict) =20 FdBuffer =3D BytesIO('') PreviousRegionStart =3D -1 @@ -124,7 +123,7 @@ class FD(FDClassObject): PadRegion.Offset =3D PreviousRegionStart + PreviousRegionS= ize PadRegion.Size =3D RegionObj.Offset - PadRegion.Offset if not Flag: - PadRegion.AddToBuffer(FdBuffer, self.BaseAddress, self= .BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, s= elf.DefineVarDict) + PadRegion.AddToBuffer(FdBuffer, self.BaseAddress, self= .BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self= .vtfRawDict, self.DefineVarDict) PreviousRegionStart =3D RegionObj.Offset PreviousRegionSize =3D RegionObj.Size # @@ -138,7 +137,7 @@ class FD(FDClassObject): # Call each region's AddToBuffer function # GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToB= uffer function') - RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockS= izeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.Def= ineVarDict, Flag=3DFlag) + RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockS= izeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.vtfRaw= Dict, self.DefineVarDict, Flag=3DFlag) # # 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'] =3D FdFileName + GenFdsGlobalVariable.ImageBinDict[self.FdUiName.upper() + 'fd'] = =3D FdFileName return FdFileName =20 ## generate VTF diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python= /GenFds/Fv.py index 097f51f39e27..0d005ebf5bb6 100644 --- a/BaseTools/Source/Python/GenFds/Fv.py +++ b/BaseTools/Source/Python/GenFds/Fv.py @@ -70,9 +70,8 @@ class FV (FvClassObject): # def AddToBuffer (self, Buffer, BaseAddress=3DNone, BlockSize=3D None, = BlockNum=3DNone, ErasePloarity=3D'1', VtfDict=3DNone, MacroDict =3D {}, Fla= g=3DFalse) : =20 - from .GenFds import GenFds - if BaseAddress is None and self.UiFvName.upper() + 'fv' in GenFds.= ImageBinDict: - return GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] + if BaseAddress is None and self.UiFvName.upper() + 'fv' in GenFdsG= lobalVariable.ImageBinDict: + return GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upper()= + 'fv'] =20 # # Check whether FV in Capsule is in FD flash region. @@ -85,7 +84,7 @@ class FV (FvClassObject): for RegionData in RegionObj.RegionDataList: if RegionData.endswith(".fv"): continue - elif RegionData.upper() + 'fv' in GenFds.Image= BinDict: + elif RegionData.upper() + 'fv' in GenFdsGlobal= Variable.ImageBinDict: continue elif self.UiFvName.upper() =3D=3D RegionData.u= pper(): GenFdsGlobalVariable.ErrorLogger("Capsule = %s in FD region can't contain a FV %s in FD region." % (self.CapsuleName, s= elf.UiFvName.upper())) @@ -140,7 +139,7 @@ class FV (FvClassObject): FvOutputFile =3D self.CreateFileName =20 if Flag: - GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] =3D FvOutput= File + GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upper() + 'fv'= ] =3D FvOutputFile return FvOutputFile =20 FvInfoFileName =3D os.path.join(GenFdsGlobalVariable.FfsDir, self.= UiFvName + '.inf') @@ -220,7 +219,7 @@ class FV (FvClassObject): # FvAlignmentValue is less than 1K self.FvAlignment =3D str (FvAlignmentValue) FvFileObj.close() - GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] =3D FvOu= tputFile + GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upper() + = 'fv'] =3D FvOutputFile GenFdsGlobalVariable.LargeFileInFvFlags.pop() else: GenFdsGlobalVariable.ErrorLogger("Failed to generate %s FV= file." %self.UiFvName) diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Py= thon/GenFds/GenFds.py index 865c5099d1eb..a7c1e6c85334 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -415,8 +415,6 @@ def myOptionParser(): # class GenFds : FdfParsef =3D None - # FvName, FdName, CapName in FDF, Image file name - ImageBinDict =3D {} OnlyGenerateThisFd =3D None OnlyGenerateThisFv =3D None OnlyGenerateThisCap =3D None diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseT= ools/Source/Python/GenFds/GenFdsGlobalVariable.py index 52aa7a1538f7..9936498c5158 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -91,6 +91,9 @@ class GenFdsGlobalVariable: =20 SectionHeader =3D struct.Struct("3B 1B") =20 + # FvName, FdName, CapName in FDF, Image file name + ImageBinDict =3D {} + ## LoadBuildRule # @staticmethod --=20 2.18.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Apr 27 22:55:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1531193508321645.0985558582729; Mon, 9 Jul 2018 20:31:48 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5E6292096F326; Mon, 9 Jul 2018 20:31:38 -0700 (PDT) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B05032096DCE8 for ; Mon, 9 Jul 2018 20:31:35 -0700 (PDT) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Tue, 10 Jul 2018 05:31:32 +0200 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org From: Gary Lin To: edk2-devel@lists.01.org Date: Tue, 10 Jul 2018 11:30:59 +0800 Message-Id: <20180710033107.32359-7-glin@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710033107.32359-1-glin@suse.com> References: <20180710033107.32359-1-glin@suse.com> Subject: [edk2] [PATCH 06/14] BaseTools: Use absolute import in AutoGen X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Based on "futurize -f libfuturize.fixes.fix_absolute_import Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/Source/Python/AutoGen/AutoGen.py | 17 +++++++++-------- BaseTools/Source/Python/AutoGen/GenC.py | 7 ++++--- BaseTools/Source/Python/AutoGen/GenMake.py | 3 ++- BaseTools/Source/Python/AutoGen/GenPcdDb.py | 7 ++++--- BaseTools/Source/Python/AutoGen/IdfClassObject.py | 3 ++- BaseTools/Source/Python/AutoGen/StrGather.py | 3 ++- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index d100648606f7..207f2a7258b5 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -16,19 +16,20 @@ ## Import Modules # from __future__ import print_function +from __future__ import absolute_import import Common.LongFilePathOs as os import re import os.path as path import copy import uuid =20 -import GenC -import GenMake -import GenDepex +from . import GenC +from . import GenMake +from . import GenDepex from io import BytesIO =20 -from StrGather import * -from BuildEngine import BuildRule +from .StrGather import * +from .BuildEngine import BuildRule =20 from Common.LongFilePathSupport import CopyLongFilePath from Common.BuildToolError import * @@ -41,14 +42,14 @@ from CommonDataClass.CommonClass import SkuInfoClass from Workspace.BuildClassObject import * from GenPatchPcdTable.GenPatchPcdTable import parsePcdInfoFromMapFile import Common.VpdInfoFile as VpdInfoFile -from GenPcdDb import CreatePcdDatabaseCode +from .GenPcdDb import CreatePcdDatabaseCode from Workspace.MetaFileCommentParser import UsageList from Workspace.WorkspaceCommon import GetModuleLibInstances from Common.MultipleWorkspace import MultipleWorkspace as mws -import InfSectionParser +from . import InfSectionParser import datetime import hashlib -from GenVar import VariableMgr, var_info +from .GenVar import VariableMgr, var_info from collections import OrderedDict from collections import defaultdict from Workspace.WorkspaceCommon import OrderedListDict diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index eac41ed9bf81..528be0f77e3d 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -13,6 +13,7 @@ =20 ## Import Modules # +from __future__ import absolute_import import string import collections import struct @@ -22,9 +23,9 @@ from Common.BuildToolError import * from Common.DataType import * from Common.Misc import * from Common.StringUtils import StringToArray -from StrGather import * -from GenPcdDb import CreatePcdDatabaseCode -from IdfClassObject import * +from .StrGather import * +from .GenPcdDb import CreatePcdDatabaseCode +from .IdfClassObject import * =20 ## PCD type string gItemTypeStringDatabase =3D { diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/= Python/AutoGen/GenMake.py index 992de5490dff..f1dc14754154 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -13,6 +13,7 @@ =20 ## Import Modules # +from __future__ import absolute_import import Common.LongFilePathOs as os import sys import string @@ -23,7 +24,7 @@ from Common.MultipleWorkspace import MultipleWorkspace as= mws from Common.BuildToolError import * from Common.Misc import * from Common.StringUtils import * -from BuildEngine import * +from .BuildEngine import * import Common.GlobalData as GlobalData from collections import OrderedDict =20 diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source= /Python/AutoGen/GenPcdDb.py index c90b814e7dbd..2176bbefeb52 100644 --- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py +++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py @@ -10,13 +10,14 @@ # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # +from __future__ import absolute_import from io import BytesIO from Common.Misc import * from Common.StringUtils import StringToArray from struct import pack -from ValidCheckingInfoObject import VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER -from ValidCheckingInfoObject import VAR_CHECK_PCD_VARIABLE_TAB -from ValidCheckingInfoObject import GetValidationObject +from .ValidCheckingInfoObject import VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER +from .ValidCheckingInfoObject import VAR_CHECK_PCD_VARIABLE_TAB +from .ValidCheckingInfoObject import GetValidationObject from Common.VariableAttributes import VariableAttributes import copy from struct import unpack diff --git a/BaseTools/Source/Python/AutoGen/IdfClassObject.py b/BaseTools/= Source/Python/AutoGen/IdfClassObject.py index b656bd83e3ba..b227b10258da 100644 --- a/BaseTools/Source/Python/AutoGen/IdfClassObject.py +++ b/BaseTools/Source/Python/AutoGen/IdfClassObject.py @@ -13,6 +13,7 @@ ## # Import Modules # +from __future__ import absolute_import import Common.EdkLogger as EdkLogger from Common.BuildToolError import * from Common.StringUtils import GetLineNo @@ -21,7 +22,7 @@ from Common.LongFilePathSupport import LongFilePath import re import os from Common.GlobalData import gIdentifierPattern -from UniClassObject import StripComments +from .UniClassObject import StripComments =20 IMAGE_TOKEN =3D re.compile('IMAGE_TOKEN *\(([A-Z0-9_]+) *\)', re.MULTILINE= | re.UNICODE) =20 diff --git a/BaseTools/Source/Python/AutoGen/StrGather.py b/BaseTools/Sourc= e/Python/AutoGen/StrGather.py index a702ef0dd583..361d49907685 100644 --- a/BaseTools/Source/Python/AutoGen/StrGather.py +++ b/BaseTools/Source/Python/AutoGen/StrGather.py @@ -14,10 +14,11 @@ ## # Import Modules # +from __future__ import absolute_import import re import Common.EdkLogger as EdkLogger from Common.BuildToolError import * -from UniClassObject import * +from .UniClassObject import * from io import BytesIO from struct import pack, unpack from Common.LongFilePathSupport import OpenLongFilePath as open --=20 2.18.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Apr 27 22:55:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1531193511991415.3821264954163; Mon, 9 Jul 2018 20:31:51 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 918632096F336; Mon, 9 Jul 2018 20:31:39 -0700 (PDT) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A160420336ABD for ; Mon, 9 Jul 2018 20:31:37 -0700 (PDT) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Tue, 10 Jul 2018 05:31:34 +0200 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org From: Gary Lin To: edk2-devel@lists.01.org Date: Tue, 10 Jul 2018 11:31:00 +0800 Message-Id: <20180710033107.32359-8-glin@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710033107.32359-1-glin@suse.com> References: <20180710033107.32359-1-glin@suse.com> Subject: [edk2] [PATCH 07/14] BaseTools: Use absolute import in BPDG X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Based on "futurize -f libfuturize.fixes.fix_absolute_import Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/Source/Python/BPDG/BPDG.py | 5 +++-- BaseTools/Source/Python/BPDG/GenVpd.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/BPDG/BPDG.py b/BaseTools/Source/Python= /BPDG/BPDG.py index 07cee8976208..2ec1516c0a08 100644 --- a/BaseTools/Source/Python/BPDG/BPDG.py +++ b/BaseTools/Source/Python/BPDG/BPDG.py @@ -21,6 +21,7 @@ # Import Modules # from __future__ import print_function +from __future__ import absolute_import import Common.LongFilePathOs as os import sys import encodings.ascii @@ -30,8 +31,8 @@ from Common import EdkLogger from Common.BuildToolError import * from Common.BuildVersion import gBUILD_VERSION =20 -import StringTable as st -import GenVpd +from . import StringTable as st +from . import GenVpd =20 PROJECT_NAME =3D st.LBL_BPDG_LONG_UNI VERSION =3D (st.LBL_BPDG_VERSION + " Build " + gBUILD_VERSION) diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py b/BaseTools/Source/Pyth= on/BPDG/GenVpd.py index 2eefcc24905f..cd272a2d9a79 100644 --- a/BaseTools/Source/Python/BPDG/GenVpd.py +++ b/BaseTools/Source/Python/BPDG/GenVpd.py @@ -13,9 +13,10 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. # =20 +from __future__ import absolute_import import Common.LongFilePathOs as os from io import BytesIO -import StringTable as st +from . import StringTable as st import array import re from Common.LongFilePathSupport import OpenLongFilePath as open --=20 2.18.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Apr 27 22:55:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1531193515832500.92971625629264; Mon, 9 Jul 2018 20:31:55 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BBD672096F339; Mon, 9 Jul 2018 20:31:41 -0700 (PDT) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 81B882096F322 for ; Mon, 9 Jul 2018 20:31:39 -0700 (PDT) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Tue, 10 Jul 2018 05:31:36 +0200 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org From: Gary Lin To: edk2-devel@lists.01.org Date: Tue, 10 Jul 2018 11:31:01 +0800 Message-Id: <20180710033107.32359-9-glin@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710033107.32359-1-glin@suse.com> References: <20180710033107.32359-1-glin@suse.com> Subject: [edk2] [PATCH 08/14] BaseTools: Use absolute import in Common X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Based on "futurize -f libfuturize.fixes.fix_absolute_import Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/Source/Python/Common/Database.py | 8 ++++---- BaseTools/Source/Python/Common/EdkLogger.py | 3 ++- BaseTools/Source/Python/Common/Expression.py | 3 ++- BaseTools/Source/Python/Common/LongFilePathOs.py | 3 ++- BaseTools/Source/Python/Common/Misc.py | 9 +++++---- BaseTools/Source/Python/Common/Parsing.py | 5 +++-- BaseTools/Source/Python/Common/StringUtils.py | 9 +++++---- BaseTools/Source/Python/Common/TargetTxtClassObject.py | 9 +++++---- BaseTools/Source/Python/Common/ToolDefClassObject.py | 9 +++++---- 9 files changed, 33 insertions(+), 25 deletions(-) diff --git a/BaseTools/Source/Python/Common/Database.py b/BaseTools/Source/= Python/Common/Database.py index 6abfa1f15e35..1c543aeb41b1 100644 --- a/BaseTools/Source/Python/Common/Database.py +++ b/BaseTools/Source/Python/Common/Database.py @@ -14,13 +14,14 @@ ## # Import Modules # +from __future__ import absolute_import import sqlite3 import Common.LongFilePathOs as os =20 -import EdkLogger as EdkLogger +from . import EdkLogger as EdkLogger from CommonDataClass.DataClass import * -from StringUtils import * -from DataType import * +from .StringUtils import * +from .DataType import * =20 from Table.TableDataModel import TableDataModel from Table.TableFile import TableFile @@ -117,4 +118,3 @@ if __name__ =3D=3D '__main__': Db.QueryTable(Db.TblFile) Db.QueryTable(Db.TblDsc) Db.Close() - diff --git a/BaseTools/Source/Python/Common/EdkLogger.py b/BaseTools/Source= /Python/Common/EdkLogger.py index 3f462df49ada..19749066ecee 100644 --- a/BaseTools/Source/Python/Common/EdkLogger.py +++ b/BaseTools/Source/Python/Common/EdkLogger.py @@ -12,9 +12,10 @@ # =20 ## Import modules +from __future__ import absolute_import import Common.LongFilePathOs as os, sys, logging import traceback -from BuildToolError import * +from .BuildToolError import * =20 ## Log level constants DEBUG_0 =3D 1 diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Sourc= e/Python/Common/Expression.py index 51e8d2174a8f..ccc736846afa 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -13,10 +13,11 @@ ## Import Modules # from __future__ import print_function +from __future__ import absolute_import from Common.GlobalData import * from CommonDataClass.Exceptions import BadExpression from CommonDataClass.Exceptions import WrnExpression -from Misc import GuidStringToGuidStructureString, ParseFieldValue, IsField= ValueAnArray +from .Misc import GuidStringToGuidStructureString, ParseFieldValue, IsFiel= dValueAnArray import Common.EdkLogger as EdkLogger import copy from Common.DataType import * diff --git a/BaseTools/Source/Python/Common/LongFilePathOs.py b/BaseTools/S= ource/Python/Common/LongFilePathOs.py index 4939a8bc733c..53528546b782 100644 --- a/BaseTools/Source/Python/Common/LongFilePathOs.py +++ b/BaseTools/Source/Python/Common/LongFilePathOs.py @@ -11,8 +11,9 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # =20 +from __future__ import absolute_import import os -import LongFilePathOsPath +from . import LongFilePathOsPath from Common.LongFilePathSupport import LongFilePath from Common.LongFilePathSupport import UniToStr import time diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index b56ddd532471..79d1ff28f50b 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -14,6 +14,7 @@ ## # Import Modules # +from __future__ import absolute_import import Common.LongFilePathOs as os import sys import string @@ -30,10 +31,10 @@ from UserList import UserList =20 from Common import EdkLogger as EdkLogger from Common import GlobalData as GlobalData -from DataType import * -from BuildToolError import * +from .DataType import * +from .BuildToolError import * from CommonDataClass.DataClass import * -from Parsing import GetSplitValueList +from .Parsing import GetSplitValueList from Common.LongFilePathSupport import OpenLongFilePath as open from Common.MultipleWorkspace import MultipleWorkspace as mws import uuid @@ -474,7 +475,7 @@ def SaveFileOnChange(File, Content, IsBinaryFile=3DTrue= ): try: if GlobalData.gIsWindows: try: - from PyUtility import SaveFileToDisk + from .PyUtility import SaveFileToDisk if not SaveFileToDisk(File, Content): EdkLogger.error(None, FILE_CREATE_FAILURE, ExtraData= =3DFile) except: diff --git a/BaseTools/Source/Python/Common/Parsing.py b/BaseTools/Source/P= ython/Common/Parsing.py index 527852a50c09..889251b69935 100644 --- a/BaseTools/Source/Python/Common/Parsing.py +++ b/BaseTools/Source/Python/Common/Parsing.py @@ -14,9 +14,10 @@ ## # Import Modules # -from StringUtils import * +from __future__ import absolute_import +from .StringUtils import * from CommonDataClass.DataClass import * -from DataType import * +from .DataType import * =20 ## ParseDefineMacro # diff --git a/BaseTools/Source/Python/Common/StringUtils.py b/BaseTools/Sour= ce/Python/Common/StringUtils.py index 723faac0f9f3..da2949dbadef 100644 --- a/BaseTools/Source/Python/Common/StringUtils.py +++ b/BaseTools/Source/Python/Common/StringUtils.py @@ -14,14 +14,15 @@ ## # Import Modules # +from __future__ import absolute_import import re -import DataType +from . import DataType import Common.LongFilePathOs as os import string -import EdkLogger as EdkLogger +from . import EdkLogger as EdkLogger =20 -import GlobalData -from BuildToolError import * +from . import GlobalData +from .BuildToolError import * from CommonDataClass.Exceptions import * from Common.LongFilePathSupport import OpenLongFilePath as open from Common.MultipleWorkspace import MultipleWorkspace as mws diff --git a/BaseTools/Source/Python/Common/TargetTxtClassObject.py b/BaseT= ools/Source/Python/Common/TargetTxtClassObject.py index 8ba8dd31a8c5..55a2f564821e 100644 --- a/BaseTools/Source/Python/Common/TargetTxtClassObject.py +++ b/BaseTools/Source/Python/Common/TargetTxtClassObject.py @@ -15,11 +15,12 @@ # Import Modules # from __future__ import print_function +from __future__ import absolute_import import Common.LongFilePathOs as os -import EdkLogger -import DataType -from BuildToolError import * -import GlobalData +from . import EdkLogger +from . import DataType +from .BuildToolError import * +from . import GlobalData from Common.LongFilePathSupport import OpenLongFilePath as open =20 gDefaultTargetTxtFile =3D "target.txt" diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py b/BaseToo= ls/Source/Python/Common/ToolDefClassObject.py index 7cc7e22839e1..05a1ddfbcc89 100644 --- a/BaseTools/Source/Python/Common/ToolDefClassObject.py +++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py @@ -14,19 +14,20 @@ ## # Import Modules # +from __future__ import absolute_import import Common.LongFilePathOs as os import re -import EdkLogger +from . import EdkLogger =20 -from BuildToolError import * -from TargetTxtClassObject import * +from .BuildToolError import * +from .TargetTxtClassObject import * from Common.LongFilePathSupport import OpenLongFilePath as open from Common.Misc import PathClass from Common.StringUtils import NormPath import Common.GlobalData as GlobalData from Common import GlobalData from Common.MultipleWorkspace import MultipleWorkspace as mws -from DataType import TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHAIN_TA= G,\ +from .DataType import TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHAIN_T= AG,\ TAB_TOD_DEFINES_TARGET_ARCH, TAB_TOD_DEFINES_COMMAND_= TYPE\ , TAB_TOD_DEFINES_FAMILY, TAB_TOD_DEFINES_BUILDRULEFA= MILY =20 --=20 2.18.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Apr 27 22:55:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 153119351941386.35190320261006; Mon, 9 Jul 2018 20:31:59 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E59F02096F340; Mon, 9 Jul 2018 20:31:43 -0700 (PDT) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7BC7D20336ABD for ; Mon, 9 Jul 2018 20:31:41 -0700 (PDT) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Tue, 10 Jul 2018 05:31:38 +0200 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org From: Gary Lin To: edk2-devel@lists.01.org Date: Tue, 10 Jul 2018 11:31:02 +0800 Message-Id: <20180710033107.32359-10-glin@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710033107.32359-1-glin@suse.com> References: <20180710033107.32359-1-glin@suse.com> Subject: [edk2] [PATCH 09/14] BaseTools: Use absolute import in ECC X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Based on "futurize -f libfuturize.fixes.fix_absolute_import Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/Source/Python/Ecc/CParser.py | 5 ++-- BaseTools/Source/Python/Ecc/Check.py | 9 +++--= -- BaseTools/Source/Python/Ecc/CodeFragmentCollector.py | 13 +++++= ----- BaseTools/Source/Python/Ecc/Database.py | 7 +++--- BaseTools/Source/Python/Ecc/Ecc.py | 25 +++++= +++++---------- BaseTools/Source/Python/Ecc/Exception.py | 3 ++- BaseTools/Source/Python/Ecc/FileProfile.py | 5 ++-- BaseTools/Source/Python/Ecc/MetaDataParser.py | 5 ++-- BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py | 3 ++- BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py | 5 ++-- BaseTools/Source/Python/Ecc/c.py | 13 +++++= ----- 11 files changed, 51 insertions(+), 42 deletions(-) diff --git a/BaseTools/Source/Python/Ecc/CParser.py b/BaseTools/Source/Pyth= on/Ecc/CParser.py index b66ac2d8d545..0b74b53ae7a5 100644 --- a/BaseTools/Source/Python/Ecc/CParser.py +++ b/BaseTools/Source/Python/Ecc/CParser.py @@ -1,6 +1,7 @@ # $ANTLR 3.0.1 C.g 2010-02-23 09:58:53 =20 from __future__ import print_function +from __future__ import absolute_import from antlr3 import * from antlr3.compat import set, frozenset =20 @@ -23,8 +24,8 @@ from antlr3.compat import set, frozenset # ## =20 -import CodeFragment -import FileProfile +from . import CodeFragment +from . import FileProfile =20 =20 =20 diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python= /Ecc/Check.py index 540d9cb7edc7..0b81013d77e9 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -10,14 +10,15 @@ # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # +from __future__ import absolute_import import Common.LongFilePathOs as os import re from CommonDataClass.DataClass import * import Common.DataType as DT -from EccToolError import * -from MetaDataParser import ParseHeaderCommentSection -import EccGlobalData -import c +from .EccToolError import * +from .MetaDataParser import ParseHeaderCommentSection +from . import EccGlobalData +from . import c from Common.LongFilePathSupport import OpenLongFilePath as open from Common.MultipleWorkspace import MultipleWorkspace as mws =20 diff --git a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py b/BaseToo= ls/Source/Python/Ecc/CodeFragmentCollector.py index b4f421342f60..28b4e0196f50 100644 --- a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py +++ b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py @@ -17,18 +17,19 @@ # =20 from __future__ import print_function +from __future__ import absolute_import import re import Common.LongFilePathOs as os import sys =20 import antlr3 -from CLexer import CLexer -from CParser import CParser +from .CLexer import CLexer +from .CParser import CParser =20 -import FileProfile -from CodeFragment import Comment -from CodeFragment import PP_Directive -from ParserWarning import Warning +from . import FileProfile +from .CodeFragment import Comment +from .CodeFragment import PP_Directive +from .ParserWarning import Warning =20 =20 ##define T_CHAR_SPACE ' ' diff --git a/BaseTools/Source/Python/Ecc/Database.py b/BaseTools/Source/Pyt= hon/Ecc/Database.py index 204117512452..34f49f3cba8b 100644 --- a/BaseTools/Source/Python/Ecc/Database.py +++ b/BaseTools/Source/Python/Ecc/Database.py @@ -14,6 +14,7 @@ ## # Import Modules # +from __future__ import absolute_import import sqlite3 import Common.LongFilePathOs as os, time =20 @@ -26,9 +27,9 @@ from Table.TableFunction import TableFunction from Table.TablePcd import TablePcd from Table.TableIdentifier import TableIdentifier from Table.TableReport import TableReport -from MetaFileWorkspace.MetaFileTable import ModuleTable -from MetaFileWorkspace.MetaFileTable import PackageTable -from MetaFileWorkspace.MetaFileTable import PlatformTable +from .MetaFileWorkspace.MetaFileTable import ModuleTable +from .MetaFileWorkspace.MetaFileTable import PackageTable +from .MetaFileWorkspace.MetaFileTable import PlatformTable from Table.TableFdf import TableFdf =20 ## diff --git a/BaseTools/Source/Python/Ecc/Ecc.py b/BaseTools/Source/Python/E= cc/Ecc.py index ccd563a4660e..8f96bdf9778c 100644 --- a/BaseTools/Source/Python/Ecc/Ecc.py +++ b/BaseTools/Source/Python/Ecc/Ecc.py @@ -14,14 +14,15 @@ ## # Import Modules # +from __future__ import absolute_import import Common.LongFilePathOs as os, time, glob, sys import Common.EdkLogger as EdkLogger -import Database -import EccGlobalData -from MetaDataParser import * +from . import Database +from . import EccGlobalData +from .MetaDataParser import * from optparse import OptionParser -from Configuration import Configuration -from Check import Check +from .Configuration import Configuration +from .Check import Check import Common.GlobalData as GlobalData =20 from Common.StringUtils import NormPath @@ -29,14 +30,14 @@ from Common.BuildVersion import gBUILD_VERSION from Common import BuildToolError from Common.Misc import PathClass from Common.Misc import DirCache -from MetaFileWorkspace.MetaFileParser import DscParser -from MetaFileWorkspace.MetaFileParser import DecParser -from MetaFileWorkspace.MetaFileParser import InfParser -from MetaFileWorkspace.MetaFileParser import Fdf -from MetaFileWorkspace.MetaFileTable import MetaFileStorage -import c +from .MetaFileWorkspace.MetaFileParser import DscParser +from .MetaFileWorkspace.MetaFileParser import DecParser +from .MetaFileWorkspace.MetaFileParser import InfParser +from .MetaFileWorkspace.MetaFileParser import Fdf +from .MetaFileWorkspace.MetaFileTable import MetaFileStorage +from . import c import re, string -from Exception import * +from .Exception import * from Common.LongFilePathSupport import OpenLongFilePath as open from Common.MultipleWorkspace import MultipleWorkspace as mws =20 diff --git a/BaseTools/Source/Python/Ecc/Exception.py b/BaseTools/Source/Py= thon/Ecc/Exception.py index 0498a503d774..340e0e975207 100644 --- a/BaseTools/Source/Python/Ecc/Exception.py +++ b/BaseTools/Source/Python/Ecc/Exception.py @@ -15,7 +15,8 @@ # Import Modules # from __future__ import print_function -from Xml.XmlRoutines import * +from __future__ import absolute_import +from .Xml.XmlRoutines import * import Common.LongFilePathOs as os =20 # ExceptionXml to parse Exception Node of XML file diff --git a/BaseTools/Source/Python/Ecc/FileProfile.py b/BaseTools/Source/= Python/Ecc/FileProfile.py index a071fd020eb4..1d3fbf2d3b79 100644 --- a/BaseTools/Source/Python/Ecc/FileProfile.py +++ b/BaseTools/Source/Python/Ecc/FileProfile.py @@ -16,9 +16,10 @@ # Import Modules # =20 +from __future__ import absolute_import import re import Common.LongFilePathOs as os -from ParserWarning import Warning +from .ParserWarning import Warning from Common.LongFilePathSupport import OpenLongFilePath as open =20 CommentList =3D [] @@ -54,5 +55,3 @@ class FileProfile : =20 except IOError: raise Warning("Error when opening file %s" % FileName) - - diff --git a/BaseTools/Source/Python/Ecc/MetaDataParser.py b/BaseTools/Sour= ce/Python/Ecc/MetaDataParser.py index 6060d67581be..e5744dd5cc48 100644 --- a/BaseTools/Source/Python/Ecc/MetaDataParser.py +++ b/BaseTools/Source/Python/Ecc/MetaDataParser.py @@ -11,11 +11,12 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # =20 +from __future__ import absolute_import import Common.LongFilePathOs as os from CommonDataClass.DataClass import * -from EccToolError import * +from .EccToolError import * from Common.MultipleWorkspace import MultipleWorkspace as mws -import EccGlobalData +from . import EccGlobalData import re ## Get the inlcude path list for a source file # diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.p= y b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py index 111a25ed9260..51669815b55f 100644 --- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py @@ -14,6 +14,7 @@ ## # Import Modules # +from __future__ import absolute_import import Common.LongFilePathOs as os import re import time @@ -31,7 +32,7 @@ from Common.Misc import GuidStructureStringToGuidString, = CheckPcdDatum, PathClas from Common.Expression import * from CommonDataClass.Exceptions import * =20 -from MetaFileTable import MetaFileStorage +from .MetaFileTable import MetaFileStorage from GenFds.FdfParser import FdfParser from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import CodecOpenLongFilePath diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py= b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py index ad3cf36a1cbd..7e0afd5d70d7 100644 --- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py +++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py @@ -14,13 +14,14 @@ ## # Import Modules # +from __future__ import absolute_import import uuid =20 import Common.EdkLogger as EdkLogger import EccGlobalData =20 -from MetaDataTable import Table -from MetaDataTable import ConvertToSqlString +from .MetaDataTable import Table +from .MetaDataTable import ConvertToSqlString from CommonDataClass.DataClass import MODEL_FILE_DSC, MODEL_FILE_DEC, MODE= L_FILE_INF, \ MODEL_FILE_OTHERS =20 diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc= /c.py index 12dbf664ba9b..5616c108533e 100644 --- a/BaseTools/Source/Python/Ecc/c.py +++ b/BaseTools/Source/Python/Ecc/c.py @@ -12,18 +12,19 @@ # =20 from __future__ import print_function +from __future__ import absolute_import import sys import Common.LongFilePathOs as os import re import string -import CodeFragmentCollector -import FileProfile +from . import CodeFragmentCollector +from . import FileProfile from CommonDataClass import DataClass -import Database +from . import Database from Common import EdkLogger -from EccToolError import * -import EccGlobalData -import MetaDataParser +from .EccToolError import * +from . import EccGlobalData +from . import MetaDataParser =20 IncludeFileListDict =3D {} AllIncludeFileListDict =3D {} --=20 2.18.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Apr 27 22:55:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1531193523486993.4902978602373; Mon, 9 Jul 2018 20:32:03 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2113C2096F346; Mon, 9 Jul 2018 20:31:45 -0700 (PDT) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5DB852096F322 for ; Mon, 9 Jul 2018 20:31:43 -0700 (PDT) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Tue, 10 Jul 2018 05:31:40 +0200 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org From: Gary Lin To: edk2-devel@lists.01.org Date: Tue, 10 Jul 2018 11:31:03 +0800 Message-Id: <20180710033107.32359-11-glin@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710033107.32359-1-glin@suse.com> References: <20180710033107.32359-1-glin@suse.com> Subject: [edk2] [PATCH 10/14] BaseTools: Use absolute import in Eot X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Based on "futurize -f libfuturize.fixes.fix_absolute_import Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/Source/Python/Eot/CParser.py | 5 +++-- BaseTools/Source/Python/Eot/CodeFragmentCollector.py | 11 +++++----- BaseTools/Source/Python/Eot/Eot.py | 21 ++++++++++------= ---- BaseTools/Source/Python/Eot/FileProfile.py | 3 ++- BaseTools/Source/Python/Eot/InfParserLite.py | 5 +++-- BaseTools/Source/Python/Eot/Parser.py | 3 ++- BaseTools/Source/Python/Eot/Report.py | 3 ++- BaseTools/Source/Python/Eot/c.py | 9 +++++---- 8 files changed, 34 insertions(+), 26 deletions(-) diff --git a/BaseTools/Source/Python/Eot/CParser.py b/BaseTools/Source/Pyth= on/Eot/CParser.py index b66ac2d8d545..0b74b53ae7a5 100644 --- a/BaseTools/Source/Python/Eot/CParser.py +++ b/BaseTools/Source/Python/Eot/CParser.py @@ -1,6 +1,7 @@ # $ANTLR 3.0.1 C.g 2010-02-23 09:58:53 =20 from __future__ import print_function +from __future__ import absolute_import from antlr3 import * from antlr3.compat import set, frozenset =20 @@ -23,8 +24,8 @@ from antlr3.compat import set, frozenset # ## =20 -import CodeFragment -import FileProfile +from . import CodeFragment +from . import FileProfile =20 =20 =20 diff --git a/BaseTools/Source/Python/Eot/CodeFragmentCollector.py b/BaseToo= ls/Source/Python/Eot/CodeFragmentCollector.py index 1e30e2ce62e2..8a5e5df17e5a 100644 --- a/BaseTools/Source/Python/Eot/CodeFragmentCollector.py +++ b/BaseTools/Source/Python/Eot/CodeFragmentCollector.py @@ -16,17 +16,18 @@ # Import Modules # from __future__ import print_function +from __future__ import absolute_import import re import Common.LongFilePathOs as os import sys =20 import antlr3 -from CLexer import CLexer -from CParser import CParser +from .CLexer import CLexer +from .CParser import CParser =20 -import FileProfile -from CodeFragment import PP_Directive -from ParserWarning import Warning +from . import FileProfile +from .CodeFragment import PP_Directive +from .ParserWarning import Warning =20 =20 ##define T_CHAR_SPACE ' ' diff --git a/BaseTools/Source/Python/Eot/Eot.py b/BaseTools/Source/Python/E= ot/Eot.py index 297847cdab91..6fb882642bff 100644 --- a/BaseTools/Source/Python/Eot/Eot.py +++ b/BaseTools/Source/Python/Eot/Eot.py @@ -14,20 +14,21 @@ ## # Import Modules # +from __future__ import absolute_import import Common.LongFilePathOs as os, time, glob import Common.EdkLogger as EdkLogger -import EotGlobalData +from . import EotGlobalData from optparse import OptionParser from Common.StringUtils import NormPath from Common import BuildToolError from Common.Misc import GuidStructureStringToGuidString, sdict -from InfParserLite import * -import c -import Database +from .InfParserLite import * +from . import c +from . import Database from array import array -from Report import Report +from .Report import Report from Common.BuildVersion import gBUILD_VERSION -from Parser import ConvertGuid +from .Parser import ConvertGuid from Common.LongFilePathSupport import OpenLongFilePath as open import struct import uuid @@ -153,7 +154,7 @@ class CompressedImage(Image): =20 def _GetSections(m): try: - import EfiCompressor + from . import EfiCompressor TmpData =3D EfiCompressor.FrameworkDecompress( m[m._HEADER_SIZE_:], len(m) - m._HEADER_SIZE_ @@ -161,7 +162,7 @@ class CompressedImage(Image): DecData =3D array('B') DecData.fromstring(TmpData) except: - import EfiCompressor + from . import EfiCompressor TmpData =3D EfiCompressor.UefiDecompress( m[m._HEADER_SIZE_:], len(m) - m._HEADER_SIZE_ @@ -748,7 +749,7 @@ class GuidDefinedImage(Image): SectionList.append(Sec) elif Guid =3D=3D m.TIANO_COMPRESS_GUID: try: - import EfiCompressor + from . import EfiCompressor # skip the header Offset =3D m.DataOffset - 4 TmpData =3D EfiCompressor.FrameworkDecompress(m[Offset:], = len(m)-Offset) @@ -769,7 +770,7 @@ class GuidDefinedImage(Image): pass elif Guid =3D=3D m.LZMA_COMPRESS_GUID: try: - import LzmaCompressor + from . import LzmaCompressor # skip the header Offset =3D m.DataOffset - 4 TmpData =3D LzmaCompressor.LzmaDecompress(m[Offset:], len(= m)-Offset) diff --git a/BaseTools/Source/Python/Eot/FileProfile.py b/BaseTools/Source/= Python/Eot/FileProfile.py index 0544c0d55b44..3846279cad4c 100644 --- a/BaseTools/Source/Python/Eot/FileProfile.py +++ b/BaseTools/Source/Python/Eot/FileProfile.py @@ -16,9 +16,10 @@ # Import Modules # =20 +from __future__ import absolute_import import re import Common.LongFilePathOs as os -from ParserWarning import Warning +from .ParserWarning import Warning from Common.LongFilePathSupport import OpenLongFilePath as open =20 # Profile contents of a file diff --git a/BaseTools/Source/Python/Eot/InfParserLite.py b/BaseTools/Sourc= e/Python/Eot/InfParserLite.py index 24f0d50246e5..88d7e7d58e0b 100644 --- a/BaseTools/Source/Python/Eot/InfParserLite.py +++ b/BaseTools/Source/Python/Eot/InfParserLite.py @@ -15,14 +15,15 @@ # Import Modules # from __future__ import print_function +from __future__ import absolute_import import Common.LongFilePathOs as os import Common.EdkLogger as EdkLogger from Common.DataType import * from CommonDataClass.DataClass import * from Common.Identification import * from Common.StringUtils import * -from Parser import * -import Database +from .Parser import * +from . import Database =20 ## EdkInfParser() class # diff --git a/BaseTools/Source/Python/Eot/Parser.py b/BaseTools/Source/Pytho= n/Eot/Parser.py index 0b720d5b2187..e01a9770befb 100644 --- a/BaseTools/Source/Python/Eot/Parser.py +++ b/BaseTools/Source/Python/Eot/Parser.py @@ -15,12 +15,13 @@ ## # Import Modules # +from __future__ import absolute_import import Common.LongFilePathOs as os, re import Common.EdkLogger as EdkLogger from Common.DataType import * from CommonDataClass.DataClass import * from Common.StringUtils import CleanString, GetSplitValueList, ReplaceMacro -import EotGlobalData +from . import EotGlobalData from Common.StringUtils import GetSplitList from Common.LongFilePathSupport import OpenLongFilePath as open =20 diff --git a/BaseTools/Source/Python/Eot/Report.py b/BaseTools/Source/Pytho= n/Eot/Report.py index e9716c988c8b..4ddddb103401 100644 --- a/BaseTools/Source/Python/Eot/Report.py +++ b/BaseTools/Source/Python/Eot/Report.py @@ -14,8 +14,9 @@ ## # Import Modules # +from __future__ import absolute_import import Common.LongFilePathOs as os -import EotGlobalData +from . import EotGlobalData from Common.LongFilePathSupport import OpenLongFilePath as open =20 ## Report() class diff --git a/BaseTools/Source/Python/Eot/c.py b/BaseTools/Source/Python/Eot= /c.py index ceefc952237f..4f0b58a52c79 100644 --- a/BaseTools/Source/Python/Eot/c.py +++ b/BaseTools/Source/Python/Eot/c.py @@ -16,15 +16,16 @@ # Import Modules # from __future__ import print_function +from __future__ import absolute_import import sys import Common.LongFilePathOs as os import re -import CodeFragmentCollector -import FileProfile +from . import CodeFragmentCollector +from . import FileProfile from CommonDataClass import DataClass from Common import EdkLogger -from EotToolError import * -import EotGlobalData +from .EotToolError import * +from . import EotGlobalData =20 # Global Dicts IncludeFileListDict =3D {} --=20 2.18.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Apr 27 22:55:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1531193527801107.36632036159472; Mon, 9 Jul 2018 20:32:07 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 512172096F353; Mon, 9 Jul 2018 20:31:46 -0700 (PDT) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4CD442096F353 for ; Mon, 9 Jul 2018 20:31:45 -0700 (PDT) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Tue, 10 Jul 2018 05:31:42 +0200 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org From: Gary Lin To: edk2-devel@lists.01.org Date: Tue, 10 Jul 2018 11:31:04 +0800 Message-Id: <20180710033107.32359-12-glin@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710033107.32359-1-glin@suse.com> References: <20180710033107.32359-1-glin@suse.com> Subject: [edk2] [PATCH 11/14] BaseTools: Use absolute import in Table X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Based on "futurize -f libfuturize.fixes.fix_absolute_import Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/Source/Python/Table/TableDataModel.py | 3 ++- BaseTools/Source/Python/Table/TableDec.py | 3 ++- BaseTools/Source/Python/Table/TableDsc.py | 3 ++- BaseTools/Source/Python/Table/TableEotReport.py | 3 ++- BaseTools/Source/Python/Table/TableFdf.py | 3 ++- BaseTools/Source/Python/Table/TableFile.py | 3 ++- BaseTools/Source/Python/Table/TableFunction.py | 3 ++- BaseTools/Source/Python/Table/TableIdentifier.py | 3 ++- BaseTools/Source/Python/Table/TableInf.py | 3 ++- BaseTools/Source/Python/Table/TablePcd.py | 3 ++- BaseTools/Source/Python/Table/TableQuery.py | 3 ++- BaseTools/Source/Python/Table/TableReport.py | 3 ++- 12 files changed, 24 insertions(+), 12 deletions(-) diff --git a/BaseTools/Source/Python/Table/TableDataModel.py b/BaseTools/So= urce/Python/Table/TableDataModel.py index f167e433599a..ea0996f66332 100644 --- a/BaseTools/Source/Python/Table/TableDataModel.py +++ b/BaseTools/Source/Python/Table/TableDataModel.py @@ -14,9 +14,10 @@ ## # Import Modules # +from __future__ import absolute_import import Common.EdkLogger as EdkLogger import CommonDataClass.DataClass as DataClass -from Table import Table +from .Table import Table from Common.StringUtils import ConvertToSqlString =20 ## TableDataModel diff --git a/BaseTools/Source/Python/Table/TableDec.py b/BaseTools/Source/P= ython/Table/TableDec.py index faa18e309d72..bbae3e857e1a 100644 --- a/BaseTools/Source/Python/Table/TableDec.py +++ b/BaseTools/Source/Python/Table/TableDec.py @@ -14,9 +14,10 @@ ## # Import Modules # +from __future__ import absolute_import import Common.EdkLogger as EdkLogger import CommonDataClass.DataClass as DataClass -from Table import Table +from .Table import Table from Common.StringUtils import ConvertToSqlString =20 ## TableDec diff --git a/BaseTools/Source/Python/Table/TableDsc.py b/BaseTools/Source/P= ython/Table/TableDsc.py index 227748951841..6436973c4534 100644 --- a/BaseTools/Source/Python/Table/TableDsc.py +++ b/BaseTools/Source/Python/Table/TableDsc.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import ## @file # This file is used to create/update/query/erase table for dsc datas # @@ -16,7 +17,7 @@ # import Common.EdkLogger as EdkLogger import CommonDataClass.DataClass as DataClass -from Table import Table +from .Table import Table from Common.StringUtils import ConvertToSqlString =20 ## TableDsc diff --git a/BaseTools/Source/Python/Table/TableEotReport.py b/BaseTools/So= urce/Python/Table/TableEotReport.py index e8291b48d7c3..0a490161cda8 100644 --- a/BaseTools/Source/Python/Table/TableEotReport.py +++ b/BaseTools/Source/Python/Table/TableEotReport.py @@ -14,9 +14,10 @@ ## # Import Modules # +from __future__ import absolute_import import Common.EdkLogger as EdkLogger import Common.LongFilePathOs as os, time -from Table import Table +from .Table import Table from Common.StringUtils import ConvertToSqlString2 import Eot.EotToolError as EotToolError import Eot.EotGlobalData as EotGlobalData diff --git a/BaseTools/Source/Python/Table/TableFdf.py b/BaseTools/Source/P= ython/Table/TableFdf.py index 872afc79ef44..80be9532cae1 100644 --- a/BaseTools/Source/Python/Table/TableFdf.py +++ b/BaseTools/Source/Python/Table/TableFdf.py @@ -14,9 +14,10 @@ ## # Import Modules # +from __future__ import absolute_import import Common.EdkLogger as EdkLogger import CommonDataClass.DataClass as DataClass -from Table import Table +from .Table import Table from Common.StringUtils import ConvertToSqlString =20 ## TableFdf diff --git a/BaseTools/Source/Python/Table/TableFile.py b/BaseTools/Source/= Python/Table/TableFile.py index 34a0b47418dc..689264c2578a 100644 --- a/BaseTools/Source/Python/Table/TableFile.py +++ b/BaseTools/Source/Python/Table/TableFile.py @@ -14,8 +14,9 @@ ## # Import Modules # +from __future__ import absolute_import import Common.EdkLogger as EdkLogger -from Table import Table +from .Table import Table from Common.StringUtils import ConvertToSqlString import Common.LongFilePathOs as os from CommonDataClass.DataClass import FileClass diff --git a/BaseTools/Source/Python/Table/TableFunction.py b/BaseTools/Sou= rce/Python/Table/TableFunction.py index bf301fd2620c..166718060600 100644 --- a/BaseTools/Source/Python/Table/TableFunction.py +++ b/BaseTools/Source/Python/Table/TableFunction.py @@ -14,8 +14,9 @@ ## # Import Modules # +from __future__ import absolute_import import Common.EdkLogger as EdkLogger -from Table import Table +from .Table import Table from Common.StringUtils import ConvertToSqlString =20 ## TableFunction diff --git a/BaseTools/Source/Python/Table/TableIdentifier.py b/BaseTools/S= ource/Python/Table/TableIdentifier.py index 5ce528b26a4c..8b4dd1d310ec 100644 --- a/BaseTools/Source/Python/Table/TableIdentifier.py +++ b/BaseTools/Source/Python/Table/TableIdentifier.py @@ -14,9 +14,10 @@ ## # Import Modules # +from __future__ import absolute_import import Common.EdkLogger as EdkLogger from Common.StringUtils import ConvertToSqlString -from Table import Table +from .Table import Table =20 ## TableIdentifier # diff --git a/BaseTools/Source/Python/Table/TableInf.py b/BaseTools/Source/P= ython/Table/TableInf.py index c524256a0c5d..a00096ac303a 100644 --- a/BaseTools/Source/Python/Table/TableInf.py +++ b/BaseTools/Source/Python/Table/TableInf.py @@ -14,9 +14,10 @@ ## # Import Modules # +from __future__ import absolute_import import Common.EdkLogger as EdkLogger import CommonDataClass.DataClass as DataClass -from Table import Table +from .Table import Table from Common.StringUtils import ConvertToSqlString =20 ## TableInf diff --git a/BaseTools/Source/Python/Table/TablePcd.py b/BaseTools/Source/P= ython/Table/TablePcd.py index 689ae22e8996..d58a3ef49e02 100644 --- a/BaseTools/Source/Python/Table/TablePcd.py +++ b/BaseTools/Source/Python/Table/TablePcd.py @@ -14,8 +14,9 @@ ## # Import Modules # +from __future__ import absolute_import import Common.EdkLogger as EdkLogger -from Table import Table +from .Table import Table from Common.StringUtils import ConvertToSqlString =20 ## TablePcd diff --git a/BaseTools/Source/Python/Table/TableQuery.py b/BaseTools/Source= /Python/Table/TableQuery.py index f377b10561dc..a991e610dafd 100644 --- a/BaseTools/Source/Python/Table/TableQuery.py +++ b/BaseTools/Source/Python/Table/TableQuery.py @@ -14,9 +14,10 @@ ## # Import Modules # +from __future__ import absolute_import import Common.EdkLogger as EdkLogger from Common.StringUtils import ConvertToSqlString -from Table import Table +from .Table import Table =20 ## TableQuery # diff --git a/BaseTools/Source/Python/Table/TableReport.py b/BaseTools/Sourc= e/Python/Table/TableReport.py index 1a039249ff26..c4a622953ece 100644 --- a/BaseTools/Source/Python/Table/TableReport.py +++ b/BaseTools/Source/Python/Table/TableReport.py @@ -14,9 +14,10 @@ ## # Import Modules # +from __future__ import absolute_import import Common.EdkLogger as EdkLogger import Common.LongFilePathOs as os, time -from Table import Table +from .Table import Table from Common.StringUtils import ConvertToSqlString2 import EccToolError as EccToolError import EccGlobalData as EccGlobalData --=20 2.18.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Apr 27 22:55:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1531193531860460.0173444320902; Mon, 9 Jul 2018 20:32:11 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 851B42096F35A; Mon, 9 Jul 2018 20:31:48 -0700 (PDT) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3C0582096F34B for ; Mon, 9 Jul 2018 20:31:47 -0700 (PDT) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Tue, 10 Jul 2018 05:31:43 +0200 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org From: Gary Lin To: edk2-devel@lists.01.org Date: Tue, 10 Jul 2018 11:31:05 +0800 Message-Id: <20180710033107.32359-13-glin@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710033107.32359-1-glin@suse.com> References: <20180710033107.32359-1-glin@suse.com> Subject: [edk2] [PATCH 12/14] BaseTools: Use absolute import in UPT X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Based on "futurize -f libfuturize.fixes.fix_absolute_import Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/Source/Python/UPT/Library/Parsing.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/UPT/Library/Parsing.py b/BaseTools/Sou= rce/Python/UPT/Library/Parsing.py index 5c4666399e29..81729d6cdbf7 100644 --- a/BaseTools/Source/Python/UPT/Library/Parsing.py +++ b/BaseTools/Source/Python/UPT/Library/Parsing.py @@ -16,6 +16,7 @@ ''' Parsing ''' +from __future__ import absolute_import =20 ## # Import Modules @@ -42,7 +43,7 @@ from Logger import StringTable as ST import Logger.Log as Logger =20 from Parser.DecParser import Dec -import GlobalData +from . import GlobalData =20 gPKG_INFO_DICT =3D {} =20 --=20 2.18.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Apr 27 22:55:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1531193536131539.5803198728169; Mon, 9 Jul 2018 20:32:16 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id ADF1E2096FAA0; Mon, 9 Jul 2018 20:31:50 -0700 (PDT) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2C24E2096F34B for ; Mon, 9 Jul 2018 20:31:49 -0700 (PDT) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Tue, 10 Jul 2018 05:31:45 +0200 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org From: Gary Lin To: edk2-devel@lists.01.org Date: Tue, 10 Jul 2018 11:31:06 +0800 Message-Id: <20180710033107.32359-14-glin@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710033107.32359-1-glin@suse.com> References: <20180710033107.32359-1-glin@suse.com> Subject: [edk2] [PATCH 13/14] BaseTools: Use absolute import in Workspace X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Based on "futurize -f libfuturize.fixes.fix_absolute_import Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/Source/Python/Workspace/DscBuildData.py | 9 +++++---- BaseTools/Source/Python/Workspace/InfBuildData.py | 3 ++- BaseTools/Source/Python/Workspace/MetaFileParser.py | 5 +++-- BaseTools/Source/Python/Workspace/MetaFileTable.py | 5 +++-- BaseTools/Source/Python/Workspace/WorkspaceCommon.py | 3 ++- BaseTools/Source/Python/Workspace/WorkspaceDatabase.py | 7 ++++--- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index 5cc814185eb9..65fc0882d8b4 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -18,6 +18,7 @@ # into PlatformBuildClassObject form for easier use for AutoGen. # from __future__ import print_function +from __future__ import absolute_import from Common.StringUtils import * from Common.DataType import * from Common.Misc import * @@ -26,11 +27,11 @@ from Common.Expression import * from CommonDataClass.CommonClass import SkuInfoClass from Common.TargetTxtClassObject import * from Common.ToolDefClassObject import * -from MetaDataTable import * -from MetaFileTable import * -from MetaFileParser import * +from .MetaDataTable import * +from .MetaFileTable import * +from .MetaFileParser import * =20 -from WorkspaceCommon import GetDeclaredPcd +from .WorkspaceCommon import GetDeclaredPcd from Common.Misc import AnalyzeDscPcd from Common.Misc import ProcessDuplicatedInf import re diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index 165e03f78964..f79ffe28d804 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -12,11 +12,12 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # =20 +from __future__ import absolute_import from Common.StringUtils import * from Common.DataType import * from Common.Misc import * from types import * -from MetaFileParser import * +from .MetaFileParser import * from collections import OrderedDict =20 from Workspace.BuildClassObject import ModuleBuildClassObject, LibraryClas= sObject, PcdClassObject diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTool= s/Source/Python/Workspace/MetaFileParser.py index 0aa72d8302a0..fbfc182c8bff 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -16,6 +16,7 @@ # Import Modules # from __future__ import print_function +from __future__ import absolute_import import Common.LongFilePathOs as os import re import time @@ -33,8 +34,8 @@ from Common.Expression import * from CommonDataClass.Exceptions import * from Common.LongFilePathSupport import OpenLongFilePath as open from collections import defaultdict -from MetaFileTable import MetaFileStorage -from MetaFileCommentParser import CheckInfComment +from .MetaFileTable import MetaFileStorage +from .MetaFileCommentParser import CheckInfComment =20 ## RegEx for finding file versions hexVersionPattern =3D re.compile(r'0[xX][\da-f-A-F]{5,8}') diff --git a/BaseTools/Source/Python/Workspace/MetaFileTable.py b/BaseTools= /Source/Python/Workspace/MetaFileTable.py index ee1c7fffca3b..e0a0b8d92351 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileTable.py +++ b/BaseTools/Source/Python/Workspace/MetaFileTable.py @@ -14,13 +14,14 @@ ## # Import Modules # +from __future__ import absolute_import import uuid =20 import Common.EdkLogger as EdkLogger from Common.BuildToolError import FORMAT_INVALID =20 -from MetaDataTable import Table, TableFile -from MetaDataTable import ConvertToSqlString +from .MetaDataTable import Table, TableFile +from .MetaDataTable import ConvertToSqlString from CommonDataClass.DataClass import MODEL_FILE_DSC, MODEL_FILE_DEC, MODE= L_FILE_INF, \ MODEL_FILE_OTHERS from Common.DataType import * diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseToo= ls/Source/Python/Workspace/WorkspaceCommon.py index e8f159b26204..d987bbf441ea 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py @@ -11,9 +11,10 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # =20 +from __future__ import absolute_import from collections import OrderedDict, defaultdict from Common.DataType import SUP_MODULE_USER_DEFINED -from BuildClassObject import LibraryClassObject +from .BuildClassObject import LibraryClassObject import Common.GlobalData as GlobalData from Workspace.BuildClassObject import StructurePcd from Common.BuildToolError import RESOURCE_NOT_AVAILABLE diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseT= ools/Source/Python/Workspace/WorkspaceDatabase.py index a40ab8fc8c88..e2f373745fc0 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py @@ -15,15 +15,16 @@ ## # Import Modules # +from __future__ import absolute_import import sqlite3 from Common.StringUtils import * from Common.DataType import * from Common.Misc import * from types import * =20 -from MetaDataTable import * -from MetaFileTable import * -from MetaFileParser import * +from .MetaDataTable import * +from .MetaFileTable import * +from .MetaFileParser import * =20 from Workspace.DecBuildData import DecBuildData from Workspace.DscBuildData import DscBuildData --=20 2.18.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Apr 27 22:55:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 153119354078513.49181517249815; Mon, 9 Jul 2018 20:32:20 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D7F332096FAAC; Mon, 9 Jul 2018 20:31:52 -0700 (PDT) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 219052096F34B for ; Mon, 9 Jul 2018 20:31:50 -0700 (PDT) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Tue, 10 Jul 2018 05:31:47 +0200 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org From: Gary Lin To: edk2-devel@lists.01.org Date: Tue, 10 Jul 2018 11:31:07 +0800 Message-Id: <20180710033107.32359-15-glin@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710033107.32359-1-glin@suse.com> References: <20180710033107.32359-1-glin@suse.com> Subject: [edk2] [PATCH 14/14] BaseTools: Use absolute import in Scripts X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Based on "futurize -f libfuturize.fixes.fix_absolute_import Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/doxyge= n.py | 3 ++- BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py= | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/base= model/doxygen.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugin= s/basemodel/doxygen.py index b5ab213cd7f0..d1e21135cf05 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/d= oxygen.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/d= oxygen.py @@ -12,9 +12,10 @@ # =20 from __future__ import print_function +from __future__ import absolute_import import os =20 -from message import * +from .message import * =20 class BaseDoxygeItem: def __init__(self, name, tag=3D''): diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/base= model/ini.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/ba= semodel/ini.py index ccfef6b6e280..6e6f3f4b9795 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/i= ni.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/i= ni.py @@ -11,7 +11,8 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # =20 -from message import * +from __future__ import absolute_import +from .message import * import re import os =20 --=20 2.18.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel