[packages/python3-httptools] - new
qboosh
qboosh at pld-linux.org
Mon Mar 11 21:33:11 CET 2024
commit f80070bbd6700332dc9f041ca569f0f7f8ef7a53
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Mon Mar 11 21:24:35 2024 +0100
- new
httptools-tests-cr.patch | 30 +++++++++++++++++++
python3-httptools.spec | 78 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 108 insertions(+)
---
diff --git a/python3-httptools.spec b/python3-httptools.spec
new file mode 100644
index 0000000..411d14e
--- /dev/null
+++ b/python3-httptools.spec
@@ -0,0 +1,78 @@
+#
+# Conditional build:
+%bcond_without tests # unit tests
+
+Summary: Python binding for the nodejs HTTP parser
+Summary(pl.UTF-8): Wiązanie Pythona do parsera HTTP z nodejs
+Name: python3-httptools
+Version: 0.6.1
+Release: 1
+License: MIT
+Group: Libraries/Python
+#Source0Download: https://pypi.org/simple/httptools/
+Source0: https://files.pythonhosted.org/packages/source/h/httptools/httptools-%{version}.tar.gz
+# Source0-md5: cb8a0c39723c10bdcf8c13d364d60b7c
+Patch0: httptools-tests-cr.patch
+URL: https://pypi.org/project/httptools/
+BuildRequires: http-parser-devel >= 2.9.4
+BuildRequires: llhttp-devel >= 8.1.1
+BuildRequires: python3-Cython >= 0.29.24
+BuildRequires: python3-Cython < 0.30
+BuildRequires: python3-modules >= 1:3.8
+BuildRequires: python3-setuptools
+%if %{with tests}
+BuildRequires: python3-pytest
+%endif
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.714
+Requires: http-parser >= 2.9.4
+Requires: llhttp >= 8.1.1
+Requires: python3-modules >= 1:3.8
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+httptools is a Python binding for the nodejs HTTP parser.
+
+%description -l pl.UTF-8
+httptools to wiązanie Pythona do parsera HTTP z nodejs.
+
+%prep
+%setup -q -n httptools-%{version}
+%patch0 -p1
+
+%build
+%py3_build build_ext \
+ --use-system-http-parser \
+ --use-system-llhttp
+
+%if %{with tests}
+# change dir to hide httptools source dir
+cd build-3
+ln -sf ../tests tests
+
+LC_ALL=C.UTF-8 \
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTEST_PLUGINS= \
+PYTHONPATH=$(echo $(pwd)/lib.linux-*) \
+%{__python3} -m pytest tests
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%py3_install
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc LICENSE README.md
+%dir %{py3_sitedir}/httptools
+%{py3_sitedir}/httptools/*.py
+%{py3_sitedir}/httptools/__pycache__
+%dir %{py3_sitedir}/httptools/parser
+%attr(755,root,root) %{py3_sitedir}/httptools/parser/*.cpython-*.so
+%{py3_sitedir}/httptools/parser/*.py
+%{py3_sitedir}/httptools/parser/__pycache__
+%{py3_sitedir}/httptools-%{version}-py*.egg-info
diff --git a/httptools-tests-cr.patch b/httptools-tests-cr.patch
new file mode 100644
index 0000000..4d5384b
--- /dev/null
+++ b/httptools-tests-cr.patch
@@ -0,0 +1,30 @@
+Missing CR causes "Invalid header field char" error with llhttp 9.2.0
+--- httptools-0.6.1/tests/test_parser.py.orig 2023-10-16 19:31:12.000000000 +0200
++++ httptools-0.6.1/tests/test_parser.py 2024-03-11 20:49:42.077120716 +0100
+@@ -33,7 +33,7 @@ CHUNKED_REQUEST1_1 = b'''POST /test.php?
+ 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 +42,7 @@ CHUNKED_REQUEST1_3 = b'''POST /test.php?
+ 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 +54,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
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python3-httptools.git/commitdiff/f80070bbd6700332dc9f041ca569f0f7f8ef7a53
More information about the pld-cvs-commit
mailing list