public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/httpbin/, dev-python/httpbin/files/
@ 2020-12-02  9:51 Michał Górny
  0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2020-12-02  9:51 UTC (permalink / raw
  To: gentoo-commits

commit:     e00d74a7cb0bec8ffcfb1b73afdd1e7ca68f809e
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Dec  2 09:45:52 2020 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Dec  2 09:51:01 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e00d74a7

dev-python/httpbin: Support dev-python/brotlicffi

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../httpbin/files/httpbin-0.7.0-brotlicffi.patch   | 43 ++++++++++++++++++++++
 dev-python/httpbin/httpbin-0.7.0-r2.ebuild         | 38 +++++++++++++++++++
 2 files changed, 81 insertions(+)

diff --git a/dev-python/httpbin/files/httpbin-0.7.0-brotlicffi.patch b/dev-python/httpbin/files/httpbin-0.7.0-brotlicffi.patch
new file mode 100644
index 00000000000..f74474a70aa
--- /dev/null
+++ b/dev-python/httpbin/files/httpbin-0.7.0-brotlicffi.patch
@@ -0,0 +1,43 @@
+From 69d1e62e69b7f886ebbb41b8e9aae62e76adf375 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Wed, 2 Dec 2020 10:42:52 +0100
+Subject: [PATCH] Replace brotlipy with brotlicffi
+
+The brotlipy package has been renamed to brotlicffi.  Update the imports
+and dependencies accordingly.  The major advanage of the new package
+is that it no longer collides with the Python bindings provided
+by brotli itself.
+---
+ httpbin/filters.py | 2 +-
+ setup.py           | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/httpbin/filters.py b/httpbin/filters.py
+index c6268b6..4deeaaa 100644
+--- a/httpbin/filters.py
++++ b/httpbin/filters.py
+@@ -10,7 +10,7 @@ This module provides response filter decorators.
+ import gzip as gzip2
+ import zlib
+ 
+-import brotli as _brotli
++import brotlicffi as _brotli
+ 
+ from six import BytesIO
+ from decimal import Decimal
+diff --git a/setup.py b/setup.py
+index 7f9956b..8e17ef3 100644
+--- a/setup.py
++++ b/setup.py
+@@ -34,7 +34,7 @@ setup(
+     packages=find_packages(),
+     include_package_data = True, # include files listed in MANIFEST.in
+     install_requires=[
+-        'Flask', 'MarkupSafe', 'decorator', 'itsdangerous', 'six', 'brotlipy',
++        'Flask', 'MarkupSafe', 'decorator', 'itsdangerous', 'six', 'brotlicffi',
+         'raven[flask]', 'werkzeug>=0.14.1'
+     ],
+ )
+-- 
+2.29.2
+

diff --git a/dev-python/httpbin/httpbin-0.7.0-r2.ebuild b/dev-python/httpbin/httpbin-0.7.0-r2.ebuild
new file mode 100644
index 00000000000..c498e61cfdb
--- /dev/null
+++ b/dev-python/httpbin/httpbin-0.7.0-r2.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6..9} 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="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos"
+
+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-0.14.1[${PYTHON_USEDEP}]"
+
+PATCHES=(
+	# do not import raven if it's not going to be used
+	# (upstream removed it completely in git anyway)
+	"${FILESDIR}"/httpbin-0.7.0-optional-raven.patch
+	# fix tests with new versions of werkzeug
+	"${FILESDIR}"/httpbin-0.7.0-test-werkzeug.patch
+	# use brotlicffi instead of brotlipy
+	"${FILESDIR}"/httpbin-0.7.0-brotlicffi.patch
+)
+
+distutils_enable_tests unittest


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/httpbin/, dev-python/httpbin/files/
@ 2022-02-22  9:38 Michał Górny
  0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2022-02-22  9:38 UTC (permalink / raw
  To: gentoo-commits

commit:     cde6996b2a49ab208fc7e498be1710bf8626cfd1
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 22 09:33:37 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Feb 22 09:38:26 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cde6996b

dev-python/httpbin: Strip raven from requirements too

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/httpbin/files/httpbin-0.7.0-brotlicffi.patch      |  2 +-
 dev-python/httpbin/files/httpbin-0.7.0-optional-raven.patch  | 12 ++++++++++++
 .../{httpbin-0.7.0-r2.ebuild => httpbin-0.7.0-r3.ebuild}     |  2 +-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/dev-python/httpbin/files/httpbin-0.7.0-brotlicffi.patch b/dev-python/httpbin/files/httpbin-0.7.0-brotlicffi.patch
index f74474a70aa1..8031ad72de5b 100644
--- a/dev-python/httpbin/files/httpbin-0.7.0-brotlicffi.patch
+++ b/dev-python/httpbin/files/httpbin-0.7.0-brotlicffi.patch
@@ -35,7 +35,7 @@ index 7f9956b..8e17ef3 100644
      install_requires=[
 -        'Flask', 'MarkupSafe', 'decorator', 'itsdangerous', 'six', 'brotlipy',
 +        'Flask', 'MarkupSafe', 'decorator', 'itsdangerous', 'six', 'brotlicffi',
-         'raven[flask]', 'werkzeug>=0.14.1'
+         'werkzeug>=0.14.1'
      ],
  )
 -- 

diff --git a/dev-python/httpbin/files/httpbin-0.7.0-optional-raven.patch b/dev-python/httpbin/files/httpbin-0.7.0-optional-raven.patch
index 8602ed7641be..5d626768bd27 100644
--- a/dev-python/httpbin/files/httpbin-0.7.0-optional-raven.patch
+++ b/dev-python/httpbin/files/httpbin-0.7.0-optional-raven.patch
@@ -17,3 +17,15 @@ diff -dupr a/httpbin/core.py b/httpbin/core.py
      sentry = Sentry(app, dsn=os.environ['SENTRY_DSN'])
  
  # Set up Bugsnag exception tracking, if desired. To use Bugsnag, install the
+diff --git a/setup.py b/setup.py
+index 7f9956b..3cab2ae 100644
+--- a/setup.py
++++ b/setup.py
+@@ -35,6 +35,6 @@ setup(
+     include_package_data = True, # include files listed in MANIFEST.in
+     install_requires=[
+         'Flask', 'MarkupSafe', 'decorator', 'itsdangerous', 'six', 'brotlipy',
+-        'raven[flask]', 'werkzeug>=0.14.1'
++        'werkzeug>=0.14.1'
+     ],
+ )

diff --git a/dev-python/httpbin/httpbin-0.7.0-r2.ebuild b/dev-python/httpbin/httpbin-0.7.0-r3.ebuild
similarity index 97%
rename from dev-python/httpbin/httpbin-0.7.0-r2.ebuild
rename to dev-python/httpbin/httpbin-0.7.0-r3.ebuild
index 8c04217f15d8..99f8b0295ddd 100644
--- a/dev-python/httpbin/httpbin-0.7.0-r2.ebuild
+++ b/dev-python/httpbin/httpbin-0.7.0-r3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/httpbin/, dev-python/httpbin/files/
@ 2023-10-02 15:16 Michał Górny
  0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2023-10-02 15:16 UTC (permalink / raw
  To: gentoo-commits

commit:     bf8c821587396b3d74ae78b54272e6f78abe055d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Oct  2 15:15:54 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Oct  2 15:15:54 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bf8c8215

dev-python/httpbin: Remove old

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/httpbin/Manifest                        |  1 -
 .../httpbin/files/httpbin-0.7.0-brotlicffi.patch   | 43 ----------------
 .../files/httpbin-0.7.0-optional-raven.patch       | 31 -----------
 .../files/httpbin-0.7.0-test-werkzeug.patch        | 19 -------
 .../httpbin/files/httpbin-0.7.0-werkzeug-2.1.patch | 32 ------------
 dev-python/httpbin/httpbin-0.7.0-r6.ebuild         | 60 ----------------------
 6 files changed, 186 deletions(-)

diff --git a/dev-python/httpbin/Manifest b/dev-python/httpbin/Manifest
index 41a187504240..0dc9fe2291fa 100644
--- a/dev-python/httpbin/Manifest
+++ b/dev-python/httpbin/Manifest
@@ -1,2 +1 @@
 DIST httpbin-0.10.1.tar.gz 107058 BLAKE2B a46732946fc3454e2ae71c4eec4f88521e190b736445c54f555021a273a75f57acbc9234237e6973a21fc3bf8f71d8c8b51d6422d719f03546ecd6887a20fe1b SHA512 e3b851253c347893a80e866e7d0188c572f2a87a540125de3d9cbe0b8c3f1ddfab2c60ee3ffde3fd7274fc662294c978c39b1b52acfd92c52fd552966da203be
-DIST httpbin-0.7.0.tar.gz 92613 BLAKE2B 59252df1d4d0ef853ec65263b472d3ba6c597336d844f9b457f2d0a009048d4222f715a7f6fb120aca00fa641d1687e302036dc151bd2fd67ba98cf5fc47a63a SHA512 82e80058b58943637e9f8191764cea79bf7a6e40f36069f9b5d3f908585dbef20a03ef070d1f865d350920b6e874a93a48a544b05c14ff4911038ec2c20f6f63

diff --git a/dev-python/httpbin/files/httpbin-0.7.0-brotlicffi.patch b/dev-python/httpbin/files/httpbin-0.7.0-brotlicffi.patch
deleted file mode 100644
index 8031ad72de5b..000000000000
--- a/dev-python/httpbin/files/httpbin-0.7.0-brotlicffi.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 69d1e62e69b7f886ebbb41b8e9aae62e76adf375 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
-Date: Wed, 2 Dec 2020 10:42:52 +0100
-Subject: [PATCH] Replace brotlipy with brotlicffi
-
-The brotlipy package has been renamed to brotlicffi.  Update the imports
-and dependencies accordingly.  The major advanage of the new package
-is that it no longer collides with the Python bindings provided
-by brotli itself.
----
- httpbin/filters.py | 2 +-
- setup.py           | 2 +-
- 3 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/httpbin/filters.py b/httpbin/filters.py
-index c6268b6..4deeaaa 100644
---- a/httpbin/filters.py
-+++ b/httpbin/filters.py
-@@ -10,7 +10,7 @@ This module provides response filter decorators.
- import gzip as gzip2
- import zlib
- 
--import brotli as _brotli
-+import brotlicffi as _brotli
- 
- from six import BytesIO
- from decimal import Decimal
-diff --git a/setup.py b/setup.py
-index 7f9956b..8e17ef3 100644
---- a/setup.py
-+++ b/setup.py
-@@ -34,7 +34,7 @@ setup(
-     packages=find_packages(),
-     include_package_data = True, # include files listed in MANIFEST.in
-     install_requires=[
--        'Flask', 'MarkupSafe', 'decorator', 'itsdangerous', 'six', 'brotlipy',
-+        'Flask', 'MarkupSafe', 'decorator', 'itsdangerous', 'six', 'brotlicffi',
-         'werkzeug>=0.14.1'
-     ],
- )
--- 
-2.29.2
-

diff --git a/dev-python/httpbin/files/httpbin-0.7.0-optional-raven.patch b/dev-python/httpbin/files/httpbin-0.7.0-optional-raven.patch
deleted file mode 100644
index 5d626768bd27..000000000000
--- a/dev-python/httpbin/files/httpbin-0.7.0-optional-raven.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-diff -dupr a/httpbin/core.py b/httpbin/core.py
---- a/httpbin/core.py	2018-05-08 13:41:03.000000000 +0200
-+++ b/httpbin/core.py	2019-11-22 15:07:27.516500217 +0100
-@@ -21,7 +21,6 @@ from werkzeug.datastructures import WWWA
- from werkzeug.http import http_date
- from werkzeug.wrappers import BaseResponse
- from werkzeug.http import parse_authorization_header
--from raven.contrib.flask import Sentry
- 
- from . import filters
- from .helpers import get_headers, status_code, get_dict, get_request_range, check_basic_auth, check_digest_auth, \
-@@ -58,6 +57,7 @@ app.debug = bool(os.environ.get('DEBUG')
- 
- # Send app errors to Sentry.
- if 'SENTRY_DSN' in os.environ:
-+    from raven.contrib.flask import Sentry
-     sentry = Sentry(app, dsn=os.environ['SENTRY_DSN'])
- 
- # Set up Bugsnag exception tracking, if desired. To use Bugsnag, install the
-diff --git a/setup.py b/setup.py
-index 7f9956b..3cab2ae 100644
---- a/setup.py
-+++ b/setup.py
-@@ -35,6 +35,6 @@ setup(
-     include_package_data = True, # include files listed in MANIFEST.in
-     install_requires=[
-         'Flask', 'MarkupSafe', 'decorator', 'itsdangerous', 'six', 'brotlipy',
--        'raven[flask]', 'werkzeug>=0.14.1'
-+        'werkzeug>=0.14.1'
-     ],
- )

diff --git a/dev-python/httpbin/files/httpbin-0.7.0-test-werkzeug.patch b/dev-python/httpbin/files/httpbin-0.7.0-test-werkzeug.patch
deleted file mode 100644
index 956a2f5235ca..000000000000
--- a/dev-python/httpbin/files/httpbin-0.7.0-test-werkzeug.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff -dupr a/test_httpbin.py b/test_httpbin.py
---- a/test_httpbin.py	2019-11-22 15:06:56.199774070 +0100
-+++ b/test_httpbin.py	2019-11-22 15:18:58.010069445 +0100
-@@ -144,7 +144,6 @@ class HttpbinTestCase(unittest.TestCase)
-         data = json.loads(response.data.decode('utf-8'))
-         self.assertEqual(data['args'], {})
-         self.assertEqual(data['headers']['Host'], 'localhost')
--        self.assertEqual(data['headers']['Content-Length'], '0')
-         self.assertEqual(data['headers']['User-Agent'], 'test')
-         # self.assertEqual(data['origin'], None)
-         self.assertEqual(data['url'], 'http://localhost/get')
-@@ -158,7 +157,6 @@ class HttpbinTestCase(unittest.TestCase)
-         data = json.loads(response.data.decode('utf-8'))
-         self.assertEqual(data['args'], {})
-         self.assertEqual(data['headers']['Host'], 'localhost')
--        self.assertEqual(data['headers']['Content-Length'], '0')
-         self.assertEqual(data['url'], 'http://localhost/anything/foo/bar')
-         self.assertEqual(data['method'], 'GET')
-         self.assertTrue(response.data.endswith(b'\n'))

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
deleted file mode 100644
index cf7871268d99..000000000000
--- a/dev-python/httpbin/files/httpbin-0.7.0-werkzeug-2.1.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-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-r6.ebuild b/dev-python/httpbin/httpbin-0.7.0-r6.ebuild
deleted file mode 100644
index b905561d50cc..000000000000
--- a/dev-python/httpbin/httpbin-0.7.0-r6.ebuild
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{10..12} pypy3 )
-
-inherit distutils-r1 pypi
-
-DESCRIPTION="HTTP Request and Response Service"
-HOMEPAGE="
-	https://github.com/postmanlabs/httpbin/
-	https://pypi.org/project/httpbin/
-"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~mips ppc ppc64 ~riscv ~s390 sparc 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-3[${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
-	# broken
-	sed -e 's:test_digest_auth:_&:' \
-		-e 's:test_base64:_&:' \
-		-i test_httpbin.py || die
-
-	distutils-r1_src_prepare
-}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/httpbin/, dev-python/httpbin/files/
@ 2024-02-03 10:41 Michał Górny
  0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2024-02-03 10:41 UTC (permalink / raw
  To: gentoo-commits

commit:     9a37a4262a07bac8acc24015287bef65596d5a4d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  3 10:32:44 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Feb  3 10:41:29 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9a37a426

dev-python/httpbin: Make dev-python/flasgger dep optional

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../files/httpbin-0.10.1-optional-flasgger.patch   | 87 ++++++++++++++++++++++
 ...n-0.10.1-r3.ebuild => httpbin-0.10.1-r4.ebuild} | 23 ++++--
 2 files changed, 105 insertions(+), 5 deletions(-)

diff --git a/dev-python/httpbin/files/httpbin-0.10.1-optional-flasgger.patch b/dev-python/httpbin/files/httpbin-0.10.1-optional-flasgger.patch
new file mode 100644
index 000000000000..c3d87ec4144d
--- /dev/null
+++ b/dev-python/httpbin/files/httpbin-0.10.1-optional-flasgger.patch
@@ -0,0 +1,87 @@
+From 65e397d7332ab87e3b2455ff9dc99af24861b58b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sat, 3 Feb 2024 11:20:00 +0100
+Subject: [PATCH] Support using httpbin without flasgger
+
+Make the dependency on flasgger optional.  The dependency has been added
+relatively recently (i.e. before the original package was abandoned but
+after its last release), and it is only used to provide a more dynamic
+landing page.  This is unnecessary for use of httpbin for testing,
+and it introduces an indirect dependency on Rust that is problematic.
+
+With this change, flasgger is no longer installed by default.  It can be
+enabled via "[flasgger]" extra.  When flasgger is not available, httpbin
+redirects to the "legacy" index page.
+---
+ httpbin/core.py       | 17 +++++++++++++++--
+ pyproject.toml        |  4 +++-
+ tests/test_httpbin.py |  4 +++-
+ 3 files changed, 21 insertions(+), 4 deletions(-)
+
+diff --git a/httpbin/core.py b/httpbin/core.py
+index a82c1b8..77576a4 100644
+--- a/httpbin/core.py
++++ b/httpbin/core.py
+@@ -33,7 +33,10 @@ try:
+ except ImportError:  # werkzeug < 2.1
+     from werkzeug.wrappers import BaseResponse as Response
+ 
+-from flasgger import Swagger, NO_SANITIZER
++try:
++    from flasgger import Swagger, NO_SANITIZER
++except ImportError:
++    Swagger = None
+ 
+ from . import filters
+ from .helpers import (
+@@ -165,7 +168,10 @@ swagger_config = {
+     "specs_route": "/",
+ }
+ 
+-swagger = Swagger(app, sanitizer=NO_SANITIZER, template=template, config=swagger_config)
++if Swagger is not None:
++    swagger = Swagger(app, sanitizer=NO_SANITIZER, template=template, config=swagger_config)
++else:
++    app.logger.warning("Swagger not found, legacy index will be used.")
+ 
+ # Set up Bugsnag exception tracking, if desired. To use Bugsnag, install the
+ # Bugsnag Python client with the command "pip install bugsnag", and set the
+@@ -244,6 +250,13 @@ def set_cors_headers(response):
+ # ------
+ 
+ 
++if Swagger is None:
++    @app.route("/")
++    def no_flasgger_index():
++        """Redirect to legacy index if flasgger is not available."""
++        return redirect(url_for("view_landing_page"))
++
++
+ @app.route("/legacy")
+ def view_landing_page():
+     """Generates Landing Page in legacy layout."""
+diff --git a/tests/test_httpbin.py b/tests/test_httpbin.py
+index 6b75124..2ce63a6 100755
+--- a/tests/test_httpbin.py
++++ b/tests/test_httpbin.py
+@@ -10,6 +10,7 @@ from hashlib import md5, sha256, sha512
+ from io import BytesIO
+ 
+ import httpbin
++from httpbin.core import Swagger
+ from httpbin.helpers import parse_multi_value_header
+ 
+ 
+@@ -115,7 +116,8 @@ class HttpbinTestCase(unittest.TestCase):
+ 
+     def test_index(self):   
+         response = self.app.get('/', headers={'User-Agent': 'test'})
+-        self.assertEqual(response.status_code, 200)
++        self.assertEqual(response.status_code,
++                         200 if Swagger is not None else 302)
+  
+     def get_data(self, response):
+         if 'get_data' in dir(response):
+-- 
+2.43.0
+

diff --git a/dev-python/httpbin/httpbin-0.10.1-r3.ebuild b/dev-python/httpbin/httpbin-0.10.1-r4.ebuild
similarity index 65%
rename from dev-python/httpbin/httpbin-0.10.1-r3.ebuild
rename to dev-python/httpbin/httpbin-0.10.1-r4.ebuild
index 5d029ef8a9f6..d34c543e7976 100644
--- a/dev-python/httpbin/httpbin-0.10.1-r3.ebuild
+++ b/dev-python/httpbin/httpbin-0.10.1-r4.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -6,7 +6,7 @@ EAPI=8
 DISTUTILS_USE_PEP517=setuptools
 PYTHON_COMPAT=( python3_{10..12} pypy3 )
 
-inherit distutils-r1 pypi
+inherit distutils-r1 optfeature pypi
 
 DESCRIPTION="HTTP Request and Response Service"
 HOMEPAGE="
@@ -17,16 +17,23 @@ HOMEPAGE="
 LICENSE="|| ( MIT ISC )"
 SLOT="0"
 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~mips ppc ppc64 ~riscv ~s390 sparc x86"
+IUSE="test-rust"
 
 RDEPEND="
 	dev-python/brotlicffi[${PYTHON_USEDEP}]
 	dev-python/decorator[${PYTHON_USEDEP}]
-	dev-python/flasgger[${PYTHON_USEDEP}]
 	>=dev-python/flask-2.2.4[${PYTHON_USEDEP}]
 	dev-python/itsdangerous[${PYTHON_USEDEP}]
 	dev-python/markupsafe[${PYTHON_USEDEP}]
 	dev-python/six[${PYTHON_USEDEP}]
 "
+BDEPEND="
+	test? (
+		test-rust? (
+			dev-python/flasgger[${PYTHON_USEDEP}]
+		)
+	)
+"
 
 distutils_enable_tests pytest
 
@@ -34,9 +41,15 @@ src_prepare() {
 	local PATCHES=(
 		# https://github.com/psf/httpbin/pull/29
 		"${FILESDIR}/${P}-werkzeug-3.patch"
+		# https://github.com/psf/httpbin/pull/44 (simplified)
+		"${FILESDIR}/${P}-optional-flasgger.patch"
 	)
 
-	# unpin greenlet
-	sed -i -e '/greenlet/d' pyproject.toml || die
+	# remove unnecessary deps
+	sed -i -e '/greenlet/d' -e '/flasgger/d' pyproject.toml || die
 	distutils-r1_src_prepare
 }
+
+pkg_postinst() {
+	optfeature "Fancy index" dev-python/flasgger
+}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/httpbin/, dev-python/httpbin/files/
@ 2024-09-06  9:25 Michał Górny
  0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2024-09-06  9:25 UTC (permalink / raw
  To: gentoo-commits

commit:     389cfb3a33a03514a53d0918e9398822f82884d7
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  6 03:14:03 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Sep  6 09:25:07 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=389cfb3a

dev-python/httpbin: Remove the annoying swagger warning

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/httpbin/files/httpbin-0.10.1-optional-flasgger.patch       | 4 +---
 .../httpbin/{httpbin-0.10.2.ebuild => httpbin-0.10.2-r1.ebuild}       | 0
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/dev-python/httpbin/files/httpbin-0.10.1-optional-flasgger.patch b/dev-python/httpbin/files/httpbin-0.10.1-optional-flasgger.patch
index d4695173dad5..b9f5cc6f8469 100644
--- a/dev-python/httpbin/files/httpbin-0.10.1-optional-flasgger.patch
+++ b/dev-python/httpbin/files/httpbin-0.10.1-optional-flasgger.patch
@@ -34,15 +34,13 @@ index a82c1b8..77576a4 100644
  
  from . import filters
  from .helpers import (
-@@ -165,7 +168,10 @@ swagger_config = {
+@@ -165,7 +168,8 @@ swagger_config = {
      "specs_route": "/",
  }
  
 -swagger = Swagger(app, sanitizer=NO_SANITIZER, template=template, config=swagger_config)
 +if Swagger is not None:
 +    swagger = Swagger(app, sanitizer=NO_SANITIZER, template=template, config=swagger_config)
-+else:
-+    app.logger.warning("Swagger not found, legacy index will be used.")
  
  # Set up Bugsnag exception tracking, if desired. To use Bugsnag, install the
  # Bugsnag Python client with the command "pip install bugsnag", and set the

diff --git a/dev-python/httpbin/httpbin-0.10.2.ebuild b/dev-python/httpbin/httpbin-0.10.2-r1.ebuild
similarity index 100%
rename from dev-python/httpbin/httpbin-0.10.2.ebuild
rename to dev-python/httpbin/httpbin-0.10.2-r1.ebuild


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-09-06  9:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-02 15:16 [gentoo-commits] repo/gentoo:master commit in: dev-python/httpbin/, dev-python/httpbin/files/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2024-09-06  9:25 Michał Górny
2024-02-03 10:41 Michał Górny
2022-02-22  9:38 Michał Górny
2020-12-02  9:51 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox