From 9398ad2999ff6c73ad7409f895757dcf35019f64 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@redhat.com>
Date: Thu, 26 Nov 2015 00:09:08 +0100
Subject: [PATCH 3/6] Python 3: coerce iterators into lists where necessary
---
python/lib/gen_pyobject.py | 2 +-
python/lib/generator.py | 12 +++++++++---
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/python/lib/gen_pyobject.py b/python/lib/gen_pyobject.py
index ba8274e..1cc9bde 100644
--- a/python/lib/gen_pyobject.py
+++ b/python/lib/gen_pyobject.py
@@ -70,7 +70,7 @@ def get_params_types_names(proto):
example: proto = "int main (int argc, char ** argv)"
returns: [['int', 'argc'], ['char **','argv']]
"""
- return map(split_type, get_params(proto))
+ return list(map(split_type, get_params(proto)))
def get_return_type(proto):
import re
diff --git a/python/lib/generator.py b/python/lib/generator.py
index 7d95945..90c145d 100755
--- a/python/lib/generator.py
+++ b/python/lib/generator.py
@@ -11,6 +11,7 @@ def get_cpp_objects():
cpp_output = filter(lambda y: len(y) > 1, cpp_output)
cpp_output = filter(lambda y: not y.startswith('#'), cpp_output)
+ cpp_output = list(cpp_output)
i = 1
while 1:
@@ -85,9 +86,11 @@ def generate_object_files(output_path):
object_methods = filter(lambda x: this_object in x, cpp_output)
object_methods = [a.strip() for a in object_methods]
object_methods = filter(lambda x: not x.startswith('typedef'), object_methods)
+ object_methods = list(object_methods)
#for method in object_methods:
# write_msg(method)
- new_methods = filter(lambda x: 'new_'+object_name in x, object_methods)
+ new_methods = list(filter(
+ lambda x: 'new_'+object_name in x, object_methods))
if len(new_methods) > 1:
write_msg("-- WARNING: more than one new method for", object_name)
for method in new_methods:
@@ -98,7 +101,8 @@ def generate_object_files(output_path):
for method in new_methods:
write_msg(method)
- del_methods = filter(lambda x: 'del_'+object_name in x, object_methods)
+ del_methods = list(filter(
+ lambda x: 'del_'+object_name in x, object_methods))
if len(del_methods) > 1:
write_msg("-- WARNING: more than one del method for", object_name)
for method in del_methods:
@@ -106,7 +110,8 @@ def generate_object_files(output_path):
elif len(del_methods) < 1:
write_msg("-- WARNING: no del method for", object_name)
- do_methods = filter(lambda x: object_name+'_do' in x, object_methods)
+ do_methods = list(filter(
+ lambda x: object_name+'_do' in x, object_methods))
if len(do_methods) > 1:
pass
#write_msg("-- WARNING: more than one do method for", object_name)
@@ -135,6 +140,7 @@ def generate_object_files(output_path):
other_methods = filter(lambda x: x not in do_methods, other_methods)
other_methods = filter(lambda x: x not in get_methods, other_methods)
other_methods = filter(lambda x: x not in set_methods, other_methods)
+ other_methods = list(other_methods)
if len(other_methods) > 0:
write_msg("-- WARNING: some methods for", object_name, "were unidentified")
--
2.5.0