commit:     128b85f6e3ee6e504217ec054d370608de292aac
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 20 06:04:17 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Apr 20 06:05:27 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=128b85f6

dev-python/aiohttp: Unbundle llhttp again

Closes: https://bugs.gentoo.org/953899
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/aiohttp/aiohttp-3.11.17.ebuild          | 20 +++++++++++---
 .../files/aiohttp-3.11.17-unbundle-llhttp.patch    | 31 ++++++++++++++++++++++
 2 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/dev-python/aiohttp/aiohttp-3.11.17.ebuild 
b/dev-python/aiohttp/aiohttp-3.11.17.ebuild
index 77309be17d23..dd9363840864 100644
--- a/dev-python/aiohttp/aiohttp-3.11.17.ebuild
+++ b/dev-python/aiohttp/aiohttp-3.11.17.ebuild
@@ -17,10 +17,18 @@ HOMEPAGE="
 
 LICENSE="Apache-2.0"
 SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv 
~s390 ~sparc ~x86"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 
~sparc ~x86"
 IUSE="+native-extensions test-rust"
 
+DEPEND="
+       native-extensions? (
+               $(python_gen_cond_dep '
+                       net-libs/llhttp:=
+               ' 'python3*')
+       )
+"
 RDEPEND="
+       ${DEPEND}
        >=dev-python/aiodns-3.2.0[${PYTHON_USEDEP}]
        >=dev-python/aiohappyeyeballs-2.3.0[${PYTHON_USEDEP}]
        >=dev-python/aiosignal-1.1.2[${PYTHON_USEDEP}]
@@ -61,13 +69,19 @@ EPYTEST_XDIST=1
 distutils_enable_tests pytest
 
 src_prepare() {
+       local PATCHES=(
+               "${FILESDIR}/${PN}-3.11.17-unbundle-llhttp.patch"
+       )
+
+       distutils-r1_src_prepare
+
        # increase the timeout a little
        sed -e '/abs=/s/0.001/0.01/' -i tests/test_helpers.py || die
        # xfail_strict fails on py3.10
        sed -i -e '/--cov/d' -e '/pytest_cov/d' -e '/xfail_strict/d' setup.cfg 
|| die
        sed -i -e 's:-Werror::' Makefile || die
-
-       distutils-r1_src_prepare
+       # remove vendored llhttp
+       rm -r vendor || die
 }
 
 python_configure() {

diff --git a/dev-python/aiohttp/files/aiohttp-3.11.17-unbundle-llhttp.patch 
b/dev-python/aiohttp/files/aiohttp-3.11.17-unbundle-llhttp.patch
new file mode 100644
index 000000000000..500377eb46e6
--- /dev/null
+++ b/dev-python/aiohttp/files/aiohttp-3.11.17-unbundle-llhttp.patch
@@ -0,0 +1,31 @@
+diff --git a/aiohttp/_cparser.pxd b/aiohttp/_cparser.pxd
+index c2cd5a92f..1b3be6d4e 100644
+--- a/aiohttp/_cparser.pxd
++++ b/aiohttp/_cparser.pxd
+@@ -1,7 +1,7 @@
+ from libc.stdint cimport int32_t, uint8_t, uint16_t, uint64_t
+ 
+ 
+-cdef extern from "../vendor/llhttp/build/llhttp.h":
++cdef extern from "llhttp.h":
+ 
+     struct llhttp__internal_s:
+         int32_t _index
+diff --git a/setup.py b/setup.py
+index c9a2c5c85..fe1a8101f 100644
+--- a/setup.py
++++ b/setup.py
+@@ -33,12 +33,9 @@ extensions = [
+         [
+             "aiohttp/_http_parser.c",
+             "aiohttp/_find_header.c",
+-            "vendor/llhttp/build/c/llhttp.c",
+-            "vendor/llhttp/src/native/api.c",
+-            "vendor/llhttp/src/native/http.c",
+         ],
+         define_macros=[("LLHTTP_STRICT_MODE", 0)],
+-        include_dirs=["vendor/llhttp/build"],
++        libraries=["llhttp"],
+     ),
+     Extension("aiohttp._http_writer", ["aiohttp/_http_writer.c"]),
+     Extension("aiohttp._websocket.reader_c", 
["aiohttp/_websocket/reader_c.c"]),

Reply via email to