void-packages/srcpkgs/python3-httpbin/patches/brotli.patch

43 lines
1.1 KiB
Diff

https://github.com/psf/httpbin/pull/31
From 7ab2459cbca7cf2266e275ecbff80533f52f4f58 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 17 Oct 2023 09:09:18 -0400
Subject: [PATCH] Use brotli with CPython, brotlicffi elsewhere
---
httpbin/filters.py | 5 ++++-
pyproject.toml | 3 ++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/httpbin/filters.py b/httpbin/filters.py
index 4deeaaad..933a8b96 100644
--- a/httpbin/filters.py
+++ b/httpbin/filters.py
@@ -10,7 +10,10 @@
import gzip as gzip2
import zlib
-import brotlicffi as _brotli
+try:
+ import brotlicffi as _brotli
+except ImportError:
+ import brotli as _brotli
from six import BytesIO
from decimal import Decimal
diff --git a/pyproject.toml b/pyproject.toml
index c5bdb811..f0aaf871 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -31,7 +31,8 @@ classifiers = [
"Programming Language :: Python :: 3.12",
]
dependencies = [
- "brotlicffi",
+ "brotli; platform_python_implementation == 'CPython'",
+ "brotlicffi; platform_python_implementation != 'CPython'",
"decorator",
"flasgger",
"flask >= 2.2.4",