From 5a9dc388ade0604962cd86889dfd1658579539fa Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 25 Oct 2018 11:05:06 +0200 Subject: [PATCH] Minor refactorisation of how we're checking for exiftool's presence --- libmat2/exiftool.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/libmat2/exiftool.py b/libmat2/exiftool.py index 9611a04..adec28e 100644 --- a/libmat2/exiftool.py +++ b/libmat2/exiftool.py @@ -53,15 +53,14 @@ class ExiftoolParser(abstract.AbstractParser): return True def _get_exiftool_path() -> str: # pragma: no cover - exiftool_path = '/usr/bin/exiftool' - if os.path.isfile(exiftool_path): - if os.access(exiftool_path, os.X_OK): - return exiftool_path + possible_pathes = { + '/usr/bin/exiftool', # debian/fedora + '/usr/bin/vendor_perl/exiftool', # archlinux + } - # ArchLinux - exiftool_path = '/usr/bin/vendor_perl/exiftool' - if os.path.isfile(exiftool_path): - if os.access(exiftool_path, os.X_OK): - return exiftool_path + for possible_path in possible_pathes: + if os.path.isfile(possible_path): + if os.access(possible_path, os.X_OK): + return possible_path raise RuntimeError("Unable to find exiftool")