commit:     a54012d8212bd465ffc60f25aacf61f5356f652e
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  5 14:02:31 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Dec  5 14:32:41 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a54012d8

dev-python/pywlroots: Fix automagic xwayland dependency

Fix automagic dependency on xwayland support in gui-libs/wlroots,
as well as an awfully broken logic that resulted in wlroots/_build.py
file disappearing if the package was installed at build time (sigh).

Closes: https://bugs.gentoo.org/919097
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 ...0.16.6-r1.ebuild => pywlroots-0.16.6-r2.ebuild} | 24 ++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/dev-python/pywlroots/pywlroots-0.16.6-r1.ebuild 
b/dev-python/pywlroots/pywlroots-0.16.6-r2.ebuild
similarity index 59%
rename from dev-python/pywlroots/pywlroots-0.16.6-r1.ebuild
rename to dev-python/pywlroots/pywlroots-0.16.6-r2.ebuild
index e5ef19dd6278..bc058a1c6aff 100644
--- a/dev-python/pywlroots/pywlroots-0.16.6-r1.ebuild
+++ b/dev-python/pywlroots/pywlroots-0.16.6-r2.ebuild
@@ -18,25 +18,37 @@ HOMEPAGE="
 LICENSE="BSD"
 SLOT="0"
 KEYWORDS="amd64 ~riscv ~x86"
+IUSE="X"
 
 # See README for wlroots dep
 DEPEND="
        dev-python/cffi:=[${PYTHON_USEDEP}]
        >=dev-python/pywayland-0.4.14[${PYTHON_USEDEP}]
        >=dev-python/xkbcommon-0.2[${PYTHON_USEDEP}]
-       =gui-libs/wlroots-$(ver_cut 1-2)*:=
-       x11-base/xwayland
+       =gui-libs/wlroots-$(ver_cut 1-2)*:=[X?]
 "
 RDEPEND="
        ${DEPEND}
 "
 
-PATCHES=(
-       "${FILESDIR}"/${PN}-0.15.24-no-import-version-check.patch
-)
-
 distutils_enable_tests pytest
 
+src_prepare() {
+       local PATCHES=(
+               "${FILESDIR}"/${PN}-0.15.24-no-import-version-check.patch
+       )
+
+       # override automagic detection and caching that's completely broken
+       # by design; https://github.com/flacjacket/pywlroots/issues/132
+       cat > wlroots/_build.py <<-EOF || die
+               has_xwayland = $(usex X True False)
+       EOF
+       sed -e "s:return.*has_xwayland$:return $(usex X True False):" \
+               -i wlroots/ffi_build.py || die
+
+       distutils-r1_src_prepare
+}
+
 python_test() {
        rm -rf wlroots || die
        epytest

Reply via email to