1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 libarchive,
7 glibcLocales,
8 mock,
9 pytestCheckHook,
10}:
11
12buildPythonPackage rec {
13 pname = "libarchive-c";
14 version = "5.1";
15 format = "setuptools";
16
17 src = fetchFromGitHub {
18 owner = "Changaco";
19 repo = "python-${pname}";
20 rev = "refs/tags/${version}";
21 sha256 = "sha256-CO9llPIbVTuE74AeohrMAu5ICkuT/MorRlYEEFne6Uk=";
22 };
23
24 LC_ALL = "en_US.UTF-8";
25
26 postPatch = ''
27 substituteInPlace libarchive/ffi.py --replace \
28 "find_library('archive')" "'${libarchive.lib}/lib/libarchive${stdenv.hostPlatform.extensions.sharedLibrary}'"
29 '';
30
31 pythonImportsCheck = [ "libarchive" ];
32
33 nativeCheckInputs = [
34 glibcLocales
35 mock
36 pytestCheckHook
37 ];
38
39 meta = with lib; {
40 homepage = "https://github.com/Changaco/python-libarchive-c";
41 description = "Python interface to libarchive";
42 license = licenses.cc0;
43 };
44}