summaryrefslogtreecommitdiff
path: root/dev-python
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-04-07 11:09:55 +0200
committerMichał Górny <mgorny@gentoo.org>2022-04-07 11:12:53 +0200
commitbce18f25da9def0bc03a6c5a354c85c3badd6e4f (patch)
treeccdaf4f65edf7a33de5c506f98409000fba8c060 /dev-python
parentad3dcc34ee41c1eb8423374c9531d94a38531812 (diff)
downloadgentoo-bce18f25da9def0bc03a6c5a354c85c3badd6e4f.tar.gz
gentoo-bce18f25da9def0bc03a6c5a354c85c3badd6e4f.tar.bz2
gentoo-bce18f25da9def0bc03a6c5a354c85c3badd6e4f.zip
dev-python/httpbin: Fix compat with werkzeug-2.1
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python')
-rw-r--r--dev-python/httpbin/files/httpbin-0.7.0-werkzeug-2.1.patch32
-rw-r--r--dev-python/httpbin/httpbin-0.7.0-r4.ebuild9
-rw-r--r--dev-python/httpbin/httpbin-0.7.0-r5.ebuild56
3 files changed, 94 insertions, 3 deletions
diff --git a/dev-python/httpbin/files/httpbin-0.7.0-werkzeug-2.1.patch b/dev-python/httpbin/files/httpbin-0.7.0-werkzeug-2.1.patch
new file mode 100644
index 000000000000..cf7871268d99
--- /dev/null
+++ b/dev-python/httpbin/files/httpbin-0.7.0-werkzeug-2.1.patch
@@ -0,0 +1,32 @@
+From 5cc81ce87a3c447a127e4a1a707faf9f3b1c9b6b Mon Sep 17 00:00:00 2001
+From: Maximino BOGADO <bogamax2@hotmail.fr>
+Date: Wed, 30 Mar 2022 16:26:31 +0200
+Subject: [PATCH] Replace BaseResponse to Response class (new werkzeug version
+ 2.1.0)
+
+---
+ httpbin/core.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/httpbin/core.py b/httpbin/core.py
+index 305c9882..2bad408e 100644
+--- a/httpbin/core.py
++++ b/httpbin/core.py
+@@ -29,7 +29,7 @@
+ from six.moves import range as xrange
+ from werkzeug.datastructures import WWWAuthenticate, MultiDict
+ from werkzeug.http import http_date
+-from werkzeug.wrappers import BaseResponse
++from werkzeug.wrappers import Response
+ from werkzeug.http import parse_authorization_header
+ from flasgger import Swagger, NO_SANITIZER
+
+@@ -77,7 +77,7 @@ def jsonify(*args, **kwargs):
+
+
+ # Prevent WSGI from correcting the casing of the Location header
+-BaseResponse.autocorrect_location_header = False
++Response.autocorrect_location_header = False
+
+ # Find the correct template folder when running from a different location
+ tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "templates")
diff --git a/dev-python/httpbin/httpbin-0.7.0-r4.ebuild b/dev-python/httpbin/httpbin-0.7.0-r4.ebuild
index df999b5429a0..7750896348d1 100644
--- a/dev-python/httpbin/httpbin-0.7.0-r4.ebuild
+++ b/dev-python/httpbin/httpbin-0.7.0-r4.ebuild
@@ -9,8 +9,10 @@ PYTHON_COMPAT=( python3_{8..10} pypy3 )
inherit distutils-r1
DESCRIPTION="HTTP Request and Response Service"
-HOMEPAGE="https://github.com/postmanlabs/httpbin
- https://pypi.org/project/httpbin/"
+HOMEPAGE="
+ https://github.com/postmanlabs/httpbin/
+ https://pypi.org/project/httpbin/
+"
SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
LICENSE="MIT"
@@ -24,7 +26,8 @@ RDEPEND="
dev-python/itsdangerous[${PYTHON_USEDEP}]
dev-python/markupsafe[${PYTHON_USEDEP}]
dev-python/six[${PYTHON_USEDEP}]
- >=dev-python/werkzeug-0.14.1[${PYTHON_USEDEP}]"
+ <dev-python/werkzeug-2.1[${PYTHON_USEDEP}]
+"
PATCHES=(
# do not import raven if it's not going to be used
diff --git a/dev-python/httpbin/httpbin-0.7.0-r5.ebuild b/dev-python/httpbin/httpbin-0.7.0-r5.ebuild
new file mode 100644
index 000000000000..83c8c6aab6f8
--- /dev/null
+++ b/dev-python/httpbin/httpbin-0.7.0-r5.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{8..10} pypy3 )
+
+inherit distutils-r1
+
+DESCRIPTION="HTTP Request and Response Service"
+HOMEPAGE="
+ https://github.com/postmanlabs/httpbin/
+ https://pypi.org/project/httpbin/
+"
+SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~m68k ~riscv ~x86"
+
+RDEPEND="
+ dev-python/brotlicffi[${PYTHON_USEDEP}]
+ dev-python/decorator[${PYTHON_USEDEP}]
+ dev-python/flask[${PYTHON_USEDEP}]
+ dev-python/itsdangerous[${PYTHON_USEDEP}]
+ dev-python/markupsafe[${PYTHON_USEDEP}]
+ dev-python/six[${PYTHON_USEDEP}]
+ >=dev-python/werkzeug-2.0[${PYTHON_USEDEP}]
+"
+
+PATCHES=(
+ # do not import raven if it's not going to be used
+ # (upstream removed it completely in git anyway)
+ "${FILESDIR}"/${P}-optional-raven.patch
+ # fix tests with new versions of werkzeug
+ "${FILESDIR}"/${P}-test-werkzeug.patch
+ # use brotlicffi instead of brotlipy
+ "${FILESDIR}"/${P}-brotlicffi.patch
+ # fix compat with werkzeug 2.1
+ # https://github.com/postmanlabs/httpbin/pull/674
+ "${FILESDIR}"/${P}-werkzeug-2.1.patch
+)
+
+distutils_enable_tests unittest
+
+src_prepare() {
+ # a new version of flask or whatever converts relative redirects
+ # to absolute; this package is dead anyway, so just skip
+ # the relevant tests
+ sed -e 's:test_redirect:_&:' \
+ -e 's:test_relative:_&:' \
+ -i test_httpbin.py || die
+
+ distutils-r1_src_prepare
+}