diff options
| -rw-r--r-- | media-sound/kid3/files/kid3-3.8.5-tests-optional.patch | 99 | ||||
| -rw-r--r-- | media-sound/kid3/kid3-9999.ebuild | 21 |
2 files changed, 115 insertions, 5 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..d5b74ca5613 --- /dev/null +++ b/media-sound/kid3/files/kid3-3.8.5-tests-optional.patch @@ -0,0 +1,99 @@ +From 4efe62089eff54ac844c70382d432f2abb24c06e Mon Sep 17 00:00:00 2001 +From: Andreas Sturmlechner <asturm@gentoo.org> +Date: Sun, 31 Jan 2021 20:38:41 +0100 +Subject: [PATCH 1/2] Use include(CTest) and BUILD_TESTING to make Qt5Test and + Python optional + +Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org> +--- + 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 + + +From 1e264e918686d5d09a5457513f3aadeea25d6e5e Mon Sep 17 00:00:00 2001 +From: Andreas Sturmlechner <asturm@gentoo.org> +Date: Sun, 31 Jan 2021 23:43:49 +0100 +Subject: [PATCH 2/2] Use CMake FindPython3 module if available (CMake >=3.12) + +Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org> +--- + CMakeLists.txt | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 557a208d..706167e6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -213,8 +213,14 @@ set(CFG_QMLSRCDIR "${kid3_SOURCE_DIR}/src/qml") + find_package(Threads) + include(CTest) + if(BUILD_TESTING) +- set(Python_ADDITIONAL_VERSIONS 3) +- find_package(PythonInterp REQUIRED) ++ if(CMAKE_VERSION VERSION_LESS 3.12.0) ++ set(Python_ADDITIONAL_VERSIONS 3) ++ find_package(PythonInterp REQUIRED) ++ # PythonInterp sets PYTHON_EXECUTABLE ++ else() ++ find_package(Python3 COMPONENTS Interpreter REQUIRED) ++ set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}") ++ endif() + endif() + include (CheckCXXSourceCompiles) + include (CheckCXXCompilerFlag) +-- +2.30.0 + diff --git a/media-sound/kid3/kid3-9999.ebuild b/media-sound/kid3/kid3-9999.ebuild index a047ed173a3..5e87f720296 100644 --- a/media-sound/kid3/kid3-9999.ebuild +++ b/media-sound/kid3/kid3-9999.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=" +RDEPEND=" dev-qt/qtcore:5 dev-qt/qtdeclarative:5 dev-qt/qtgui:5 @@ -57,10 +60,16 @@ DEPEND=" media-libs/libvorbis ) " -RDEPEND="${DEPEND} - !media-sound/kid3:4 +DEPEND="${RDEPEND} + test? ( dev-qt/qttest:5 ) " +PATCHES=( "${FILESDIR}/${PN}-3.8.5-tests-optional.patch" ) + +pkg_setup() { + use test && python-any-r1_pkg_setup +} + src_prepare() { # overengineered upstream build system cmake_src_prepare @@ -76,8 +85,10 @@ src_configure() { -DWITH_ID3LIB=$(usex mp3) -DWITH_MP4V2=$(usex mp4) -DWITH_TAGLIB=$(usex taglib) + -DBUILD_TESTING=$(usex test) -DWITH_VORBIS=$(usex vorbis) ) + use test && mycmakeargs+=( -DPython3_EXECUTABLE="${PYTHON}" ) if use kde ; then mycmakeargs+=( "-DWITH_APPS=KDE;CLI" ) |
