summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlistair Buxton <a.j.buxton@gmail.com>2019-09-27 19:46:49 +0100
committerAlistair Buxton <a.j.buxton@gmail.com>2019-09-27 19:49:46 +0100
commitaec85eaf4d41fbc82889a2dfe1c0e672f036cbae (patch)
tree6fa9883c0ca6872ffe828e9972862913b840dfb3
parentb0eea08b3e53d232efa72f773e474c0357a06cee (diff)
downloadgobject-introspection-aec85eaf4d41fbc82889a2dfe1c0e672f036cbae.tar.gz
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.
-rw-r--r--giscanner/shlibs.py4
1 files 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))