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.1";
16 format = "setuptools";
17
18 src = fetchFromGitHub {
19 owner = "Changaco";
20 repo = "python-${pname}";
21 tag = version;
22 sha256 = "sha256-CO9llPIbVTuE74AeohrMAu5ICkuT/MorRlYEEFne6Uk=";
23 };
24
25 patches = [
26 (fetchpatch {
27 name = "fix-tests-with-recent-libarchive.patch";
28 url = "https://github.com/Changaco/python-libarchive-c/commit/a56e9402c76c2fb9631651de7bae07b5fbb0b624.patch";
29 hash = "sha256-OLwJQurEFAmwZJbQfhkibrR7Rcnc9vpWwBuhKxgmT7g=";
30 })
31 ];
32
33 LC_ALL = "en_US.UTF-8";
34
35 postPatch = ''
36 substituteInPlace libarchive/ffi.py --replace \
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}