1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 substituteAll,
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 (substituteAll {
33 src = ./version.patch;
34 inherit version;
35 })
36 ];
37
38 build-system = [
39 cmake
40 setuptools
41 versioningit
42 ];
43
44 dontUseCmakeConfigure = true;
45
46 env.PYTHON_ZLIB_NG_LINK_DYNAMIC = true;
47
48 buildInputs = [ zlib-ng ];
49
50 pythonImportsCheck = [ "zlib_ng" ];
51
52 nativeCheckInputs = [ pytestCheckHook ];
53
54 preCheck = ''
55 rm -rf src
56 '';
57
58 disabledTests = [
59 # commandline tests fail to find the built module
60 "test_compress_fast_best_are_exclusive"
61 "test_compress_infile_outfile"
62 "test_compress_infile_outfile_default"
63 "test_decompress_cannot_have_flags_compression"
64 "test_decompress_infile_outfile"
65 "test_decompress_infile_outfile_error"
66 ];
67
68 meta = with lib; {
69 description = "Drop-in replacement for Python's zlib and gzip modules using zlib-ng";
70 homepage = "https://github.com/pycompression/python-zlib-ng";
71 changelog = "https://github.com/pycompression/python-zlib-ng/blob/${src.rev}/CHANGELOG.rst";
72 license = licenses.psfl;
73 maintainers = with maintainers; [ hexa ];
74 };
75}