From 725fc96ef4a8c9667b705cb0cef8729210f731f2 Mon Sep 17 00:00:00 2001 From: "Sakthipriyan Vairamani (thefourtheye)" Date: Sat, 19 Jan 2019 15:44:37 +0530 Subject: [PATCH 1/2] tools: make mkssldef.py Python 3 compatible This patch replaces the usage of `map` in such a way that it will be compatible with Python 3. --- tools/mkssldef.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/mkssldef.py b/tools/mkssldef.py index 3ff53531667417..358f700ba101c5 100755 --- a/tools/mkssldef.py +++ b/tools/mkssldef.py @@ -21,13 +21,13 @@ elif option.startswith('-X'): excludes += option[2:].split(',') elif option.startswith('-B'): bases += option[2:].split(',') - excludes = map(re.compile, excludes) + excludes = [re.compile(exclude) for exclude in excludes] exported = [] for filename in filenames: for line in open(filename).readlines(): name, _, _, meta, _ = re.split('\s+', line) - if any(map(lambda p: p.match(name), excludes)): continue + if any([p.match(name) for p in excludes]): continue meta = meta.split(':') assert meta[0] in ('EXIST', 'NOEXIST') assert meta[2] in ('FUNCTION', 'VARIABLE') From 4f754433ce9fef7e59bfca438f132f704071e4e8 Mon Sep 17 00:00:00 2001 From: "Sakthipriyan Vairamani (thefourtheye)" Date: Tue, 22 Jan 2019 23:04:12 +0530 Subject: [PATCH 2/2] replace list comprehension with a generator --- tools/mkssldef.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mkssldef.py b/tools/mkssldef.py index 358f700ba101c5..4768d1ff0ff699 100755 --- a/tools/mkssldef.py +++ b/tools/mkssldef.py @@ -27,7 +27,7 @@ for filename in filenames: for line in open(filename).readlines(): name, _, _, meta, _ = re.split('\s+', line) - if any([p.match(name) for p in excludes]): continue + if any(p.match(name) for p in excludes): continue meta = meta.split(':') assert meta[0] in ('EXIST', 'NOEXIST') assert meta[2] in ('FUNCTION', 'VARIABLE')