forked from pool/python-pymemcache
- update to 3.5.0:
* Sockets are now closed on ``MemcacheUnexpectedCloseError``. * Added support for TCP keepalive for client sockets on Linux platforms. * Added retrying mechanisms by wrapping clients. - drop merged_pr_327.patch (upstream) OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pymemcache?expand=0&rev=31
This commit is contained in:
@@ -1,63 +0,0 @@
|
|||||||
From 742763658d0171598e631a72a53e331b47e281e1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jon Parise <jon@pinterest.com>
|
|
||||||
Date: Fri, 18 Jun 2021 11:56:06 -0700
|
|
||||||
Subject: [PATCH] Provide a mock implementation of socket.getaddrinfo
|
|
||||||
|
|
||||||
9551dfd0 introduced a call to socket.getaddrinfo() to support IPv6, but
|
|
||||||
we never added an implementation of that function to MockSocketModule.
|
|
||||||
This resulted in some tests making "live" socket.getaddrinfo() calls
|
|
||||||
because of the default MockSocketModule.__getattr__ implementation
|
|
||||||
(which we need to forward other module attribute lookups).
|
|
||||||
---
|
|
||||||
pymemcache/test/test_client.py | 24 ++++++++++++++++++++----
|
|
||||||
1 file changed, 20 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/pymemcache/test/test_client.py b/pymemcache/test/test_client.py
|
|
||||||
index 24ecab2..93d327c 100644
|
|
||||||
--- a/pymemcache/test/test_client.py
|
|
||||||
+++ b/pymemcache/test/test_client.py
|
|
||||||
@@ -40,6 +40,11 @@
|
|
||||||
from pymemcache.test.utils import MockMemcacheClient
|
|
||||||
|
|
||||||
|
|
||||||
+# TODO: Use ipaddress module when dropping support for Python < 3.3
|
|
||||||
+def is_ipv6(address):
|
|
||||||
+ return re.match(r'^[0-9a-f:]+$', address)
|
|
||||||
+
|
|
||||||
+
|
|
||||||
class MockSocket(object):
|
|
||||||
def __init__(self, recv_bufs, connect_failure=None, close_failure=None):
|
|
||||||
self.recv_bufs = collections.deque(recv_bufs)
|
|
||||||
@@ -53,10 +58,8 @@ def __init__(self, recv_bufs, connect_failure=None, close_failure=None):
|
|
||||||
|
|
||||||
@property
|
|
||||||
def family(self):
|
|
||||||
- # TODO: Use ipaddress module when dropping support for Python < 3.3
|
|
||||||
- ipv6_re = re.compile(r'^[0-9a-f:]+$')
|
|
||||||
- is_ipv6 = any(ipv6_re.match(c[0]) for c in self.connections)
|
|
||||||
- return socket.AF_INET6 if is_ipv6 else socket.AF_INET
|
|
||||||
+ any_ipv6 = any(is_ipv6(c[0]) for c in self.connections)
|
|
||||||
+ return socket.AF_INET6 if any_ipv6 else socket.AF_INET
|
|
||||||
|
|
||||||
def sendall(self, value):
|
|
||||||
self.send_bufs.append(value)
|
|
||||||
@@ -115,6 +118,19 @@ def socket(self, family, type, proto=0, fileno=None):
|
|
||||||
self.sockets.append(socket)
|
|
||||||
return socket
|
|
||||||
|
|
||||||
+ def getaddrinfo(self, host, port, family=0, type=0, proto=0, flags=0):
|
|
||||||
+ family = family or (
|
|
||||||
+ socket.AF_INET6 if is_ipv6(host) else socket.AF_INET
|
|
||||||
+ )
|
|
||||||
+ type = type or socket.SOCK_STREAM
|
|
||||||
+ proto = proto or socket.IPPROTO_TCP
|
|
||||||
+ sockaddr = (
|
|
||||||
+ ('::1', 11211, 0, 0)
|
|
||||||
+ if family == socket.AF_INET6
|
|
||||||
+ else ('127.0.0.1', 11211)
|
|
||||||
+ )
|
|
||||||
+ return [(family, type, proto, '', sockaddr)]
|
|
||||||
+
|
|
||||||
def __getattr__(self, name):
|
|
||||||
return getattr(socket, name)
|
|
||||||
|
|
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:8185a099a4823789560cb051d98daa51e2e4d4aa9fc6027c86766892408d984e
|
|
||||||
size 48693
|
|
3
pymemcache-3.5.0.tar.gz
Normal file
3
pymemcache-3.5.0.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:5bf9c94a6bc9ad081dc9b5808284e027d755a0518f6375a57405552938c74d91
|
||||||
|
size 64763
|
@@ -1,3 +1,12 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Oct 16 20:29:06 UTC 2021 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
- update to 3.5.0:
|
||||||
|
* Sockets are now closed on ``MemcacheUnexpectedCloseError``.
|
||||||
|
* Added support for TCP keepalive for client sockets on Linux platforms.
|
||||||
|
* Added retrying mechanisms by wrapping clients.
|
||||||
|
- drop merged_pr_327.patch (upstream)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sat Jun 19 02:18:02 UTC 2021 - John Vandenberg <jayvdb@gmail.com>
|
Sat Jun 19 02:18:02 UTC 2021 - John Vandenberg <jayvdb@gmail.com>
|
||||||
|
|
||||||
|
@@ -20,14 +20,13 @@
|
|||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||||
%bcond_without python2
|
%bcond_without python2
|
||||||
Name: python-pymemcache
|
Name: python-pymemcache
|
||||||
Version: 3.4.4
|
Version: 3.5.0
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: A pure Python memcached client
|
Summary: A pure Python memcached client
|
||||||
License: Apache-2.0
|
License: Apache-2.0
|
||||||
Group: Development/Languages/Python
|
Group: Development/Languages/Python
|
||||||
URL: https://github.com/Pinterest/pymemcache
|
URL: https://github.com/Pinterest/pymemcache
|
||||||
Source: https://files.pythonhosted.org/packages/source/p/pymemcache/pymemcache-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/p/pymemcache/pymemcache-%{version}.tar.gz
|
||||||
Patch0: https://patch-diff.githubusercontent.com/raw/pinterest/pymemcache/pull/327.patch#/merged_pr_327.patch
|
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: memcached
|
BuildRequires: memcached
|
||||||
@@ -63,7 +62,6 @@ pymemcache supports the following features:
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n pymemcache-%{version}
|
%setup -q -n pymemcache-%{version}
|
||||||
%patch0 -p1
|
|
||||||
# Disable pytest-cov
|
# Disable pytest-cov
|
||||||
sed -i 's/tool:pytest/tool:ignore-pytest-cov/' setup.cfg
|
sed -i 's/tool:pytest/tool:ignore-pytest-cov/' setup.cfg
|
||||||
|
|
||||||
@@ -80,7 +78,6 @@ sed -i 's/tool:pytest/tool:ignore-pytest-cov/' setup.cfg
|
|||||||
# https://github.com/scoriacorp/docker-tls-memcached
|
# https://github.com/scoriacorp/docker-tls-memcached
|
||||||
%pytest -rs -k 'not tls'
|
%pytest -rs -k 'not tls'
|
||||||
|
|
||||||
|
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%license LICENSE.txt
|
%license LICENSE.txt
|
||||||
%doc README.rst
|
%doc README.rst
|
||||||
|
Reference in New Issue
Block a user