From 2f8aef05c6cfa1a87f2faa4fc13f59598a65dad8 Mon Sep 17 00:00:00 2001 From: Adam Sypniewski Date: Wed, 16 Jan 2019 09:10:30 -0500 Subject: [PATCH 1/2] Fixed library finding for other platforms/package managers. --- libarchive/library.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libarchive/library.py b/libarchive/library.py index eaa8812..89eb562 100644 --- a/libarchive/library.py +++ b/libarchive/library.py @@ -6,7 +6,7 @@ _LOGGER = logging.getLogger(__name__) -_LIBRARY_NAME = 'libarchive' +_LIBRARY_NAME = ['libarchive', 'archive'] _LIBRARY_FILENAME = 'libarchive.so' def find_and_load_library(): @@ -29,9 +29,10 @@ def find_and_load_library(): # Search for our library using whatever search-path ctypes uses (not the same # as `LD_LIBRARY_PATH`). - filepath = ctypes.util.find_library(_LIBRARY_NAME) - if filepath is not None: - search_filepaths.append(filepath) + for library_name in _LIBRARY_NAME: + filepath = ctypes.util.find_library(library_name) + if filepath is not None: + search_filepaths.append(filepath) # Load the first one available. From f0e27cfd2318245e4199953fdc49369b254e5bec Mon Sep 17 00:00:00 2001 From: Adam Sypniewski Date: Thu, 17 Jan 2019 09:23:46 -0500 Subject: [PATCH 2/2] Renamed _LIBRARY_NAME to _LIBRARY_NAMES --- libarchive/library.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libarchive/library.py b/libarchive/library.py index 89eb562..adeadec 100644 --- a/libarchive/library.py +++ b/libarchive/library.py @@ -6,7 +6,7 @@ _LOGGER = logging.getLogger(__name__) -_LIBRARY_NAME = ['libarchive', 'archive'] +_LIBRARY_NAMES = ['libarchive', 'archive'] _LIBRARY_FILENAME = 'libarchive.so' def find_and_load_library(): @@ -29,7 +29,7 @@ def find_and_load_library(): # Search for our library using whatever search-path ctypes uses (not the same # as `LD_LIBRARY_PATH`). - for library_name in _LIBRARY_NAME: + for library_name in _LIBRARY_NAMES: filepath = ctypes.util.find_library(library_name) if filepath is not None: search_filepaths.append(filepath)