diff options
author | Michael J Gruber <github@grubix.eu> | 2019-05-16 14:29:31 +0200 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2019-06-02 14:35:54 +0100 |
commit | 553ec461d0d77e899ae51ca67ce425b5e280d1e7 (patch) | |
tree | 063f0bac7dab6ea8f2445f960aebe9a8e2f4992b /alot/helper.py | |
parent | dff018e7cb6c885433e1e91fe0e5162e1e329301 (diff) |
adjust to variable python-magic API
Depending on the libmagic/ctypes version, magic_version is a function or
a constant. So far, the code expected a constant and fails on the
function variant with a TypeError.
Test with callable() und use the magic_version attribute accordingly.
Diffstat (limited to 'alot/helper.py')
-rw-r--r-- | alot/helper.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/alot/helper.py b/alot/helper.py index 94ea108c..886d4e05 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -433,6 +433,11 @@ def libmagic_version_at_least(version): # if it's not present, we can't guess right, so let's assume False return False + # Depending on the libmagic/ctypes version, magic_version is a function or + # a callable: + if callable(magic_wrapper.magic_version): + return magic_wrapper.magic_version() >= version + return magic_wrapper.magic_version >= version |