dev-python/httpbin: Fix compat with werkzeug-2.1

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2022-04-07 11:09:55 +02:00
parent ad3dcc34ee
commit bce18f25da
3 changed files with 94 additions and 3 deletions

View File

@@ -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")

View File

@@ -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

View File

@@ -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
}