commit:     fe26dafd89a74727711ce0213d5d93772fee9e7c
Author:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 27 20:36:24 2023 +0000
Commit:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Fri Jan 27 20:38:51 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fe26dafd

sys-power/switcheroo-control: Fix python handling

Bug: https://bugs.gentoo.org/891749
Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>

 .../switcheroo-control-2.6-r2.ebuild               | 71 ++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/sys-power/switcheroo-control/switcheroo-control-2.6-r2.ebuild 
b/sys-power/switcheroo-control/switcheroo-control-2.6-r2.ebuild
new file mode 100644
index 000000000000..904ca86aeeaa
--- /dev/null
+++ b/sys-power/switcheroo-control/switcheroo-control-2.6-r2.ebuild
@@ -0,0 +1,71 @@
+# Copyright 2021-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+PYTHON_COMPAT=( python3_{9..11} )
+
+inherit meson python-single-r1 systemd
+
+DESCRIPTION="D-Bus service to check the availability of dual-GPU"
+HOMEPAGE="https://gitlab.freedesktop.org/hadess/switcheroo-control/";
+SRC_URI="https://gitlab.freedesktop.org/hadess/switcheroo-control/uploads/86ea54ac7ddb901b6bf6e915209151f8/${P}.tar.xz";
+
+LICENSE="GPL-3"
+SLOT="0"
+IUSE="gtk-doc test"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+KEYWORDS="~amd64"
+
+RDEPEND="${PYTHON_DEPS}
+       $(python_gen_cond_dep 'dev-python/pygobject:3[${PYTHON_USEDEP}]')
+       >=dev-libs/glib-2.56.0:2
+       >=dev-libs/libgudev-232:=
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+       $(python_gen_cond_dep 'dev-python/pygobject:3[${PYTHON_USEDEP}]')
+       dev-util/gdbus-codegen
+       gtk-doc? ( dev-util/gtk-doc )
+       test? (
+               $(python_gen_cond_dep 
'dev-python/python-dbusmock[${PYTHON_USEDEP}]')
+               dev-util/umockdev
+       )
+"
+
+RESTRICT="!test? ( test )"
+
+python_check_deps() {
+       if use test; then
+               python_has_version 
"dev-python/python-dbusmock[${PYTHON_USEDEP}]" &&
+               python_has_version "dev-python/pygobject:3[${PYTHON_USEDEP}]"
+       else
+               python_has_version "dev-python/pygobject:3[${PYTHON_USEDEP}]"
+       fi
+}
+
+src_configure() {
+       local emesonargs=(
+               -Dsystemdsystemunitdir="$(systemd_get_systemunitdir)"
+               $(meson_use gtk-doc gtk_doc)
+               $(meson_use test tests)
+       )
+       meson_src_configure
+}
+
+src_install() {
+       meson_src_install
+       python_fix_shebang "${D}"/usr/bin/switcherooctl
+       newinitd "${FILESDIR}"/${PN}-init.d ${PN}
+}
+
+pkg_postinst() {
+       if [[ -z "${REPLACING_VERSIONS}" ]]; then
+               elog "You to enable the service:"
+               if systemd_is_booted; then
+                       elog "# systemctl enable switcheroo-control"
+               else
+                       elog "# rc-update add ${PN} default"
+               fi
+       fi
+}

Reply via email to