diff options
author | Marty E. Plummer <hanetzer@startmail.com> | 2019-05-10 01:38:11 -0500 |
---|---|---|
committer | RAJA DAS <rajadas2@in.ibm.com> | 2020-01-09 23:09:28 -0600 |
commit | e7dccb090786794b44213d3add032e484777726d (patch) | |
tree | 93064f4927b8071f0ab292a908bee08b4f0c2f73 /src/build | |
parent | 04a2b51f4c21e763ed9f0714b61360bdd69370a5 (diff) | |
download | talos-sbe-e7dccb090786794b44213d3add032e484777726d.tar.gz talos-sbe-e7dccb090786794b44213d3add032e484777726d.zip |
securityRegListGen: use io.open and read in text mode.
io.open is compatible with python3.x's open builtin. Open in text mode
(no 'b') as this is a plain csv file, and specify the encoding as utf8.
Without this change, building with python3.x (python3.5 tested) as
/usr/bin/python will result in the following error:
File "sbe/src/build/security/securityRegListGen.py", line 695, in <module>
main(sys.argv)
File "sbe/src/build/security/securityRegListGen.py", line 592, in main
for idx, row in enumerate(reader):
File "/usr/lib/python3.5/csv.py", line 109, in __next__
self.fieldnames
File "/usr/lib/python3.5/csv.py", line 96, in fieldnames
self._fieldnames = next(self.reader)
_csv.Error: iterator should return strings, not bytes
(did you open the file in text mode?)
Change-Id: Ib86ea774b40c89e83ab1c0474014222f2fe9ddb9
Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/89386
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Srikantha S. Meesala <srikantha@in.ibm.com>
Reviewed-by: RAJA DAS <rajadas2@in.ibm.com>
Diffstat (limited to 'src/build')
-rw-r--r-- | src/build/security/securityRegListGen.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/build/security/securityRegListGen.py b/src/build/security/securityRegListGen.py index 4703c9be..c4324498 100644 --- a/src/build/security/securityRegListGen.py +++ b/src/build/security/securityRegListGen.py @@ -5,7 +5,7 @@ # # OpenPOWER sbe Project # -# Contributors Listed Below - COPYRIGHT 2017,2019 +# Contributors Listed Below - COPYRIGHT 2017,2020 # [+] International Business Machines Corp. # # @@ -26,6 +26,7 @@ import getopt import sys import os import csv +import io # Exit codes SUCCESS = 0 @@ -585,7 +586,7 @@ def main(argv): whitelist = [] blacklist = [] greylist = [] - with open(SECURITY_LIST, 'rbU') as f: + with io.open(SECURITY_LIST, 'r', encoding="utf8") as f: reader = csv.DictReader(f) for idx, row in enumerate(reader): try: |