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 06/14] BaseTools: Use absolute import in AutoGen
Date: Tue, 10 Jul 2018 11:30:59 +0800	[thread overview]
Message-ID: <20180710033107.32359-7-glin@suse.com> (raw)
In-Reply-To: <20180710033107.32359-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/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
 
-import GenC
-import GenMake
-import GenDepex
+from . import GenC
+from . import GenMake
+from . import GenDepex
 from io import BytesIO
 
-from StrGather import *
-from BuildEngine import BuildRule
+from .StrGather import *
+from .BuildEngine import BuildRule
 
 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/Python/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 @@
 
 ## 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 *
 
 ## PCD type string
 gItemTypeStringDatabase  = {
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 @@
 
 ## 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
 
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 IMPLIED.
 #
+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
 
 IMAGE_TOKEN = re.compile('IMAGE_TOKEN *\(([A-Z0-9_]+) *\)', re.MULTILINE | re.UNICODE)
 
diff --git a/BaseTools/Source/Python/AutoGen/StrGather.py b/BaseTools/Source/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
-- 
2.18.0



  parent reply	other threads:[~2018-07-10  3:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-10  3:30 [PATCH 00/14] BaseTools: Adopt absolute import Gary Lin
2018-07-10  3:30 ` [PATCH 01/14] BaseTools: Treat GenFds.py as a python module Gary Lin
2018-07-10  3:30 ` [PATCH 02/14] BaseTools: Use absolute import in GenFds Gary Lin
2018-07-10  3:30 ` [PATCH 03/14] BaseTools: Move OverrideAttribs to OptRomInfStatement.py Gary Lin
2018-07-10  3:30 ` [PATCH 04/14] BaseTools: Move FindExtendTool to GenFdsGlobalVariable.py Gary Lin
2018-07-10  3:30 ` [PATCH 05/14] BaseTools: Move ImageBinDict " Gary Lin
2018-07-10  3:30 ` Gary Lin [this message]
2018-07-10  3:31 ` [PATCH 07/14] BaseTools: Use absolute import in BPDG Gary Lin
2018-07-12  0:52   ` Zhu, Yonghong
2018-07-12  4:23     ` Gary Lin
2018-07-10  3:31 ` [PATCH 08/14] BaseTools: Use absolute import in Common Gary Lin
2018-07-10  3:31 ` [PATCH 09/14] BaseTools: Use absolute import in ECC Gary Lin
2018-07-10  3:31 ` [PATCH 10/14] BaseTools: Use absolute import in Eot Gary Lin
2018-07-10  3:31 ` [PATCH 11/14] BaseTools: Use absolute import in Table Gary Lin
2018-07-10  3:31 ` [PATCH 12/14] BaseTools: Use absolute import in UPT Gary Lin
2018-07-10  3:31 ` [PATCH 13/14] BaseTools: Use absolute import in Workspace Gary Lin
2018-07-10  3:31 ` [PATCH 14/14] BaseTools: Use absolute import in Scripts Gary Lin

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=20180710033107.32359-7-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