From e8dc5e853e071604e56f173cce3b4f6c1d5aff5a Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Sun, 8 Jun 2014 10:25:52 +0200 Subject: [PATCH] Search /usr/local/lib for p7zip RAR modules. See issue #10 --- doc/changelog.txt | 6 ++++++ patoolib/util.py | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/changelog.txt b/doc/changelog.txt index cea154c..565857f 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -1,3 +1,9 @@ +1.6 (released xx.xx.2014) + +* Search /usr/local/lib for p7zip RAR modules. + Closes: GH bug #10 + + 1.5 (released 30.3.2014) * Fix detection of existing broken symlinks when unpacking. diff --git a/patoolib/util.py b/patoolib/util.py index 2fc193e..c3dc2e2 100644 --- a/patoolib/util.py +++ b/patoolib/util.py @@ -526,12 +526,19 @@ def strtimezone(): return "%+04d" % (-zone//3600) -def p7zip_supports_rar (): +def p7zip_supports_rar(): """Determine if the RAR codec is installed for 7z program.""" if os.name == 'nt': # Assume RAR support is compiled into the binary. return True - return os.path.exists('/usr/lib/p7zip/Codecs/Rar29.so') + # the subdirectory and codec name + codecname = 'p7zip/Codecs/Rar29.so' + # search canonical user library dirs + for libdir in ('/usr/lib', '/usr/local/lib'): + fname = os.path.join(libdir, codecname) + if os.path.exists(fname): + return True + return False @memoized