From nobody Tue Feb 10 03:43:20 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 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