summaryrefslogtreecommitdiff
path: root/dev-python/httptools
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/httptools')
-rw-r--r--dev-python/httptools/Manifest4
-rw-r--r--dev-python/httptools/files/httptools-0.6.2-llhttp-9.patch55
-rw-r--r--dev-python/httptools/httptools-0.6.2.ebuild73
-rw-r--r--dev-python/httptools/metadata.xml11
4 files changed, 143 insertions, 0 deletions
diff --git a/dev-python/httptools/Manifest b/dev-python/httptools/Manifest
new file mode 100644
index 000000000000..6a23c4069f7d
--- /dev/null
+++ b/dev-python/httptools/Manifest
@@ -0,0 +1,4 @@
+AUX httptools-0.6.2-llhttp-9.patch 1696 BLAKE2B 07985d2e9dea617f57099a28c6bfa41d91ce7333020fa21c5789c7fee298a07603bd3e5202d42b83b9651e0b89e93c7a7308fdf3f09a64cd6a89a38b47f92234 SHA512 7f8ac2799a7802b0ed6fd6970c1052af89113c487a52c536824944e8ba4d4ae0a33c6105319468479793d1c29a6b3104ffae612205b975388f493aa55876ff77
+DIST httptools-0.6.2.gh.tar.gz 15209 BLAKE2B f9dbb15a46db4ff6d9ce418fa9854fe465d22c5ca7b758389f2d132f0e031015faea37241f68e8f47e3957da39de9930481e50d0b08e0308ad7d3bb918fc86bb SHA512 a4f79cfd82b1ab3d1bb4dc50cb4c720cdc5b2f94cb72ef693e4385726a02687f1a45d649c8cc22388f1215c9497f329b67eed90f065859380dbd54dd3046c89b
+EBUILD httptools-0.6.2.ebuild 1535 BLAKE2B b7d92e4a849a60fc717c92b1b763cc360893c012277a7571b36700c3415c90573e7ae8911d784acb22137789660dc92e957ac683d9c2ec032f01db01462efb31 SHA512 9f63109f428bd621806e47d71ae68798ab5cbb079df6b434d615bd9903a3153cc242a24505ee5704b1d4ab9e32841c8516200036f17ecfde0323cba2eca37c2d
+MISC metadata.xml 351 BLAKE2B 85cf600c898bf9dce98d5cbe23e664426bc190fe466689c2bb0b487edd4ec2da13ed75c18bc346341fac12339bee4ffaae1440012046743e8c6dcebc1f7dbc52 SHA512 9d1d095ba908ef136f0e47ce40730ed9b38189bd75a2c0659045d438cb25195a5c99c3fc3b5e1b933e83532f9f9cac58148123976a01e70e75141b207a751a53
diff --git a/dev-python/httptools/files/httptools-0.6.2-llhttp-9.patch b/dev-python/httptools/files/httptools-0.6.2-llhttp-9.patch
new file mode 100644
index 000000000000..8f5dc017d246
--- /dev/null
+++ b/dev-python/httptools/files/httptools-0.6.2-llhttp-9.patch
@@ -0,0 +1,55 @@
+diff --git a/tests/test_parser.py b/tests/test_parser.py
+index a169a9a..d3b8db7 100644
+--- a/tests/test_parser.py
++++ b/tests/test_parser.py
+@@ -6,12 +6,10 @@ from unittest import mock
+
+ RESPONSE1_HEAD = b'''HTTP/1.1 200 OK
+ Date: Mon, 23 May 2005 22:38:34 GMT
+-Server: Apache/1.3.3.7
+- (Unix) (Red-Hat/Linux)
++Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)
+ Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
+ ETag: "3f80f-1b6-3e1cb03b"
+-Content-Type: text/html;
+- charset=UTF-8
++Content-Type: text/html; charset=UTF-8
+ Content-Length: 130
+ Accept-Ranges: bytes
+ Connection: close
+@@ -33,7 +31,7 @@ CHUNKED_REQUEST1_1 = b'''POST /test.php?a=b+c HTTP/1.1\r
+ User-Agent: Fooo\r
+ Host: bar\r
+ Transfer-Encoding: chunked\r
+-
++\r
+ 5\r\nhello\r\n6\r\n world\r\n'''
+
+ CHUNKED_REQUEST1_2 = b'''0\r\nVary: *\r\nUser-Agent: spam\r\n\r\n'''
+@@ -42,7 +40,7 @@ CHUNKED_REQUEST1_3 = b'''POST /test.php?a=b+c HTTP/1.1\r
+ User-Agent: Fooo\r
+ Host: bar\r
+ Transfer-Encoding: chunked\r
+-
++\r
+ b\r\n+\xce\xcfM\xb5MI,I\x04\x00\r\n0\r\n\r\n'''
+
+
+@@ -54,7 +52,7 @@ Sec-WebSocket-Protocol: sample\r
+ Upgrade: WebSocket\r
+ Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r
+ Origin: http://example.com\r
+-
++\r
+ Hot diggity dogg'''
+
+ UPGRADE_RESPONSE1 = b'''HTTP/1.1 101 Switching Protocols
+@@ -89,7 +87,7 @@ class TestResponseParser(unittest.TestCase):
+ self.assertEqual(len(headers), 8)
+ self.assertEqual(headers.get(b'Connection'), b'close')
+ self.assertEqual(headers.get(b'Content-Type'),
+- b'text/html; charset=UTF-8')
++ b'text/html; charset=UTF-8')
+
+ self.assertFalse(m.on_body.called)
+ p.feed_data(bytearray(RESPONSE1_BODY))
diff --git a/dev-python/httptools/httptools-0.6.2.ebuild b/dev-python/httptools/httptools-0.6.2.ebuild
new file mode 100644
index 000000000000..fea990adb5f0
--- /dev/null
+++ b/dev-python/httptools/httptools-0.6.2.ebuild
@@ -0,0 +1,73 @@
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( pypy3 python3_{10..13} )
+
+inherit distutils-r1
+
+DESCRIPTION="A collection of framework independent HTTP protocol utils"
+HOMEPAGE="
+ https://github.com/MagicStack/httptools/
+ https://pypi.org/project/httptools/
+"
+# sdist is missing cython source files, as of 0.6.2
+SRC_URI="
+ https://github.com/MagicStack/httptools/archive/v${PV}.tar.gz
+ -> ${P}.gh.tar.gz
+"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+# don't ask me why they use both
+DEPEND="
+ net-libs/http-parser:=
+ net-libs/llhttp:=
+"
+RDEPEND="
+ ${DEPEND}
+"
+BDEPEND="
+ dev-python/cython[${PYTHON_USEDEP}]
+"
+
+distutils_enable_tests pytest
+
+PATCHES=(
+ # https://github.com/MagicStack/httptools/issues/111
+ # https://github.com/MagicStack/httptools/pull/112
+ "${FILESDIR}/${P}-llhttp-9.patch"
+)
+
+src_configure() {
+ cat > setup.cfg <<-EOF || die
+ [build_ext]
+ use_system_llhttp = true
+ use_system_http_parser = true
+ cython_always = true
+ EOF
+}
+
+python_test() {
+ local EPYTEST_DESELECT=()
+
+ case ${EPYTHON} in
+ pypy3)
+ EPYTEST_DESELECT+=(
+ # error message mismatches
+ # https://github.com/MagicStack/httptools/issues/16#issuecomment-1114181747
+ tests/test_parser.py::TestResponseParser::test_parser_response_2
+ tests/test_parser.py::TestRequestParser::test_parser_request_4
+ tests/test_parser.py::TestUrlParser::test_parser_url_10
+ )
+ ;;
+ esac
+
+ rm -rf httptools || die
+ epytest tests
+}
diff --git a/dev-python/httptools/metadata.xml b/dev-python/httptools/metadata.xml
new file mode 100644
index 000000000000..01e4e994ac2d
--- /dev/null
+++ b/dev-python/httptools/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">MagicStack/httptools</remote-id>
+ <remote-id type="pypi">httptools</remote-id>
+ </upstream>
+</pkgmetadata>