From 94fdb74ebd1957c8bcae88829095d24271834643 Mon Sep 17 00:00:00 2001 From: Julien Roy Date: Sun, 5 Feb 2023 00:27:30 -0500 Subject: dev-python/multipart: new package, add 0.2.4 Signed-off-by: Julien Roy --- dev-python/multipart/Manifest | 1 + .../files/multipart-urlencoded-test.patch | 35 ++++++++++++++++++++++ dev-python/multipart/metadata.xml | 20 +++++++++++++ dev-python/multipart/multipart-0.2.4.ebuild | 28 +++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 dev-python/multipart/Manifest create mode 100644 dev-python/multipart/files/multipart-urlencoded-test.patch create mode 100644 dev-python/multipart/metadata.xml create mode 100644 dev-python/multipart/multipart-0.2.4.ebuild (limited to 'dev-python/multipart') diff --git a/dev-python/multipart/Manifest b/dev-python/multipart/Manifest new file mode 100644 index 0000000..0478ead --- /dev/null +++ b/dev-python/multipart/Manifest @@ -0,0 +1 @@ +DIST multipart-0.2.4.gh.tar.gz 21558 BLAKE2B c954eb8ff9288c65f45d94035fb5e0a7e59576fd54290678b764f62254a51b964e4a0292c8f8cc6e3945007d6abb8c52c7075af8dd6d94d57caaf98d43505c95 SHA512 5a0cbcbbfc3232257a607892d5d2176e03ff9c7056d146b99ba1e8067c8736f2e38676e08622d5100cf85b172affbfbd8938da92819e39fc4739184f666a14ed diff --git a/dev-python/multipart/files/multipart-urlencoded-test.patch b/dev-python/multipart/files/multipart-urlencoded-test.patch new file mode 100644 index 0000000..e47f692 --- /dev/null +++ b/dev-python/multipart/files/multipart-urlencoded-test.patch @@ -0,0 +1,35 @@ +From 4d4ac6b79c453918ebf40c690e8d57d982ee840b Mon Sep 17 00:00:00 2001 +From: Colin Watson +Date: Fri, 9 Apr 2021 16:54:49 +0100 +Subject: [PATCH] Don't test semicolon separators in urlencoded data + +Python no longer accepts ";" as a separator for `urllib.parse.parse_qs` +by default (https://bugs.python.org/issue42967), causing the multipart +test suite to fail with recent Python versions (3.6.13, 3.7.10, 3.8.8, +3.9.2, 3.10.0a6). + +While we could detect the availability of the `separator` argument and +pass it, since `application/x-www-form-urlencoded` data in `POST` and +`PUT` requests is probably not an issue for web cache poisoning, the +current HTML spec seems clear that only "&" should be considered, so +follow along with Python's API change. +--- + test/test_multipart.py | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/test/test_multipart.py b/test/test_multipart.py +index 38c69d1..6fe864f 100644 +--- a/test/test_multipart.py ++++ b/test/test_multipart.py +@@ -233,10 +233,9 @@ def test_empty(self): + def test_urlencoded(self): + for ctype in ('application/x-www-form-urlencoded', 'application/x-url-encoded'): + self.env['CONTENT_TYPE'] = ctype +- forms, files = self.parse('a=b&c=d;e=f') ++ forms, files = self.parse('a=b&c=d') + self.assertEqual(forms['a'], 'b') + self.assertEqual(forms['c'], 'd') +- self.assertEqual(forms['e'], 'f') + + def test_urlencoded_latin1(self): + for ctype in ('application/x-www-form-urlencoded', 'application/x-url-encoded'): diff --git a/dev-python/multipart/metadata.xml b/dev-python/multipart/metadata.xml new file mode 100644 index 0000000..f59dd1e --- /dev/null +++ b/dev-python/multipart/metadata.xml @@ -0,0 +1,20 @@ + + + + + Julien Roy + julien@jroy.ca + + + This module provides a parser for the multipart/form-data format. It can read from a file, a socket or a WSGI environment. The parser can be used to replace cgi.FieldStorage to work around its limitations. + + + + Marcel Hellkamp + marc@gsites.de + + https://github.com/defnull/multipart/issues + defnull/multipart + multipart + + diff --git a/dev-python/multipart/multipart-0.2.4.ebuild b/dev-python/multipart/multipart-0.2.4.ebuild new file mode 100644 index 0000000..a9c97cc --- /dev/null +++ b/dev-python/multipart/multipart-0.2.4.ebuild @@ -0,0 +1,28 @@ +# Copyright 2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{9..11} pypy3 ) + +inherit distutils-r1 + +DESCRIPTION="Multipart parser for Python 3" +HOMEPAGE="https://github.com/defnull/multipart" +SRC_URI="https://github.com/defnull/multipart/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" + +distutils_enable_tests unittest + +PATCHES=( + "${FILESDIR}/multipart-urlencoded-test.patch" +) + +src_test() { + cd "${S}/test" || die + distutils-r1_src_test +} -- cgit v1.2.3