diff options
author | hchen30 <hesheng.chen@intel.com> | 2018-08-08 11:18:06 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-08-16 09:42:55 +0800 |
commit | 855698fb69fdb85fa24c4374d07947106f4de828 (patch) | |
tree | 290571416f9c262c1fd967ac7a93eec5be6c84eb | |
parent | af24640290a79e974710629db91fb39512d0b54b (diff) | |
download | edk2-855698fb69fdb85fa24c4374d07947106f4de828.zip edk2-855698fb69fdb85fa24c4374d07947106f4de828.tar.gz edk2-855698fb69fdb85fa24c4374d07947106f4de828.tar.bz2 |
BaseTools/Ecc: Fix import issues
1. Complete the full path for import statement. Use "EccMain" to
replace "Ecc" for the absolute path support.
2. Fix some issues on configuration file.
3. Fix an issue of RaiseError not working in EdkLogger.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
28 files changed, 65 insertions, 62 deletions
diff --git a/BaseTools/BinWrappers/PosixLike/Ecc b/BaseTools/BinWrappers/PosixLike/Ecc index bca1bae..1142964 100755 --- a/BaseTools/BinWrappers/PosixLike/Ecc +++ b/BaseTools/BinWrappers/PosixLike/Ecc @@ -11,4 +11,4 @@ dir=$(dirname "$full_cmd") cmd=${full_cmd##*/} export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" -m $cmd.$cmd "$@"
+exec "${python_exe:-python}" -m $cmd.EccMain "$@" diff --git a/BaseTools/BinWrappers/WindowsLike/Ecc.bat b/BaseTools/BinWrappers/WindowsLike/Ecc.bat index 98095cf..8705e75 100644 --- a/BaseTools/BinWrappers/WindowsLike/Ecc.bat +++ b/BaseTools/BinWrappers/WindowsLike/Ecc.bat @@ -1,4 +1,4 @@ @setlocal
@set ToolName=%~n0%
@set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python
-@%PYTHON_HOME%\python.exe -m %ToolName%.%ToolName% %*
+@%PYTHON_HOME%\python.exe -m %ToolName%.EccMain %*
diff --git a/BaseTools/Source/Python/Common/EdkLogger.py b/BaseTools/Source/Python/Common/EdkLogger.py index 1974906..80697bf 100644 --- a/BaseTools/Source/Python/Common/EdkLogger.py +++ b/BaseTools/Source/Python/Common/EdkLogger.py @@ -1,7 +1,7 @@ ## @file
# This file implements the log mechanism for Python tools.
#
-# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -198,6 +198,7 @@ def error(ToolName, ErrorCode, Message=None, File=None, Line=None, ExtraData=Non LogText = _ErrorMessageTemplateWithoutFile % TemplateDict
_ErrorLogger.log(ERROR, LogText)
+ RaiseError = IsRaiseError
if RaiseError:
raise FatalError(ErrorCode)
diff --git a/BaseTools/Source/Python/Ecc/CParser.py b/BaseTools/Source/Python/Ecc/CParser.py index 0b74b53..a3ab8e7 100644 --- a/BaseTools/Source/Python/Ecc/CParser.py +++ b/BaseTools/Source/Python/Ecc/CParser.py @@ -24,8 +24,8 @@ from antlr3.compat import set, frozenset #
##
-from . import CodeFragment
-from . import FileProfile
+from Ecc import CodeFragment
+from Ecc import FileProfile
diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py index 6803afd..fc86ad9 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -15,10 +15,10 @@ import Common.LongFilePathOs as os import re
from CommonDataClass.DataClass import *
import Common.DataType as DT
-from .EccToolError import *
-from .MetaDataParser import ParseHeaderCommentSection
-from . import EccGlobalData
-from . import c
+from Ecc.EccToolError import *
+from Ecc.MetaDataParser import ParseHeaderCommentSection
+from Ecc import EccGlobalData
+from Ecc 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 28b4e01..d12232c 100644 --- a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py +++ b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py @@ -23,13 +23,13 @@ import Common.LongFilePathOs as os import sys
import antlr3
-from .CLexer import CLexer
-from .CParser import CParser
+from Ecc.CLexer import CLexer
+from Ecc.CParser import CParser
-from . import FileProfile
-from .CodeFragment import Comment
-from .CodeFragment import PP_Directive
-from .ParserWarning import Warning
+from Ecc import FileProfile
+from Ecc.CodeFragment import Comment
+from Ecc.CodeFragment import PP_Directive
+from Ecc.ParserWarning import Warning
##define T_CHAR_SPACE ' '
diff --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Source/Python/Ecc/Configuration.py index f58adbf..c19a399 100644 --- a/BaseTools/Source/Python/Ecc/Configuration.py +++ b/BaseTools/Source/Python/Ecc/Configuration.py @@ -60,12 +60,14 @@ _ConfigFileToInternalTranslation = { "GeneralCheckIndentation":"GeneralCheckIndentation",
"GeneralCheckIndentationWidth":"GeneralCheckIndentationWidth",
"GeneralCheckLine":"GeneralCheckLine",
+ "GeneralCheckLineEnding":"GeneralCheckLineEnding",
"GeneralCheckLineWidth":"GeneralCheckLineWidth",
"GeneralCheckNoProgma":"GeneralCheckNoProgma",
"GeneralCheckNoTab":"GeneralCheckNoTab",
"GeneralCheckNo_Asm":"GeneralCheckNo_Asm",
"GeneralCheckNonAcsii":"GeneralCheckNonAcsii",
"GeneralCheckTabWidth":"GeneralCheckTabWidth",
+ "GeneralCheckTrailingWhiteSpaceLine":"GeneralCheckTrailingWhiteSpaceLine",
"GeneralCheckUni":"GeneralCheckUni",
"HeaderCheckAll":"HeaderCheckAll",
"HeaderCheckCFileCommentLicenseFormat":"HeaderCheckCFileCommentLicenseFormat",
diff --git a/BaseTools/Source/Python/Ecc/Database.py b/BaseTools/Source/Python/Ecc/Database.py index 34f49f3..9d4acac 100644 --- a/BaseTools/Source/Python/Ecc/Database.py +++ b/BaseTools/Source/Python/Ecc/Database.py @@ -27,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 Ecc.MetaFileWorkspace.MetaFileTable import ModuleTable
+from Ecc.MetaFileWorkspace.MetaFileTable import PackageTable
+from Ecc.MetaFileWorkspace.MetaFileTable import PlatformTable
from Table.TableFdf import TableFdf
##
diff --git a/BaseTools/Source/Python/Ecc/Ecc.py b/BaseTools/Source/Python/Ecc/EccMain.py index 8f96bdf..5f9e497 100644 --- a/BaseTools/Source/Python/Ecc/Ecc.py +++ b/BaseTools/Source/Python/Ecc/EccMain.py @@ -17,12 +17,12 @@ from __future__ import absolute_import
import Common.LongFilePathOs as os, time, glob, sys
import Common.EdkLogger as EdkLogger
-from . import Database
-from . import EccGlobalData
-from .MetaDataParser import *
+from Ecc import Database
+from Ecc import EccGlobalData
+from Ecc.MetaDataParser import *
from optparse import OptionParser
-from .Configuration import Configuration
-from .Check import Check
+from Ecc.Configuration import Configuration
+from Ecc.Check import Check
import Common.GlobalData as GlobalData
from Common.StringUtils import NormPath
@@ -30,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
-from . import c
+from Ecc.MetaFileWorkspace.MetaFileParser import DscParser
+from Ecc.MetaFileWorkspace.MetaFileParser import DecParser
+from Ecc.MetaFileWorkspace.MetaFileParser import InfParser
+from Ecc.MetaFileWorkspace.MetaFileParser import Fdf
+from Ecc.MetaFileWorkspace.MetaFileTable import MetaFileStorage
+from Ecc import c
import re, string
-from .Exception import *
+from Ecc.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 340e0e9..8b827d7 100644 --- a/BaseTools/Source/Python/Ecc/Exception.py +++ b/BaseTools/Source/Python/Ecc/Exception.py @@ -16,7 +16,7 @@ #
from __future__ import print_function
from __future__ import absolute_import
-from .Xml.XmlRoutines import *
+from Ecc.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 1d3fbf2..4434981 100644 --- a/BaseTools/Source/Python/Ecc/FileProfile.py +++ b/BaseTools/Source/Python/Ecc/FileProfile.py @@ -19,7 +19,7 @@ from __future__ import absolute_import
import re
import Common.LongFilePathOs as os
-from .ParserWarning import Warning
+from Ecc.ParserWarning import Warning
from Common.LongFilePathSupport import OpenLongFilePath as open
CommentList = []
diff --git a/BaseTools/Source/Python/Ecc/MetaDataParser.py b/BaseTools/Source/Python/Ecc/MetaDataParser.py index e5744dd..d0a9415 100644 --- a/BaseTools/Source/Python/Ecc/MetaDataParser.py +++ b/BaseTools/Source/Python/Ecc/MetaDataParser.py @@ -14,9 +14,9 @@ from __future__ import absolute_import
import Common.LongFilePathOs as os
from CommonDataClass.DataClass import *
-from .EccToolError import *
+from Ecc.EccToolError import *
from Common.MultipleWorkspace import MultipleWorkspace as mws
-from . import EccGlobalData
+from Ecc 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 5166981..a2cd30d 100644 --- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py @@ -22,8 +22,8 @@ import copy import Common.EdkLogger as EdkLogger
import Common.GlobalData as GlobalData
-import EccGlobalData
-import EccToolError
+import Ecc.EccGlobalData as EccGlobalData
+import Ecc.EccToolError as EccToolError
from CommonDataClass.DataClass import *
from Common.DataType import *
@@ -32,7 +32,7 @@ from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, PathClas from Common.Expression import *
from CommonDataClass.Exceptions import *
-from .MetaFileTable import MetaFileStorage
+from Ecc.MetaFileWorkspace.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 7e0afd5..a2319a9 100644 --- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py +++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py @@ -18,10 +18,10 @@ from __future__ import absolute_import import uuid
import Common.EdkLogger as EdkLogger
-import EccGlobalData
+import Ecc.EccGlobalData as EccGlobalData
-from .MetaDataTable import Table
-from .MetaDataTable import ConvertToSqlString
+from Ecc.MetaFileWorkspace.MetaDataTable import Table
+from Ecc.MetaFileWorkspace.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 5616c10..953f163 100644 --- a/BaseTools/Source/Python/Ecc/c.py +++ b/BaseTools/Source/Python/Ecc/c.py @@ -17,14 +17,14 @@ import sys import Common.LongFilePathOs as os
import re
import string
-from . import CodeFragmentCollector
-from . import FileProfile
+from Ecc import CodeFragmentCollector
+from Ecc import FileProfile
from CommonDataClass import DataClass
-from . import Database
+from Ecc import Database
from Common import EdkLogger
-from .EccToolError import *
-from . import EccGlobalData
-from . import MetaDataParser
+from Ecc.EccToolError import *
+from Ecc import EccGlobalData
+from Ecc import MetaDataParser
IncludeFileListDict = {}
AllIncludeFileListDict = {}
diff --git a/BaseTools/Source/Python/Ecc/config.ini b/BaseTools/Source/Python/Ecc/config.ini index 6c86da7..00c98c6 100644 --- a/BaseTools/Source/Python/Ecc/config.ini +++ b/BaseTools/Source/Python/Ecc/config.ini @@ -73,9 +73,9 @@ GeneralCheckNonAcsii = 1 # Check whether UNI file is valid
GeneralCheckUni = 1
# Check Only use CRLF (Carriage Return Line Feed) line endings.
-self.GeneralCheckLineEnding = 1
+GeneralCheckLineEnding = 1
# Check if there is no trailing white space in one line.
-self.GeneralCheckTrailingWhiteSpaceLine = 1
+GeneralCheckTrailingWhiteSpaceLine = 1
#
# Space Checking
diff --git a/BaseTools/Source/Python/Table/TableDataModel.py b/BaseTools/Source/Python/Table/TableDataModel.py index ea0996f..b01c3ec 100644 --- a/BaseTools/Source/Python/Table/TableDataModel.py +++ b/BaseTools/Source/Python/Table/TableDataModel.py @@ -17,7 +17,7 @@ from __future__ import absolute_import
import Common.EdkLogger as EdkLogger
import CommonDataClass.DataClass as DataClass
-from .Table import Table
+from Table.Table import Table
from Common.StringUtils import ConvertToSqlString
## TableDataModel
diff --git a/BaseTools/Source/Python/Table/TableDec.py b/BaseTools/Source/Python/Table/TableDec.py index bbae3e8..1d887dc 100644 --- a/BaseTools/Source/Python/Table/TableDec.py +++ b/BaseTools/Source/Python/Table/TableDec.py @@ -17,7 +17,7 @@ from __future__ import absolute_import
import Common.EdkLogger as EdkLogger
import CommonDataClass.DataClass as DataClass
-from .Table import Table
+from Table.Table import Table
from Common.StringUtils import ConvertToSqlString
## TableDec
diff --git a/BaseTools/Source/Python/Table/TableDsc.py b/BaseTools/Source/Python/Table/TableDsc.py index 6436973..0a45f7f 100644 --- a/BaseTools/Source/Python/Table/TableDsc.py +++ b/BaseTools/Source/Python/Table/TableDsc.py @@ -17,7 +17,7 @@ from __future__ import absolute_import #
import Common.EdkLogger as EdkLogger
import CommonDataClass.DataClass as DataClass
-from .Table import Table
+from Table.Table import Table
from Common.StringUtils import ConvertToSqlString
## TableDsc
diff --git a/BaseTools/Source/Python/Table/TableEotReport.py b/BaseTools/Source/Python/Table/TableEotReport.py index 0a49016..6f2fb37 100644 --- a/BaseTools/Source/Python/Table/TableEotReport.py +++ b/BaseTools/Source/Python/Table/TableEotReport.py @@ -17,7 +17,7 @@ from __future__ import absolute_import
import Common.EdkLogger as EdkLogger
import Common.LongFilePathOs as os, time
-from .Table import Table
+from Table.Table import Table
from Common.StringUtils import ConvertToSqlString2
import Eot.EotToolError as EotToolError
import Eot.EotGlobalData as EotGlobalData
diff --git a/BaseTools/Source/Python/Table/TableFdf.py b/BaseTools/Source/Python/Table/TableFdf.py index 80be953..668f562 100644 --- a/BaseTools/Source/Python/Table/TableFdf.py +++ b/BaseTools/Source/Python/Table/TableFdf.py @@ -17,7 +17,7 @@ from __future__ import absolute_import
import Common.EdkLogger as EdkLogger
import CommonDataClass.DataClass as DataClass
-from .Table import Table
+from Table.Table import Table
from Common.StringUtils import ConvertToSqlString
## TableFdf
diff --git a/BaseTools/Source/Python/Table/TableFile.py b/BaseTools/Source/Python/Table/TableFile.py index 689264c..805a528 100644 --- a/BaseTools/Source/Python/Table/TableFile.py +++ b/BaseTools/Source/Python/Table/TableFile.py @@ -16,7 +16,7 @@ #
from __future__ import absolute_import
import Common.EdkLogger as EdkLogger
-from .Table import Table
+from Table.Table import Table
from Common.StringUtils import ConvertToSqlString
import Common.LongFilePathOs as os
from CommonDataClass.DataClass import FileClass
diff --git a/BaseTools/Source/Python/Table/TableFunction.py b/BaseTools/Source/Python/Table/TableFunction.py index 1667180..ee677cf 100644 --- a/BaseTools/Source/Python/Table/TableFunction.py +++ b/BaseTools/Source/Python/Table/TableFunction.py @@ -16,7 +16,7 @@ #
from __future__ import absolute_import
import Common.EdkLogger as EdkLogger
-from .Table import Table
+from Table.Table import Table
from Common.StringUtils import ConvertToSqlString
## TableFunction
diff --git a/BaseTools/Source/Python/Table/TableIdentifier.py b/BaseTools/Source/Python/Table/TableIdentifier.py index 8b4dd1d..6b658cf 100644 --- a/BaseTools/Source/Python/Table/TableIdentifier.py +++ b/BaseTools/Source/Python/Table/TableIdentifier.py @@ -17,7 +17,7 @@ from __future__ import absolute_import
import Common.EdkLogger as EdkLogger
from Common.StringUtils import ConvertToSqlString
-from .Table import Table
+from Table.Table import Table
## TableIdentifier
#
diff --git a/BaseTools/Source/Python/Table/TableInf.py b/BaseTools/Source/Python/Table/TableInf.py index a00096a..e0ffb17 100644 --- a/BaseTools/Source/Python/Table/TableInf.py +++ b/BaseTools/Source/Python/Table/TableInf.py @@ -17,7 +17,7 @@ from __future__ import absolute_import
import Common.EdkLogger as EdkLogger
import CommonDataClass.DataClass as DataClass
-from .Table import Table
+from Table.Table import Table
from Common.StringUtils import ConvertToSqlString
## TableInf
diff --git a/BaseTools/Source/Python/Table/TablePcd.py b/BaseTools/Source/Python/Table/TablePcd.py index d58a3ef..5096862 100644 --- a/BaseTools/Source/Python/Table/TablePcd.py +++ b/BaseTools/Source/Python/Table/TablePcd.py @@ -16,7 +16,7 @@ #
from __future__ import absolute_import
import Common.EdkLogger as EdkLogger
-from .Table import Table
+from Table.Table import Table
from Common.StringUtils import ConvertToSqlString
## TablePcd
diff --git a/BaseTools/Source/Python/Table/TableQuery.py b/BaseTools/Source/Python/Table/TableQuery.py index a991e61..8e7d313 100644 --- a/BaseTools/Source/Python/Table/TableQuery.py +++ b/BaseTools/Source/Python/Table/TableQuery.py @@ -17,7 +17,7 @@ from __future__ import absolute_import
import Common.EdkLogger as EdkLogger
from Common.StringUtils import ConvertToSqlString
-from .Table import Table
+from Table.Table import Table
## TableQuery
#
diff --git a/BaseTools/Source/Python/Table/TableReport.py b/BaseTools/Source/Python/Table/TableReport.py index c4a6229..0002296 100644 --- a/BaseTools/Source/Python/Table/TableReport.py +++ b/BaseTools/Source/Python/Table/TableReport.py @@ -17,10 +17,10 @@ from __future__ import absolute_import
import Common.EdkLogger as EdkLogger
import Common.LongFilePathOs as os, time
-from .Table import Table
+from Table.Table import Table
from Common.StringUtils import ConvertToSqlString2
-import EccToolError as EccToolError
-import EccGlobalData as EccGlobalData
+import Ecc.EccToolError as EccToolError
+import Ecc.EccGlobalData as EccGlobalData
from Common.LongFilePathSupport import OpenLongFilePath as open
## TableReport
|