summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred Wingate <parona@protonmail.com>2022-05-12 22:35:07 +0300
committerSam James <sam@gentoo.org>2023-06-17 02:49:39 +0100
commitadce240c4019f5768fd5784dc4e052f759092f76 (patch)
treed6609bdfa5e7138341aa6e855e9fdb2a718e7e88 /media-sound/playerctl
parentsys-devel/gdb: drop versions (diff)
downloadgentoo-adce240c4019f5768fd5784dc4e052f759092f76.tar.gz
gentoo-adce240c4019f5768fd5784dc4e052f759092f76.tar.bz2
gentoo-adce240c4019f5768fd5784dc4e052f759092f76.zip
media-sound/playerctl: wire up tests
[sam: Pulling in Alfred's bump PR which I'd missed.] Signed-off-by: Alfred Wingate <parona@protonmail.com> Closes: https://github.com/gentoo/gentoo/pull/25976 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'media-sound/playerctl')
-rw-r--r--media-sound/playerctl/playerctl-2.4.1-r1.ebuild99
1 files changed, 99 insertions, 0 deletions
diff --git a/media-sound/playerctl/playerctl-2.4.1-r1.ebuild b/media-sound/playerctl/playerctl-2.4.1-r1.ebuild
new file mode 100644
index 000000000000..e1337e2c4146
--- /dev/null
+++ b/media-sound/playerctl/playerctl-2.4.1-r1.ebuild
@@ -0,0 +1,99 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..11} )
+inherit bash-completion-r1 meson python-any-r1 virtualx xdg-utils
+
+DESCRIPTION="A CLI utility to control media players over MPRIS"
+HOMEPAGE="https://github.com/acrisci/playerctl"
+SRC_URI="https://github.com/acrisci/playerctl/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="LGPL-3+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc introspection test"
+RESTRICT="!test? ( test ) test"
+
+RDEPEND="
+ >=dev-libs/glib-2.38:2
+ introspection? ( dev-libs/gobject-introspection:= )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ dev-util/gdbus-codegen
+ dev-util/glib-utils
+ virtual/pkgconfig
+ doc? ( dev-util/gtk-doc )
+ introspection? ( dev-libs/gobject-introspection )
+ test? (
+ ${PYTHON_DEPS}
+ sys-apps/dbus
+ $(python_gen_any_dep '
+ dev-python/dbus-next[${PYTHON_USEDEP}]
+ dev-python/pytest[${PYTHON_USEDEP}]
+ dev-python/pytest-asyncio[${PYTHON_USEDEP}]
+ dev-python/pytest-timeout[${PYTHON_USEDEP}]
+ ')
+ )
+"
+
+EPYTEST_DESELECT=(
+ # Requires a lenient dbus config systemwide
+ # See test/data/dbus-system.conf and how its used in Dockerfile
+ "test/test_basics.py::test_system_list_players"
+ # Daemon tests are inconsistent, occasional failure occurs in upstream CI as well.
+ "test/test_daemon.py"
+)
+
+python_check_deps() {
+ python_has_version \
+ "dev-python/dbus-next[${PYTHON_USEDEP}]" \
+ "dev-python/pytest[${PYTHON_USEDEP}]" \
+ "dev-python/pytest-asyncio[${PYTHON_USEDEP}]" \
+ "dev-python/pytest-timeout[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+ use test && python-any-r1_pkg_setup
+}
+
+src_configure() {
+ local emesonargs=(
+ -Ddatadir=share
+ -Dbindir=bin
+ -Dbash-completions=false
+ -Dzsh-completions=false
+ $(meson_use doc gtk-doc)
+ $(meson_use introspection)
+ )
+
+ xdg_environment_reset # bug #596166
+ meson_src_configure
+}
+
+src_test() {
+ local dbus_params=(
+ $(dbus-daemon --session --print-address --fork --print-pid)
+ )
+ local -x DBUS_SESSION_BUS_ADDRESS=${dbus_params[0]}
+
+ export PATH="${BUILD_DIR}/playerctl/:${PATH}"
+
+ virtx epytest
+
+ kill "${dbus_params[1]}" || die
+}
+
+src_install() {
+ meson_src_install
+
+ docinto examples
+ dodoc -r "${S}"/examples/.
+ docompress -x "/usr/share/doc/${PF}/examples"
+
+ newbashcomp data/playerctl.bash "${PN}"
+ insinto /usr/share/zsh/site-functions
+ newins data/playerctl.zsh _playerctl
+}