commit: 0338525676bc752c9997f13e2421b919b6d9bbae Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Sat Oct 4 00:20:32 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sat Oct 4 00:22:45 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03385256
sys-libs/libapparmor: complete wiring up tests for Python Do a nasty hack to avoid running the Python tests in the first/general build, otherwise it'd run for the wrong impl and may not find the built module if not already installed. Still not super happy with all of this and would prefer that we had clean separation of the non-Python and then Python builds but for another day. Bug: https://bugs.gentoo.org/623550 Bug: https://bugs.gentoo.org/625448 Bug: https://bugs.gentoo.org/764779 Signed-off-by: Sam James <sam <AT> gentoo.org> sys-libs/libapparmor/libapparmor-4.0.3-r2.ebuild | 26 +++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/sys-libs/libapparmor/libapparmor-4.0.3-r2.ebuild b/sys-libs/libapparmor/libapparmor-4.0.3-r2.ebuild index 50f8f922974f..e9179e13f0f6 100644 --- a/sys-libs/libapparmor/libapparmor-4.0.3-r2.ebuild +++ b/sys-libs/libapparmor/libapparmor-4.0.3-r2.ebuild @@ -23,8 +23,7 @@ SLOT="0" KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86" IUSE="doc +perl +python ${GENTOO_PERL_USESTRING} test" REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" -# depends on the package already being installed -RESTRICT="!test? ( test ) test" +RESTRICT="!test? ( test )" RDEPEND=" perl? ( @@ -106,8 +105,29 @@ src_compile() { } src_test() { - # Avoid perl-module_src_test + # Avoid perl-module_src_test. We also need to avoid running the + # Python tests in the wrong environment here. + mv swig/python/test/test_python.py.in{,.bak} || die + touch swig/python/test/test_python.py.in default + mv swig/python/test/test_python.py.in{.bak,} || die + + if use python ; then + pushd swig/python > /dev/null || die + distutils-r1_src_test + popd > /dev/null || die + fi +} + +python_test() { + cd test || die + + # Force regeneration wrt the earlier hack we did + touch test_python.py.in || die + # Create test_python.py from test_python.py.in + emake test_python.py + + LD_LIBRARY_PATH="${S}/src/.libs:${LD_LIBRARY_PATH}" ${EPYTHON} test_python.py || die } src_install() {
