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 12/16] BaseTools: Use absolute import in Eot
Date: Fri, 13 Jul 2018 18:18:43 +0800	[thread overview]
Message-ID: <20180713101847.7485-13-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/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/Python/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
 
 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/Eot/CodeFragmentCollector.py b/BaseTools/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
 
 import antlr3
-from CLexer import CLexer
-from CParser import CParser
+from .CLexer import CLexer
+from .CParser import CParser
 
-import FileProfile
-from CodeFragment import PP_Directive
-from ParserWarning import Warning
+from . import FileProfile
+from .CodeFragment import PP_Directive
+from .ParserWarning import Warning
 
 
 ##define T_CHAR_SPACE                ' '
diff --git a/BaseTools/Source/Python/Eot/Eot.py b/BaseTools/Source/Python/Eot/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):
 
     def _GetSections(m):
         try:
-            import EfiCompressor
+            from . import EfiCompressor
             TmpData = EfiCompressor.FrameworkDecompress(
                                         m[m._HEADER_SIZE_:],
                                         len(m) - m._HEADER_SIZE_
@@ -161,7 +162,7 @@ class CompressedImage(Image):
             DecData = array('B')
             DecData.fromstring(TmpData)
         except:
-            import EfiCompressor
+            from . import EfiCompressor
             TmpData = EfiCompressor.UefiDecompress(
                                         m[m._HEADER_SIZE_:],
                                         len(m) - m._HEADER_SIZE_
@@ -748,7 +749,7 @@ class GuidDefinedImage(Image):
                 SectionList.append(Sec)
         elif Guid == m.TIANO_COMPRESS_GUID:
             try:
-                import EfiCompressor
+                from . import EfiCompressor
                 # skip the header
                 Offset = m.DataOffset - 4
                 TmpData = EfiCompressor.FrameworkDecompress(m[Offset:], len(m)-Offset)
@@ -769,7 +770,7 @@ class GuidDefinedImage(Image):
                 pass
         elif Guid == m.LZMA_COMPRESS_GUID:
             try:
-                import LzmaCompressor
+                from . import LzmaCompressor
                 # skip the header
                 Offset = m.DataOffset - 4
                 TmpData = 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
 #
 
+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
 
 # Profile contents of a file
diff --git a/BaseTools/Source/Python/Eot/InfParserLite.py b/BaseTools/Source/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
 
 ## EdkInfParser() class
 #
diff --git a/BaseTools/Source/Python/Eot/Parser.py b/BaseTools/Source/Python/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
 
diff --git a/BaseTools/Source/Python/Eot/Report.py b/BaseTools/Source/Python/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
 
 ## 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
 
 # Global Dicts
 IncludeFileListDict = {}
-- 
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 ` [PATCH v2 11/16] BaseTools: Use absolute import in Ecc Gary Lin
2018-07-13 10:18 ` Gary Lin [this message]
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-13-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