1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 fetchpatch,
7 libarchive,
8 glibcLocales,
9 mock,
10 pytestCheckHook,
11}:
12
13buildPythonPackage rec {
14 pname = "libarchive-c";
15 version = "5.3";
16 format = "setuptools";
17
18 src = fetchFromGitHub {
19 owner = "Changaco";
20 repo = "python-${pname}";
21 tag = version;
22 sha256 = "sha256-JqXTV1aD3k88OlW+8rT3xsDuW34+1xErG7hkupvL7Uo=";
23 };
24
25 patches = [
26 # https://github.com/Changaco/python-libarchive-c/pull/141
27 (fetchpatch {
28 url = "https://github.com/Changaco/python-libarchive-c/commit/e0e2a47b2403632642ee932dd56acd11e4a79efe.diff";
29 hash = "sha256-C9eD4cGQOIdBYy4ytom49lA/Jaarj7LbSIgjxCk/H84=";
30 })
31 ];
32
33 LC_ALL = "en_US.UTF-8";
34
35 postPatch = ''
36 substituteInPlace libarchive/ffi.py --replace-fail \
37 "find_library('archive')" "'${libarchive.lib}/lib/libarchive${stdenv.hostPlatform.extensions.sharedLibrary}'"
38 '';
39
40 pythonImportsCheck = [ "libarchive" ];
41
42 nativeCheckInputs = [
43 glibcLocales
44 mock
45 pytestCheckHook
46 ];
47
48 meta = with lib; {
49 homepage = "https://github.com/Changaco/python-libarchive-c";
50 description = "Python interface to libarchive";
51 license = licenses.cc0;
52 };
53}