Skip to content

Commit 947aec0

Browse files
committed
Merge pull request #6 from Changaco/custom-lib-path
Try to get libarchive's path from the `LIBARCHIVE` envvar
2 parents 2825034 + e575a72 commit 947aec0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

libarchive/ffi.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
CFUNCTYPE, POINTER,
1111
)
1212
import ctypes
13-
import ctypes.util
13+
from ctypes.util import find_library
1414
import logging
1515
import mmap
16+
import os
1617

1718
from .exception import ArchiveError
1819

@@ -21,8 +22,8 @@
2122

2223
page_size = mmap.PAGESIZE
2324

24-
_LIB_FILEPATH = ctypes.util.find_library('archive') or 'libarchive.so'
25-
libarchive = ctypes.cdll.LoadLibrary(_LIB_FILEPATH)
25+
libarchive_path = os.environ.get('LIBARCHIVE') or find_library('archive')
26+
libarchive = ctypes.cdll.LoadLibrary(libarchive_path)
2627

2728

2829
# Constants

0 commit comments

Comments
 (0)