1{
2 lib,
3 buildPythonPackage,
4 cffi,
5 fetchPypi,
6 pytestCheckHook,
7 pythonOlder,
8 xorg,
9}:
10
11buildPythonPackage rec {
12 pname = "xcffib";
13 version = "1.9.0";
14 format = "setuptools";
15
16 disabled = pythonOlder "3.7";
17
18 src = fetchPypi {
19 inherit pname version;
20 hash = "sha256-K6xgY2lnVOiHHC9AcwR7Uz792Cx33fhnYgEWcJfMUlM=";
21 };
22
23 postPatch = ''
24 # Hardcode cairo library path
25 sed -e 's,ffi\.dlopen(,&"${xorg.libxcb.out}/lib/" + ,' -i xcffib/__init__.py
26 '';
27
28 propagatedNativeBuildInputs = [ cffi ];
29
30 propagatedBuildInputs = [ cffi ];
31
32 nativeCheckInputs = [
33 pytestCheckHook
34 xorg.xeyes
35 xorg.xvfb
36 ];
37
38 preCheck = ''
39 # import from $out
40 rm -r xcffib
41 '';
42
43 pythonImportsCheck = [ "xcffib" ];
44
45 # Tests use xvfb
46 __darwinAllowLocalNetworking = true;
47
48 meta = with lib; {
49 description = "Drop in replacement for xpyb, an XCB python binding";
50 homepage = "https://github.com/tych0/xcffib";
51 changelog = "https://github.com/tych0/xcffib/releases/tag/v${version}";
52 license = licenses.asl20;
53 platforms = platforms.linux ++ platforms.darwin ++ platforms.windows;
54 maintainers = with maintainers; [ kamilchm ];
55 };
56}