commit:     ade89260c94939723e7ca64421510f6a10d27622
Author:     Haelwenn (lanodan) Monnier <contact <AT> hacktivis <DOT> me>
AuthorDate: Fri Oct  3 13:36:49 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct  3 14:55:41 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ade89260

dev-libs/gumbo: run html5lib tests

Closes: https://bugs.gentoo.org/963694
Signed-off-by: Haelwenn (lanodan) Monnier <contact <AT> hacktivis.me>
Part-of: https://github.com/gentoo/gentoo/pull/44022
Closes: https://github.com/gentoo/gentoo/pull/44022
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/gumbo/Manifest               |   1 +
 dev-libs/gumbo/gumbo-0.13.2-r1.ebuild | 118 ++++++++++++++++++++++++++++++++++
 dev-libs/gumbo/gumbo-0.13.2.ebuild    |  44 -------------
 3 files changed, 119 insertions(+), 44 deletions(-)

diff --git a/dev-libs/gumbo/Manifest b/dev-libs/gumbo/Manifest
index 002c61e8a6d2..52d902fe08f1 100644
--- a/dev-libs/gumbo/Manifest
+++ b/dev-libs/gumbo/Manifest
@@ -1,2 +1,3 @@
 DIST gumbo-0.13.1.tar.gz 2115080 BLAKE2B 
f6fd8fa818b58adbf6ed9d7ffe1d44a2d9902570addd6fe1c384273c965d345ba04f7a09ccb7860c2d065f5ee2a9193140ea753b08261bf8f3077d69a90bfc85
 SHA512 
22bdaac728e79fb176ea82d40bfab77500a85952d731f832ffa6defb48264a1f108a9bbde19fd60e9d829d23059feab0744b4dabf887997596892b815cb26f17
 DIST gumbo-0.13.2.tar.gz 2145403 BLAKE2B 
543b40f70707fa8c4325312b2e7f0d47e7fe579446532a52ccc5d163a69d43f783a279d84969a663422794b33fb669ca3839649d77095cd2886ba9d19a176e02
 SHA512 
1513e88acfc3240081039b30ab63ca6fc23a85b7d1415cb8e90e9c43f9c3d99d37634a7a50d81ef7f6d43a4facac3802feea6959256a2330b26b16523a288568
+DIST html5lib-tests-a9f44960a9fedf265093d22b2aa3c7ca123727b9.tar.gz 160357 
BLAKE2B 
95ce3ed28d81c3ce63eab972127232924dcdb5b0185b59e88469e615c442a4757d7f332f26cf5687a98bdf4fcd114fc9b7a5bfd10a9f90b378eb4211fd52a3a1
 SHA512 
03fc450a5298d7ee41189576d7cea493cefca491e32a26f6ea5b7e701c1ba41e50c6472130aa3e2191498c0e26f0c69bffa08e3f9ae12b2df11650cefa83a5b8

diff --git a/dev-libs/gumbo/gumbo-0.13.2-r1.ebuild 
b/dev-libs/gumbo/gumbo-0.13.2-r1.ebuild
new file mode 100644
index 000000000000..031f26ed3594
--- /dev/null
+++ b/dev-libs/gumbo/gumbo-0.13.2-r1.ebuild
@@ -0,0 +1,118 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..14} )
+DISTUTILS_USE_PEP517=setuptools
+DISTUTILS_OPTIONAL=1
+DISTUTILS_SINGLE_IMPL=1
+inherit meson distutils-r1
+
+HTML5LIB_TESTS_COMMIT="a9f44960a9fedf265093d22b2aa3c7ca123727b9"
+
+DESCRIPTION="The HTML5 parsing algorithm implemented as a pure C99 library"
+HOMEPAGE="https://codeberg.org/gumbo-parser/gumbo-parser";
+SRC_URI="
+       https://codeberg.org/grisha/gumbo-parser/archive/${PV}.tar.gz -> 
${P}.tar.gz
+       test? (
+               
https://github.com/html5lib/html5lib-tests/archive/${HTML5LIB_TESTS_COMMIT}.tar.gz
+               -> html5lib-tests-${HTML5LIB_TESTS_COMMIT}.tar.gz
+       )
+"
+S="${WORKDIR}/gumbo-parser"
+
+LICENSE="Apache-2.0"
+SLOT="0/3" # gumbo SONAME
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv 
~s390 ~sparc ~x86 ~ppc-macos ~x64-macos ~x64-solaris"
+IUSE="doc test"
+RESTRICT="!test? ( test )"
+REQUIRED_USE="test? ( ${PYTHON_REQUIRED_USE} )"
+
+RDEPEND="test? ( ${PYTHON_DEPS} )"
+DEPEND="test? ( dev-cpp/gtest )"
+BDEPEND="
+       doc? ( app-text/doxygen )
+       test? (
+               ${PYTHON_DEPS}
+               ${DISTUTILS_DEPS}
+               $(python_gen_cond_dep 
'dev-python/beautifulsoup4[${PYTHON_USEDEP}]')
+       )
+"
+
+distutils_enable_tests unittest
+
+src_prepare() {
+       default
+
+       if use test; then
+               rm -d "${S}/testdata" || die
+               mv "${WORKDIR}/html5lib-tests-${HTML5LIB_TESTS_COMMIT}" 
"${S}/testdata" || die
+
+               distutils-r1_src_prepare
+       fi
+}
+
+src_configure() {
+       local emesonargs=(
+               $(meson_use test tests)
+               -Ddefault_library=shared
+       )
+
+       meson_src_configure
+
+       use test && distutils-r1_src_configure
+}
+
+src_compile() {
+       meson_src_compile
+
+       if use test; then
+               # So the python tests can find the libgumbo.so which just got 
built
+               ln -s "${BUILD_DIR}" "${S}/.libs" || die
+
+               distutils-r1_src_compile
+       fi
+
+       if use doc; then
+               doxygen || die "doxygen failed"
+               HTML_DOCS=( docs/html/. )
+       fi
+}
+
+python_test() {
+       pushd python/gumbo >/dev/null || die
+
+       # For some reason `unittest discover` seems to only run only a single 
test file
+       # TODO: Change to *_test.py after 
https://codeberg.org/gumbo-parser/gumbo-parser/pulls/29
+       for t in html5lib_adapter_test.py
+       do
+               set -- "${EPYTHON}" "$t"
+               echo "$@" >&2
+               "$@" || die "Tests failed with ${EPYTHON}"
+       done
+
+       popd >/dev/null
+}
+
+src_test() {
+       meson_src_test
+       distutils-r1_src_test
+}
+
+src_install() {
+       meson_src_install
+
+       use doc && doman docs/man/man3/*
+
+       #>>> import gumbo
+       #Traceback (most recent call last):
+       #  File "<stdin>", line 1, in <module>
+       #  File "/usr/lib/python3.12/site-packages/gumbo/__init__.py", line 33, 
in <module>
+       #    from gumbo.gumboc import *
+       #  File "/usr/lib/python3.12/site-packages/gumbo/gumboc.py", line 29, 
in <module>
+       #    import gumboc_tags
+       #ModuleNotFoundError: No module named 'gumboc_tags'
+       #
+       #use python && distutils-r1_src_install
+}

diff --git a/dev-libs/gumbo/gumbo-0.13.2.ebuild 
b/dev-libs/gumbo/gumbo-0.13.2.ebuild
deleted file mode 100644
index 6502d7a70e18..000000000000
--- a/dev-libs/gumbo/gumbo-0.13.2.ebuild
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 1999-2025 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-inherit meson
-
-DESCRIPTION="The HTML5 parsing algorithm implemented as a pure C99 library"
-HOMEPAGE="https://codeberg.org/gumbo-parser/gumbo-parser";
-SRC_URI="https://codeberg.org/grisha/gumbo-parser/archive/${PV}.tar.gz -> 
${P}.tar.gz"
-S="${WORKDIR}/gumbo-parser"
-
-LICENSE="Apache-2.0"
-SLOT="0/3" # gumbo SONAME
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv 
~s390 ~sparc ~x86 ~ppc-macos ~x64-macos ~x64-solaris"
-IUSE="doc test"
-RESTRICT="!test? ( test )"
-
-DEPEND="test? ( dev-cpp/gtest )"
-BDEPEND="doc? ( app-text/doxygen )"
-
-src_configure() {
-       local emesonargs=(
-               $(meson_use test tests)
-               -Ddefault_library=shared
-       )
-
-       meson_src_configure
-}
-
-src_compile() {
-       meson_src_compile
-
-       if use doc; then
-               doxygen || die "doxygen failed"
-               HTML_DOCS=( docs/html/. )
-       fi
-}
-
-src_install() {
-       meson_src_install
-
-       use doc && doman docs/man/man3/*
-}

Reply via email to