1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 pythonOlder,
6 cffi,
7 # overridden as pkgs.brotli
8 brotli,
9 setuptools,
10 pytestCheckHook,
11 hypothesis,
12}:
13
14buildPythonPackage rec {
15 pname = "brotlicffi";
16 version = "1.1.0.0";
17 pyproject = true;
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "python-hyper";
22 repo = "brotlicffi";
23 rev = "v${version}";
24 sha256 = "sha256-oW4y1WBJ7+4XwNwwSSR0qUqN03cZYXUYQ6EAwce9dzI=";
25 };
26
27 build-system = [ setuptools ];
28
29 buildInputs = [ brotli ];
30
31 propagatedNativeBuildInputs = [ cffi ];
32
33 dependencies = [ cffi ];
34
35 preBuild = ''
36 export USE_SHARED_BROTLI=1
37 '';
38
39 nativeCheckInputs = [
40 pytestCheckHook
41 hypothesis
42 ];
43
44 # Test data is only available from libbrotli git checkout, not brotli.src
45 doCheck = false;
46
47 enabledTestPaths = [ "test/" ];
48
49 pythonImportsCheck = [ "brotlicffi" ];
50
51 meta = with lib; {
52 description = "Python CFFI bindings to the Brotli library";
53 homepage = "https://github.com/python-hyper/brotlicffi";
54 license = licenses.mit;
55 maintainers = with maintainers; [ fab ];
56 };
57}