summaryrefslogtreecommitdiff
path: root/x11-wm/qtile/qtile-0.28.1.ebuild
blob: 7bd2f780e08e5d252b43145c843e610dec94c65d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=standalone
PYTHON_COMPAT=( python3_{10..12} )

inherit distutils-r1 pypi virtualx

DESCRIPTION="A full-featured, hackable tiling window manager written in Python"
HOMEPAGE="
	https://qtile.org/
	https://github.com/qtile/qtile/
	https://pypi.org/project/qtile/
"

LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 ~riscv"
IUSE="pulseaudio wayland"

RDEPEND="
	>=dev-python/cairocffi-1.6.0[${PYTHON_USEDEP}]
	>=dev-python/cffi-1.1.0:=[${PYTHON_USEDEP}]
	dev-python/dbus-next[${PYTHON_USEDEP}]
	dev-python/pygobject[${PYTHON_USEDEP}]
	>=dev-python/xcffib-1.4.0[${PYTHON_USEDEP}]
	x11-libs/cairo[X,xcb(+)]
	x11-libs/libnotify[introspection]
	x11-libs/pango
	pulseaudio? (
		dev-python/pulsectl-asyncio[${PYTHON_USEDEP}]
		media-libs/libpulse
	)
	wayland? (
		>=dev-python/pywayland-0.4.17[${PYTHON_USEDEP}]
		>=dev-python/pywlroots-0.17[${PYTHON_USEDEP}]
	)
"
BDEPEND="
	dev-python/cffi[${PYTHON_USEDEP}]
	dev-python/setuptools[${PYTHON_USEDEP}]
	dev-python/setuptools-scm[${PYTHON_USEDEP}]
	test? (
		dev-python/libcst[${PYTHON_USEDEP}]
		media-gfx/imagemagick[X]
		x11-base/xorg-server[xephyr,xvfb]
	)
	wayland? (
		>=dev-python/pywayland-0.4.17[${PYTHON_USEDEP}]
		>=dev-python/pywlroots-0.17[${PYTHON_USEDEP}]
	)
"

distutils_enable_tests pytest

python_prepare_all() {
	sed -e "s/can_import(\"wlroots.ffi_build\")/$(usex wayland True False)/" \
		-i setup.py || die

	# some tests expect bin/qtile
	mkdir bin || die
	cat >> bin/qtile <<-EOF || die
		#!/bin/sh
		exec qtile "\${@}"
	EOF
	chmod +x bin/qtile || die

	distutils-r1_python_prepare_all
}

src_compile() {
	local -x CFFI_TMPDIR=${T}
	distutils-r1_src_compile
}

src_test() {
	virtx distutils-r1_src_test
}

python_test() {
	local EPYTEST_DESELECT=(
		# mypy stuff
		test/test_check.py
		test/migrate/test_check_migrations.py
		# TODO: this test clearly requires x11 — so why is wayland
		# variant being run?
		'test/backend/x11/test_window.py::test_urgent_hook_fire[wayland-2]'
	)

	# force usage of built module
	rm -rf libqtile || die

	local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
	local -x TZ=UTC
	nonfatal epytest --backend=x11 $(usev wayland '--backend=wayland') ||
		die -n "Tests failed with ${EPYTHON}"
}

python_install_all() {
	local DOCS=( CHANGELOG README.rst )
	distutils-r1_python_install_all

	insinto /usr/share/xsessions
	doins resources/qtile.desktop

	insinto /usr/share/wayland-sessions
	doins resources/qtile-wayland.desktop

	exeinto /etc/X11/Sessions
	newexe "${FILESDIR}"/${PN}-session-r1 ${PN}
}