From e575a72e37c32a0c6c7661ccb2c8f5e760ae19f5 Mon Sep 17 00:00:00 2001 From: Changaco Date: Mon, 27 Apr 2015 14:26:34 +0200 Subject: [PATCH] try to get libarchive's path from the `LIBARCHIVE` envvar fixes #3 --- libarchive/ffi.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libarchive/ffi.py b/libarchive/ffi.py index 6afb1c0..4305b3f 100644 --- a/libarchive/ffi.py +++ b/libarchive/ffi.py @@ -10,9 +10,10 @@ CFUNCTYPE, POINTER, ) import ctypes -import ctypes.util +from ctypes.util import find_library import logging import mmap +import os from .exception import ArchiveError @@ -21,8 +22,8 @@ page_size = mmap.PAGESIZE -_LIB_FILEPATH = ctypes.util.find_library('archive') or 'libarchive.so' -libarchive = ctypes.cdll.LoadLibrary(_LIB_FILEPATH) +libarchive_path = os.environ.get('LIBARCHIVE') or find_library('archive') +libarchive = ctypes.cdll.LoadLibrary(libarchive_path) # Constants