1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 replaceVars,
6
7 # build-system
8 cmake,
9 setuptools,
10 versioningit,
11
12 # native dependencies
13 zlib-ng,
14
15 # tests
16 pytestCheckHook,
17}:
18
19buildPythonPackage rec {
20 pname = "zlib-ng";
21 version = "0.5.1";
22 pyproject = true;
23
24 src = fetchFromGitHub {
25 owner = "pycompression";
26 repo = "python-zlib-ng";
27 rev = "v${version}";
28 hash = "sha256-UsdZgpRI7h6GemT1+1g/cP/8uhLykZ//saH4JMwwlY4=";
29 };
30
31 patches = [
32 (replaceVars ./version.patch {
33 inherit version;
34 })
35 ];
36
37 build-system = [
38 cmake
39 setuptools
40 versioningit
41 ];
42
43 dontUseCmakeConfigure = true;
44
45 env.PYTHON_ZLIB_NG_LINK_DYNAMIC = true;
46
47 buildInputs = [ zlib-ng ];
48
49 pythonImportsCheck = [ "zlib_ng" ];
50
51 nativeCheckInputs = [ pytestCheckHook ];
52
53 preCheck = ''
54 rm -rf src
55 '';
56
57 disabledTests = [
58 # commandline tests fail to find the built module
59 "test_compress_fast_best_are_exclusive"
60 "test_compress_infile_outfile"
61 "test_compress_infile_outfile_default"
62 "test_decompress_cannot_have_flags_compression"
63 "test_decompress_infile_outfile"
64 "test_decompress_infile_outfile_error"
65 ];
66
67 meta = with lib; {
68 description = "Drop-in replacement for Python's zlib and gzip modules using zlib-ng";
69 homepage = "https://github.com/pycompression/python-zlib-ng";
70 changelog = "https://github.com/pycompression/python-zlib-ng/blob/${src.rev}/CHANGELOG.rst";
71 license = licenses.psfl;
72 maintainers = with maintainers; [ hexa ];
73 };
74}