commit:     3d3575f4df1aa8c81092fbc7bc8913f17f0d3520
Author:     Alexander Miller <alex.miller <AT> gmx <DOT> de>
AuthorDate: Thu Mar  7 16:50:03 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Mar 16 16:25:02 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d3575f4

app-arch/torrentzip: Enable tests

Signed-off-by: Alexander Miller <alex.miller <AT> gmx.de>
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 app-arch/torrentzip/torrentzip-1.3.ebuild | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/app-arch/torrentzip/torrentzip-1.3.ebuild 
b/app-arch/torrentzip/torrentzip-1.3.ebuild
index d7b943a837fe..5a45d54d5f5f 100644
--- a/app-arch/torrentzip/torrentzip-1.3.ebuild
+++ b/app-arch/torrentzip/torrentzip-1.3.ebuild
@@ -3,7 +3,8 @@
 
 EAPI=8
 
-inherit cmake
+PYTHON_COMPAT=( python3_{10..12} )
+inherit cmake python-any-r1
 
 MY_P="trrntzip-${PV}"
 DESCRIPTION="Create identical zip archives over multiple systems"
@@ -14,6 +15,8 @@ S="${WORKDIR}/${MY_P}"
 LICENSE="GPL-2+ ZLIB"
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
+IUSE="test"
+RESTRICT="!test? ( test )"
 
 RDEPEND="
        sys-libs/zlib:=
@@ -21,8 +24,25 @@ RDEPEND="
 DEPEND="
        ${RDEPEND}
 "
+BDEPEND="
+       test? (
+               ${RDEPEND}
+               ${PYTHON_DEPS}
+               >=dev-util/nihtest-1.5.0
+       )
+"
 
 DOCS=(AUTHORS NEWS.md README.md)
 
-# Tests need nihtest <https://nih.at/nihtest/>, not packaged
-mycmakeargs=( -DRUN_REGRESS=OFF )
+pkg_setup() {
+       use test && python-any-r1_pkg_setup
+}
+
+src_configure() {
+       if use test; then
+               local mycmakeargs=( -DPYTHONBIN="${EPYTHON}" )
+       else
+               local mycmakeargs=( -DRUN_REGRESS=NO )
+       fi
+       cmake_src_configure
+}

Reply via email to