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