public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Gary Lin <glin@suse.com>
To: edk2-devel@lists.01.org
Cc: Yonghong Zhu <yonghong.zhu@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [PATCH v2 11/16] BaseTools: Use absolute import in Ecc
Date: Fri, 13 Jul 2018 18:18:42 +0800	[thread overview]
Message-ID: <20180713101847.7485-12-glin@suse.com> (raw)
In-Reply-To: <20180713101847.7485-1-glin@suse.com>

Based on "futurize -f libfuturize.fixes.fix_absolute_import

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
---
 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/Python/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
 
 from __future__ import print_function
+from __future__ import absolute_import
 from antlr3 import *
 from antlr3.compat import set, frozenset
 
@@ -23,8 +24,8 @@ from antlr3.compat import set, frozenset
 #
 ##
 
-import CodeFragment
-import FileProfile
+from . import CodeFragment
+from . import FileProfile
 
 
 
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 IMPLIED.
 #
+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
 
diff --git a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py b/BaseTools/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 @@
 #
 
 from __future__ import print_function
+from __future__ import absolute_import
 import re
 import Common.LongFilePathOs as os
 import sys
 
 import antlr3
-from CLexer import CLexer
-from CParser import CParser
+from .CLexer import CLexer
+from .CParser import CParser
 
-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
 
 
 ##define T_CHAR_SPACE                ' '
diff --git a/BaseTools/Source/Python/Ecc/Database.py b/BaseTools/Source/Python/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
 
@@ -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
 
 ##
diff --git a/BaseTools/Source/Python/Ecc/Ecc.py b/BaseTools/Source/Python/Ecc/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
 
 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
 
diff --git a/BaseTools/Source/Python/Ecc/Exception.py b/BaseTools/Source/Python/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
 
 # 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
 #
 
+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
 
 CommentList = []
@@ -54,5 +55,3 @@ class FileProfile :
 
         except IOError:
             raise Warning("Error when opening file %s" % FileName)
-
-
diff --git a/BaseTools/Source/Python/Ecc/MetaDataParser.py b/BaseTools/Source/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 IMPLIED.
 #
 
+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.py 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 *
 
-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
 
 import Common.EdkLogger as EdkLogger
 import EccGlobalData
 
-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, MODEL_FILE_INF, \
                                       MODEL_FILE_OTHERS
 
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 @@
 #
 
 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
 
 IncludeFileListDict = {}
 AllIncludeFileListDict = {}
-- 
2.18.0



  parent reply	other threads:[~2018-07-13 10:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-13 10:18 [PATCH v2 00/16] BaseTools: Adopt absolute import Gary Lin
2018-07-13 10:18 ` [PATCH v2 01/16] BaseTools: Treat GenFds.py as a python module Gary Lin
2018-07-13 10:18 ` [PATCH v2 02/16] BaseTools: Use absolute import in GenFds Gary Lin
2018-07-13 10:18 ` [PATCH v2 03/16] BaseTools: Move OverrideAttribs to OptRomInfStatement.py Gary Lin
2018-07-13 10:18 ` [PATCH v2 04/16] BaseTools: Move FindExtendTool to GenFdsGlobalVariable.py Gary Lin
2018-07-13 10:18 ` [PATCH v2 05/16] BaseTools: Move ImageBinDict " Gary Lin
2018-07-13 10:18 ` [PATCH v2 06/16] BaseTools: Use absolute import in AutoGen Gary Lin
2018-07-13 10:18 ` [PATCH v2 07/16] BaseTools: Treat BPDG.py as a python module Gary Lin
2018-07-13 10:18 ` [PATCH v2 08/16] BaseTools: Use absolute import in BPDG Gary Lin
2018-07-13 10:18 ` [PATCH v2 09/16] BaseTools: Use absolute import in Common Gary Lin
2018-07-13 10:18 ` [PATCH v2 10/16] BaseTools: Treat Ecc.py as a python module Gary Lin
2018-07-13 10:18 ` Gary Lin [this message]
2018-07-13 10:18 ` [PATCH v2 12/16] BaseTools: Use absolute import in Eot Gary Lin
2018-07-13 10:18 ` [PATCH v2 13/16] BaseTools: Use absolute import in Table Gary Lin
2018-07-13 10:18 ` [PATCH v2 14/16] BaseTools: Use absolute import in UPT Gary Lin
2018-07-13 10:18 ` [PATCH v2 15/16] BaseTools: Use absolute import in Workspace Gary Lin
2018-07-13 10:18 ` [PATCH v2 16/16] BaseTools: Use absolute import in Scripts Gary Lin
2018-07-13 15:07 ` [PATCH v2 00/16] BaseTools: Adopt absolute import Carsey, Jaben

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180713101847.7485-12-glin@suse.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox