From nobody Sun Feb 8 02:41:28 2026 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 1531477188969853.5112674848261; Fri, 13 Jul 2018 03:19:48 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5146D20988470; Fri, 13 Jul 2018 03:19:27 -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 B084220988470 for ; Fri, 13 Jul 2018 03:19:25 -0700 (PDT) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Fri, 13 Jul 2018 12:19: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: Fri, 13 Jul 2018 18:18:40 +0800 Message-Id: <20180713101847.7485-10-glin@suse.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180713101847.7485-1-glin@suse.com> References: <20180713101847.7485-1-glin@suse.com> Subject: [edk2] [PATCH v2 09/16] 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