1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 coreutils,
6 setuptools,
7 xlib,
8 fontconfig,
9 pytestCheckHook,
10 writableTmpDirAsHomeHook,
11 pytest-asyncio,
12 pytest-timeout,
13 pytest-xvfb,
14 i3,
15 xorg,
16}:
17
18buildPythonPackage rec {
19 pname = "i3ipc";
20 version = "2.2.1";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "altdesktop";
25 repo = "i3ipc-python";
26 tag = "v${version}";
27 hash = "sha256-JRwipvIF1zL/x2A+xEJKEFV6BlDnv2Xt/eyIzVrSf40=";
28 };
29
30 patches = [
31 # Upstream expects a very old version of pytest-asyncio. This patch correctly
32 # decorates async fixtures using pytest-asyncio and configures `loop_scope`
33 # where needed.
34 ./fix-async-tests.patch
35 ];
36
37 postPatch = ''
38 substituteInPlace test/i3.config \
39 --replace-fail /bin/true ${coreutils}/bin/true
40 '';
41
42 build-system = [ setuptools ];
43 dependencies = [ xlib ];
44
45 # Fontconfig error: Cannot load default config file
46 env.FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf";
47
48 nativeCheckInputs = [
49 pytestCheckHook
50 writableTmpDirAsHomeHook
51 pytest-asyncio
52 pytest-timeout
53 pytest-xvfb
54 i3
55 xorg.xdpyinfo
56 xorg.xvfb
57 ];
58
59 disabledTestPaths = [
60 # Timeout
61 "test/test_shutdown_event.py::TestShutdownEvent::test_shutdown_event_reconnect"
62 "test/aio/test_shutdown_event.py::TestShutdownEvent::test_shutdown_event_reconnect"
63 # Flaky
64 "test/test_window.py::TestWindow::test_detailed_window_event"
65 "test/aio/test_workspace.py::TestWorkspace::test_workspace"
66 ];
67
68 pythonImportsCheck = [ "i3ipc" ];
69
70 meta = {
71 description = "Improved Python library to control i3wm and sway";
72 homepage = "https://github.com/altdesktop/i3ipc-python";
73 changelog = "https://github.com/altdesktop/i3ipc-python/releases/tag/${src.tag}";
74 license = lib.licenses.bsd3;
75 };
76}