commit:     542871fe71bcd4488787425a7d634544f146ff16
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 31 20:07:10 2021 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sun Jan 31 20:14:43 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=542871fe

media-sound/kid3: Make test dependencies optional, add missing BDEPEND

Closes: https://bugs.gentoo.org/768084
Package-Manager: Portage-3.0.14, Repoman-3.0.2
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../kid3/files/kid3-3.8.5-tests-optional.patch     | 64 ++++++++++++++++++++++
 media-sound/kid3/kid3-3.8.5.ebuild                 | 21 +++++--
 2 files changed, 81 insertions(+), 4 deletions(-)

diff --git a/media-sound/kid3/files/kid3-3.8.5-tests-optional.patch 
b/media-sound/kid3/files/kid3-3.8.5-tests-optional.patch
new file mode 100644
index 00000000000..4db47a2f1af
--- /dev/null
+++ b/media-sound/kid3/files/kid3-3.8.5-tests-optional.patch
@@ -0,0 +1,64 @@
+From 4efe62089eff54ac844c70382d432f2abb24c06e Mon Sep 17 00:00:00 2001
+From: Andreas Sturmlechner <[email protected]>
+Date: Sun, 31 Jan 2021 20:38:41 +0100
+Subject: [PATCH] Use include(CTest) and BUILD_TESTING to make Qt5Test and
+ Python optional
+
+Signed-off-by: Andreas Sturmlechner <[email protected]>
+---
+ CMakeLists.txt | 25 ++++++++++++++++---------
+ 1 file changed, 16 insertions(+), 9 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 92d50265..557a208d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -211,8 +211,11 @@ endif()
+ set(CFG_QMLSRCDIR "${kid3_SOURCE_DIR}/src/qml")
+ 
+ find_package(Threads)
+-set(Python_ADDITIONAL_VERSIONS 3)
+-find_package(PythonInterp REQUIRED)
++include(CTest)
++if(BUILD_TESTING)
++  set(Python_ADDITIONAL_VERSIONS 3)
++  find_package(PythonInterp REQUIRED)
++endif()
+ include (CheckCXXSourceCompiles)
+ include (CheckCXXCompilerFlag)
+ include (CheckLibraryExists)
+@@ -256,7 +259,10 @@ else()
+   find_package(Qt5Core)
+ endif()
+ if(Qt5Core_FOUND)
+-  set(_qtComponents Core Gui Widgets Network Xml Multimedia LinguistTools 
Test)
++  set(_qtComponents Core Gui Widgets Network Xml Multimedia LinguistTools)
++  if(BUILD_TESTING)
++    set(_qtComponents ${_qtComponents} Test)
++  endif()
+   if(WITH_DBUS)
+     set(_qtComponents ${_qtComponents} DBus)
+   endif()
+@@ -472,12 +478,13 @@ if(ANDROID)
+ endif()
+ 
+ 
+-enable_testing()
+-add_test(NAME test_cli_functions
+-         COMMAND ${PYTHON_EXECUTABLE} 
${CMAKE_SOURCE_DIR}/src/test/test_cli_functions.py)
+-add_custom_target(check ${CMAKE_CTEST_COMMAND} --output-on-failure)
+-if(NOT CMAKE_VERSION VERSION_LESS "3.17")
+-  list(APPEND CMAKE_CTEST_ARGUMENTS --output-on-failure)
++if(BUILD_TESTING)
++  add_test(NAME test_cli_functions
++           COMMAND ${PYTHON_EXECUTABLE} 
${CMAKE_SOURCE_DIR}/src/test/test_cli_functions.py)
++  add_custom_target(check ${CMAKE_CTEST_COMMAND} --output-on-failure)
++  if(NOT CMAKE_VERSION VERSION_LESS "3.17")
++    list(APPEND CMAKE_CTEST_ARGUMENTS --output-on-failure)
++  endif()
+ endif()
+ 
+ 
+-- 
+2.30.0
+

diff --git a/media-sound/kid3/kid3-3.8.5.ebuild 
b/media-sound/kid3/kid3-3.8.5.ebuild
index a047ed173a3..40385027d97 100644
--- a/media-sound/kid3/kid3-3.8.5.ebuild
+++ b/media-sound/kid3/kid3-3.8.5.ebuild
@@ -3,7 +3,8 @@
 
 EAPI=7
 
-inherit kde.org cmake xdg
+PYTHON_COMPAT=( python3_{7..9} )
+inherit cmake kde.org python-any-r1 xdg
 
 DESCRIPTION="Simple tag editor based on Qt"
 HOMEPAGE="https://kid3.kde.org/";
@@ -15,15 +16,17 @@ fi
 
 LICENSE="GPL-2+"
 SLOT="5"
-IUSE="acoustid flac kde mp3 mp4 +mpris +taglib vorbis"
+IUSE="acoustid flac kde mp3 mp4 +mpris +taglib test vorbis"
 
 REQUIRED_USE="flac? ( vorbis )"
+RESTRICT+=" !test? ( test )"
 
 BDEPEND="
        dev-qt/linguist-tools:5
        kde? ( kde-frameworks/extra-cmake-modules:5 )
+       test? ( ${PYTHON_DEPS} )
 "
-DEPEND="
+COMMON_DEPEND="
        dev-qt/qtcore:5
        dev-qt/qtdeclarative:5
        dev-qt/qtgui:5
@@ -57,10 +60,19 @@ DEPEND="
                media-libs/libvorbis
        )
 "
-RDEPEND="${DEPEND}
+DEPEND="${COMMON_DEPEND}
+       test? ( dev-qt/qttest:5 )
+"
+RDEPEND="${COMMON_DEPEND}
        !media-sound/kid3:4
 "
 
+PATCHES=( "${FILESDIR}/${P}-tests-optional.patch" )
+
+pkg_setup() {
+       use test && python-any-r1_pkg_setup
+}
+
 src_prepare() {
        # overengineered upstream build system
        cmake_src_prepare
@@ -76,6 +88,7 @@ src_configure() {
                -DWITH_ID3LIB=$(usex mp3)
                -DWITH_MP4V2=$(usex mp4)
                -DWITH_TAGLIB=$(usex taglib)
+               -DBUILD_TESTING=$(usex test)
                -DWITH_VORBIS=$(usex vorbis)
        )
 

Reply via email to