summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Ecc/Check.py
diff options
context:
space:
mode:
authorFeng, Bob C <bob.c.feng@intel.com>2019-01-04 17:35:10 +0800
committerFeng, Bob C <bob.c.feng@intel.com>2019-02-01 11:09:25 +0800
commitc60377d7f9ec80ecc7fe76c38b81ffd98b7ef2e4 (patch)
treeca1900169f93b4b97d9d833fe8975ca4a467f00d /BaseTools/Source/Python/Ecc/Check.py
parentd943b0c339fe3d35ffdf9f580ccb7a55915c6854 (diff)
downloadedk2-c60377d7f9ec80ecc7fe76c38b81ffd98b7ef2e4.tar.gz
edk2-c60377d7f9ec80ecc7fe76c38b81ffd98b7ef2e4.tar.bz2
edk2-c60377d7f9ec80ecc7fe76c38b81ffd98b7ef2e4.zip
BaseTools: ECC tool Python3 adaption
v2: The python files under CParser4 are generated by antlr4 and for python3 usage. They have python3 specific syntax, for example the data type declaration for the arguments of a function. That is not compitable with python2. this patch is to remove these syntax. ECC tool Python3 adaption. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Ecc/Check.py')
-rw-r--r--BaseTools/Source/Python/Ecc/Check.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index dfcc0302bc..a6c62359d0 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -223,7 +223,7 @@ class Check(object):
IndexOfLine = 0
for Line in op:
IndexOfLine += 1
- if not Line.endswith('\r\n'):
+ if not bytes.decode(Line).endswith('\r\n'):
OtherMsg = "File %s has invalid line ending at line %s" % (Record[1], IndexOfLine)
EccGlobalData.gDb.TblReport.Insert(ERROR_GENERAL_CHECK_INVALID_LINE_ENDING, OtherMsg=OtherMsg, BelongsToTable='File', BelongsToItem=Record[0])
@@ -235,7 +235,7 @@ class Check(object):
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet:
if Record[2].upper() not in EccGlobalData.gConfig.BinaryExtList:
- op = open(Record[1], 'rb').readlines()
+ op = open(Record[1], 'r').readlines()
IndexOfLine = 0
for Line in op:
IndexOfLine += 1