summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Ecc
diff options
context:
space:
mode:
authorGary Lin <glin@suse.com>2018-07-13 18:18:42 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-07-16 11:22:17 +0800
commitb6f6b636b038e780c87892b17835bb6d043523b8 (patch)
treee261db2eb2e5b7bd093e13c07b439595cee8e1bd /BaseTools/Source/Python/Ecc
parente52b39ab8e9911dacb2c83a87bfe483397f1ea5f (diff)
downloadedk2-b6f6b636b038e780c87892b17835bb6d043523b8.tar.gz
edk2-b6f6b636b038e780c87892b17835bb6d043523b8.tar.bz2
edk2-b6f6b636b038e780c87892b17835bb6d043523b8.zip
BaseTools: Use absolute import in Ecc
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> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Ecc')
-rw-r--r--BaseTools/Source/Python/Ecc/CParser.py5
-rw-r--r--BaseTools/Source/Python/Ecc/Check.py9
-rw-r--r--BaseTools/Source/Python/Ecc/CodeFragmentCollector.py13
-rw-r--r--BaseTools/Source/Python/Ecc/Database.py7
-rw-r--r--BaseTools/Source/Python/Ecc/Ecc.py25
-rw-r--r--BaseTools/Source/Python/Ecc/Exception.py3
-rw-r--r--BaseTools/Source/Python/Ecc/FileProfile.py5
-rw-r--r--BaseTools/Source/Python/Ecc/MetaDataParser.py5
-rw-r--r--BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py3
-rw-r--r--BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py5
-rw-r--r--BaseTools/Source/Python/Ecc/c.py13
11 files changed, 51 insertions, 42 deletions
diff --git a/BaseTools/Source/Python/Ecc/CParser.py b/BaseTools/Source/Python/Ecc/CParser.py
index b66ac2d8d5..0b74b53ae7 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 540d9cb7ed..0b81013d77 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 b4f421342f..28b4e0196f 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 2041175124..34f49f3cba 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 ccd563a466..8f96bdf977 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 0498a503d7..340e0e9752 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 a071fd020e..1d3fbf2d3b 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 6060d67581..e5744dd5cc 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 111a25ed92..51669815b5 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 ad3cf36a1c..7e0afd5d70 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 12dbf664ba..5616c10853 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 = {}