Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/requests-cache/files/, dev-python/requests-cache/
Date: Wed, 03 Aug 2022 07:04:45
Message-Id: 1659510220.727545c519049c0ae0352200a804e65ee28dc66f.mgorny@gentoo
1 commit: 727545c519049c0ae0352200a804e65ee28dc66f
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Aug 3 07:03:40 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 3 07:03:40 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=727545c5
7
8 dev-python/requests-cache: Remove old
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/requests-cache/Manifest | 1 -
13 .../files/requests-cache-0.9.3-cattrs-22.patch | 150 ---------------------
14 .../requests-cache/requests-cache-0.9.4.ebuild | 81 -----------
15 3 files changed, 232 deletions(-)
16
17 diff --git a/dev-python/requests-cache/Manifest b/dev-python/requests-cache/Manifest
18 index 1c63fb6def33..d2c56a578588 100644
19 --- a/dev-python/requests-cache/Manifest
20 +++ b/dev-python/requests-cache/Manifest
21 @@ -1,2 +1 @@
22 -DIST requests-cache-0.9.4.gh.tar.gz 1541821 BLAKE2B 90f3ffe8f4213a47d19c1190f1201bb484473a4ee2fae82dff59c9e80bc8c154739e99f5024aa55b436f9e620d5594441df61e2db44e3cbb381d394c1b6b4a0b SHA512 66023dc8b153070a532f160af58ac2102f6b9d536a0045c4c62ad1d4175f59df6e7db5a25422f5610a2f17049270ad0b63c6023ddddf64235432a63d2cce9b91
23 DIST requests-cache-0.9.5.gh.tar.gz 1542034 BLAKE2B 01996e7536ce967dee2b909091d1eb08501b3882b6171a5460b2196666eed848dec89a85ef8ea0c892b2fd153f90107948239de04b973e7766d3acfad7b10059 SHA512 de1481ff609f3ff36ed662d986fb86a500a8d26755832478a9a4396f2c71934b5f65540137b92365eb36f66087b3fbc1cd72c63d37546d09c86bbee7340fd8eb
24
25 diff --git a/dev-python/requests-cache/files/requests-cache-0.9.3-cattrs-22.patch b/dev-python/requests-cache/files/requests-cache-0.9.3-cattrs-22.patch
26 deleted file mode 100644
27 index 258738158355..000000000000
28 --- a/dev-python/requests-cache/files/requests-cache-0.9.3-cattrs-22.patch
29 +++ /dev/null
30 @@ -1,150 +0,0 @@
31 -From 7917ba0dd12901d88137d3f8b487307eda38d326 Mon Sep 17 00:00:00 2001
32 -From: Jordan Cook <jordan.cook@×××××××.com>
33 -Date: Sat, 9 Apr 2022 13:33:32 -0500
34 -Subject: [PATCH] Add compatibility with cattrs 21.1+, and clean up preconf
35 - module a bit
36 -
37 ----
38 - requests_cache/__init__.py | 2 +-
39 - requests_cache/serializers/preconf.py | 89 +++++++++++++++------------
40 - 2 files changed, 49 insertions(+), 42 deletions(-)
41 -
42 -diff --git a/requests_cache/__init__.py b/requests_cache/__init__.py
43 -index 87781ba..835586c 100644
44 ---- a/requests_cache/__init__.py
45 -+++ b/requests_cache/__init__.py
46 -@@ -17,4 +17,4 @@ try:
47 - from .session import *
48 - # Log and ignore ImportErrors, if imported outside a virtualenv (e.g., just to check __version__)
49 - except ImportError as e:
50 -- logger.warning(e)
51 -+ logger.warning(e, exc_info=True)
52 -diff --git a/requests_cache/serializers/preconf.py b/requests_cache/serializers/preconf.py
53 -index ed19fb4..cb099b8 100644
54 ---- a/requests_cache/serializers/preconf.py
55 -+++ b/requests_cache/serializers/preconf.py
56 -@@ -1,3 +1,4 @@
57 -+# flake8: noqa: F841
58 - """The ``cattrs`` library includes a number of `pre-configured converters
59 - <https://cattrs.readthedocs.io/en/latest/preconf.html>`_ that perform some pre-serialization steps
60 - required for specific serialization formats.
61 -@@ -14,69 +15,75 @@ class that raises an ``ImportError`` at initialization time instead of at import
62 - """
63 - import pickle
64 - from functools import partial
65 --
66 --from cattr.preconf import bson as bson_preconf
67 --from cattr.preconf import json as json_preconf
68 --from cattr.preconf import msgpack, orjson, pyyaml, tomlkit, ujson
69 -+from importlib import import_module
70 -
71 - from .._utils import get_placeholder_class
72 - from .cattrs import CattrStage
73 - from .pipeline import SerializerPipeline, Stage
74 -
75 --base_stage = (
76 -- CattrStage()
77 --) #: Base stage for all serializer pipelines (or standalone dict serializer)
78 -+
79 -+def make_stage(preconf_module: str):
80 -+ """Create a preconf serializer stage from a module name, if dependencies are installed"""
81 -+ try:
82 -+ return CattrStage(import_module(preconf_module).make_converter)
83 -+ except ImportError as e:
84 -+ return get_placeholder_class(e)
85 -+
86 -+
87 -+base_stage = CattrStage() #: Base stage for all serializer pipelines
88 - dict_serializer = base_stage #: Partial serializer that unstructures responses into dicts
89 --bson_preconf_stage = CattrStage(bson_preconf.make_converter) #: Pre-serialization steps for BSON
90 --json_preconf_stage = CattrStage(json_preconf.make_converter) #: Pre-serialization steps for JSON
91 --msgpack_preconf_stage = CattrStage(msgpack.make_converter) #: Pre-serialization steps for msgpack
92 --orjson_preconf_stage = CattrStage(orjson.make_converter) #: Pre-serialization steps for orjson
93 --yaml_preconf_stage = CattrStage(pyyaml.make_converter) #: Pre-serialization steps for YAML
94 --toml_preconf_stage = CattrStage(tomlkit.make_converter) #: Pre-serialization steps for TOML
95 --ujson_preconf_stage = CattrStage(ujson.make_converter) #: Pre-serialization steps for ultrajson
96 --pickle_serializer = SerializerPipeline(
97 -- [base_stage, pickle], is_binary=True
98 --) #: Complete pickle serializer
99 -+pickle_serializer = SerializerPipeline([base_stage, pickle], is_binary=True) #: Pickle serializer
100 - utf8_encoder = Stage(dumps=str.encode, loads=lambda x: x.decode()) #: Encode to bytes
101 -+bson_preconf_stage = make_stage('cattr.preconf.bson') #: Pre-serialization steps for BSON
102 -+json_preconf_stage = make_stage('cattr.preconf.json') #: Pre-serialization steps for JSON
103 -+msgpack_preconf_stage = make_stage('cattr.preconf.msgpack') #: Pre-serialization steps for msgpack
104 -+orjson_preconf_stage = make_stage('cattr.preconf.orjson') #: Pre-serialization steps for orjson
105 -+toml_preconf_stage = make_stage('cattr.preconf.tomlkit') #: Pre-serialization steps for TOML
106 -+ujson_preconf_stage = make_stage('cattr.preconf.ujson') #: Pre-serialization steps for ultrajson
107 -+yaml_preconf_stage = make_stage('cattr.preconf.pyyaml') #: Pre-serialization steps for YAML
108 -
109 -
110 - # Safe pickle serializer
111 --try:
112 -+def signer_stage(secret_key=None, salt='requests-cache') -> Stage:
113 -+ """Create a stage that uses ``itsdangerous`` to add a signature to responses on write, and
114 -+ validate that signature with a secret key on read. Can be used in a
115 -+ :py:class:`.SerializerPipeline` in combination with any other serialization steps.
116 -+ """
117 - from itsdangerous import Signer
118 -
119 -- def signer_stage(secret_key=None, salt='requests-cache') -> Stage:
120 -- """Create a stage that uses ``itsdangerous`` to add a signature to responses on write, and
121 -- validate that signature with a secret key on read. Can be used in a
122 -- :py:class:`.SerializerPipeline` in combination with any other serialization steps.
123 -- """
124 -- return Stage(Signer(secret_key=secret_key, salt=salt), dumps='sign', loads='unsign')
125 --
126 -- def safe_pickle_serializer(
127 -- secret_key=None, salt='requests-cache', **kwargs
128 -- ) -> SerializerPipeline:
129 -- """Create a serializer that uses ``pickle`` + ``itsdangerous`` to add a signature to
130 -- responses on write, and validate that signature with a secret key on read.
131 -- """
132 -- return SerializerPipeline(
133 -- [base_stage, pickle, signer_stage(secret_key, salt)], is_binary=True
134 -- )
135 -+ return Stage(Signer(secret_key=secret_key, salt=salt), dumps='sign', loads='unsign')
136 -+
137 -+
138 -+def safe_pickle_serializer(secret_key=None, salt='requests-cache', **kwargs) -> SerializerPipeline:
139 -+ """Create a serializer that uses ``pickle`` + ``itsdangerous`` to add a signature to
140 -+ responses on write, and validate that signature with a secret key on read.
141 -+ """
142 -+ return SerializerPipeline([base_stage, pickle, signer_stage(secret_key, salt)], is_binary=True)
143 -+
144 -
145 -+try:
146 -+ import itsdangerous # noqa: F401
147 - except ImportError as e:
148 - signer_stage = get_placeholder_class(e)
149 - safe_pickle_serializer = get_placeholder_class(e)
150 -
151 -
152 --# BSON serializer
153 --try:
154 -+def _get_bson_functions():
155 -+ """Handle different function names between pymongo's bson and standalone bson"""
156 - try:
157 -- from bson import decode as _bson_loads
158 -- from bson import encode as _bson_dumps
159 -+ import pymongo # noqa: F401
160 -+
161 -+ return {'dumps': 'encode', 'loads': 'decode'}
162 - except ImportError:
163 -- from bson import dumps as _bson_dumps
164 -- from bson import loads as _bson_loads
165 -+ return {'dumps': 'dumps', 'loads': 'loads'}
166 -+
167 -+
168 -+# BSON serializer
169 -+try:
170 -+ import bson
171 -
172 - bson_serializer = SerializerPipeline(
173 -- [bson_preconf_stage, Stage(dumps=_bson_dumps, loads=_bson_loads)], is_binary=True
174 -+ [bson_preconf_stage, Stage(bson, **_get_bson_functions())], is_binary=True
175 - ) #: Complete BSON serializer; uses pymongo's ``bson`` if installed, otherwise standalone ``bson`` codec
176 - except ImportError as e:
177 - bson_serializer = get_placeholder_class(e)
178 ---
179 -2.35.1
180 -
181
182 diff --git a/dev-python/requests-cache/requests-cache-0.9.4.ebuild b/dev-python/requests-cache/requests-cache-0.9.4.ebuild
183 deleted file mode 100644
184 index c9a10a8eef4c..000000000000
185 --- a/dev-python/requests-cache/requests-cache-0.9.4.ebuild
186 +++ /dev/null
187 @@ -1,81 +0,0 @@
188 -# Copyright 1999-2022 Gentoo Authors
189 -# Distributed under the terms of the GNU General Public License v2
190 -
191 -EAPI=8
192 -
193 -DISTUTILS_USE_PEP517=poetry
194 -PYTHON_COMPAT=( python3_{8..10} )
195 -PYTHON_REQ_USE="sqlite"
196 -
197 -inherit distutils-r1 optfeature
198 -
199 -HOMEPAGE="
200 - https://pypi.org/project/requests-cache/
201 - https://github.com/requests-cache/requests-cache/
202 -"
203 -DESCRIPTION="Persistent cache for requests library"
204 -SRC_URI="
205 - https://github.com/requests-cache/requests-cache/archive/v${PV}.tar.gz
206 - -> ${P}.gh.tar.gz
207 -"
208 -
209 -LICENSE="BSD"
210 -SLOT="0"
211 -KEYWORDS="amd64 x86"
212 -
213 -RDEPEND="
214 - dev-python/attrs[${PYTHON_USEDEP}]
215 - dev-python/appdirs[${PYTHON_USEDEP}]
216 - dev-python/cattrs[${PYTHON_USEDEP}]
217 - >=dev-python/requests-2.0.0[${PYTHON_USEDEP}]
218 - dev-python/urllib3[${PYTHON_USEDEP}]
219 - >=dev-python/url-normalize-1.4[${PYTHON_USEDEP}]
220 -"
221 -BDEPEND="
222 - test? (
223 - dev-python/itsdangerous[${PYTHON_USEDEP}]
224 - dev-python/pytest-httpbin[${PYTHON_USEDEP}]
225 - dev-python/requests-mock[${PYTHON_USEDEP}]
226 - dev-python/responses[${PYTHON_USEDEP}]
227 - dev-python/timeout-decorator[${PYTHON_USEDEP}]
228 - dev-python/ujson[${PYTHON_USEDEP}]
229 - )
230 -"
231 -
232 -distutils_enable_tests pytest
233 -
234 -PATCHES=(
235 - "${FILESDIR}"/requests-cache-0.9.3-cattrs-22.patch
236 -)
237 -
238 -src_prepare() {
239 - # unpin the dep
240 - sed -i -e '/cattrs/s:\^:>=:' pyproject.toml || die
241 - distutils-r1_src_prepare
242 -}
243 -
244 -python_test() {
245 - local EPYTEST_IGNORE=(
246 - # These require extra servers running
247 - tests/integration/test_dynamodb.py
248 - tests/integration/test_gridfs.py
249 - tests/integration/test_mongodb.py
250 - tests/integration/test_redis.py
251 - )
252 - local EPYTEST_DESELECT=(
253 - # Requires Internet access
254 - tests/integration/test_compat.py::test_version_upgrade
255 - )
256 -
257 - local -x USE_PYTEST_HTTPBIN=true
258 - epytest
259 -}
260 -
261 -pkg_postinst() {
262 - optfeature "redis backend" "dev-python/redis-py"
263 - optfeature "MongoDB backend" "dev-python/pymongo"
264 -
265 - optfeature "JSON serialization" "dev-python/ujson"
266 - optfeature "YAML serialization" "dev-python/pyyaml"
267 - optfeature "signing serialized data" "dev-python/itsdangerous"
268 -}