1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5, python
6
7# native inputs
8, pkgconfig
9, setuptools-scm
10
11# tests
12, psutil
13, pytestCheckHook
14}:
15
16buildPythonPackage rec {
17 pname = "python-lz4";
18 version = "4.0.1";
19 format = "setuptools";
20
21 disabled = pythonOlder "3.5";
22
23 # get full repository in order to run tests
24 src = fetchFromGitHub {
25 owner = pname;
26 repo = pname;
27 rev = "refs/tags/v${version}";
28 sha256 = "sha256-hQuZkstsB37pFDWmA0W6qGd7rAer1mun7Z6MxMp0ZmE=";
29 };
30
31 SETUPTOOLS_SCM_PRETEND_VERSION = version;
32
33 postPatch = ''
34 sed -i '/pytest-cov/d' setup.py
35 '';
36
37 nativeBuildInputs = [
38 setuptools-scm
39 pkgconfig
40 ];
41
42 pythonImportsCheck = [
43 "lz4"
44 "lz4.block"
45 "lz4.frame"
46 "lz4.stream"
47 ];
48
49 checkInputs = [
50 pytestCheckHook
51 psutil
52 ];
53
54 # for lz4.steam
55 PYLZ4_EXPERIMENTAL = true;
56
57 # prevent local lz4 directory from getting imported as it lacks native extensions
58 preCheck = ''
59 rm -r lz4
60 export PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH
61 '';
62
63 meta = with lib; {
64 description = "LZ4 Bindings for Python";
65 homepage = "https://github.com/python-lz4/python-lz4";
66 license = licenses.bsd3;
67 maintainers = with maintainers; [ costrouc ];
68 };
69}