[gobject-introspection] Evaluate the filters when checking library types in resolve_shlibs



commit aec85eaf4d41fbc82889a2dfe1c0e672f036cbae
Author: Alistair Buxton <a j buxton gmail com>
Date:   Fri Sep 27 19:46:49 2019 +0100

    Evaluate the filters when checking library types in resolve_shlibs
    
    In Python 3, filter() returns a filter object for lazy evaluation.
    This object is truthy, so casting it to bool will return True even
    if it would contain no objects. This thwarts the test at the
    beginning of _resolve_non_libtool. To fix this, immediately
    evaluate the filters with list().
    
    Fixes #314.

 giscanner/shlibs.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py
index e6de7bb6..b7c34dc8 100644
--- a/giscanner/shlibs.py
+++ b/giscanner/shlibs.py
@@ -161,8 +161,8 @@ def resolve_from_ldd_output(libraries, output):
 # is linking against.
 #
 def resolve_shlibs(options, binary, libraries):
-    libtool = filter(lambda x: x.endswith(".la"), libraries)
-    non_libtool = filter(lambda x: not x.endswith(".la"), libraries)
+    libtool = list(filter(lambda x: x.endswith(".la"), libraries))
+    non_libtool = list(filter(lambda x: not x.endswith(".la"), libraries))
 
     return (_resolve_libtool(options, binary, libtool) +
             _resolve_non_libtool(options, binary, non_libtool))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]