Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-socketpool for
openSUSE:Factory checked in at 2022-02-11 23:10:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-socketpool (Old)
and /work/SRC/openSUSE:Factory/.python-socketpool.new.1956 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-socketpool"
Fri Feb 11 23:10:16 2022 rev:16 rq:953746 version:0.5.3
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-socketpool/python-socketpool.changes
2019-04-05 11:56:57.834349458 +0200
+++
/work/SRC/openSUSE:Factory/.python-socketpool.new.1956/python-socketpool.changes
2022-02-11 23:12:17.431445932 +0100
@@ -1,0 +2,13 @@
+Fri Feb 11 13:46:05 UTC 2022 - Matej Cepl <[email protected]>
+
+- Add 37-python39.patch (gh#benoitc/socketpool#37) to make code
+ Python 3.9 compatible.
+- Add port_to_py3k.patch (gh#benoitc/socketpool#38) porting tests
+ to py3k.
+
+-------------------------------------------------------------------
+Fri Feb 11 10:53:23 UTC 2022 - [email protected]
+
+- 2to3 module is not required for build
+
+-------------------------------------------------------------------
New:
----
37-python39.patch
port_to_py3k.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-socketpool.spec ++++++
--- /var/tmp/diff_new_pack.wHtcOJ/_old 2022-02-11 23:12:18.103447877 +0100
+++ /var/tmp/diff_new_pack.wHtcOJ/_new 2022-02-11 23:12:18.111447899 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-socketpool
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-%bcond_with test
+%bcond_without test
Name: python-socketpool
Version: 0.5.3
Release: 0
@@ -26,9 +26,17 @@
Group: Development/Languages/Python
URL: http://github.com/benoitc/socketpool
Source:
https://files.pythonhosted.org/packages/source/s/socketpool/socketpool-%{version}.tar.gz
+# PATCH-FIX-UPSTREAM 37-python39.patch gh#benoitc/socketpool#37 [email protected]
+# Thread.is_alive as isAlive removed in Python 3.9
+Patch0: 37-python39.patch
+# PATCH-FIX-UPSTREAM port_to_py3k.patch gh#benoitc/socketpool#38 [email protected]
+# port tests to py3k
+Patch1: port_to_py3k.patch
+BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
+BuildRequires: %{python_module wheel}
+BuildRequires: fdupes
BuildRequires: python-rpm-macros
-BuildRequires: python3-2to3
Recommends: python-eventlet
Recommends: python-gevent
BuildArch: noarch
@@ -44,26 +52,32 @@
backends. It can be used by gevent, eventlet or any other library.
%prep
-%setup -q -n socketpool-%{version}
+%autosetup -p1 -n socketpool-%{version}
+
+# Don't generate bytecode files for examples
+rm -rf examples/__pycache__
%build
export LANG=en_US.UTF-8
-%python_build
+%pyproject_wheel
%install
export LANG=en_US.UTF-8
-%python_install
-rm -r %{buildroot}%{_prefix}/socketpool # Remove wrongly installed docs
+%pyproject_install
+# Remove wrongly installed docs
+rm -r %{buildroot}%{_prefix}/socketpool
+%python_expand %fdupes %{buildroot}%{$python_sitelib}
%if %{with test}
%check
-%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib}
py.test-%{$python_bin_suffix}
+%pytest
%endif
%files %{python_files}
%license *LICENSE
%doc README.rst
%doc examples/
-%{python_sitelib}/*
+%{python_sitelib}/socketpool-%{version}*-info/
+%{python_sitelib}/socketpool/
%changelog
++++++ 37-python39.patch ++++++
>From 82a527a2791a5b8ca9c1d5c53e7817c2222064da Mon Sep 17 00:00:00 2001
From: Jeremy Epstein <[email protected]>
Date: Tue, 29 Jun 2021 19:18:43 +1000
Subject: [PATCH] Thread.is_alive as isAlive removed in Python 3.9
---
socketpool/backend_thread.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/socketpool/backend_thread.py
+++ b/socketpool/backend_thread.py
@@ -51,7 +51,7 @@ class ConnectionReaper(threading.Thread)
self.pool.murder_connections()
def ensure_started(self):
- if not self.running and not self.isAlive():
+ if not self.running and not self.is_alive():
self.start()
++++++ port_to_py3k.patch ++++++
---
examples/test_eventlet.py | 18 +++++++++---------
examples/test_gevent.py | 14 +++++++-------
examples/test_threaded.py | 6 +++---
socketpool/backend_thread.py | 2 +-
socketpool/conn.py | 4 ++--
socketpool/pool.py | 6 +++---
tests/test_pool_01.py | 2 +-
7 files changed, 26 insertions(+), 26 deletions(-)
--- a/examples/test_eventlet.py
+++ b/examples/test_eventlet.py
@@ -25,26 +25,26 @@ class EchoServer(object):
eventlet.spawn(self.run)
def run(self):
- self.server = eventlet.listen((self.host, self.port))
+ self.server = eventlet.listen(self.host, self.port)
self.running = True
while self.running:
try:
sock, address = self.server.accept()
- print "accepted", address
+ print("accepted", address)
self.spool.spawn_n(self.handle, sock, address)
except (SystemExit, KeyboardInterrupt):
break
def handle(self, sock, address):
- print ('New connection from %s:%s' % address)
+ print('New connection from %s:%s' % address)
while True:
data = sock.recv(1024)
if not data:
break
sock.send(data)
- print ("echoed %r" % data)
+ print("echoed %r" % data)
def stop(self):
@@ -62,17 +62,17 @@ if __name__ == '__main__':
epool = eventlet.GreenPool()
def runpool(data):
- print 'ok'
+ print('ok')
with pool.connection() as conn:
- print 'sending'
+ print('sending')
sent = conn.send(data)
- print 'send %d bytes' % sent
+ print('send %d bytes' % sent)
echo_data = conn.recv(1024)
- print "got %s" % data
+ print("got %s" % data)
assert data == echo_data
start = time.time()
- _ = [epool.spawn(runpool, "blahblah") for _ in xrange(20)]
+ _ = [epool.spawn(runpool, "blahblah") for _ in range(20)]
epool.waitall()
server.stop()
--- a/examples/test_gevent.py
+++ b/examples/test_gevent.py
@@ -11,14 +11,14 @@ from socketpool.conn import TcpConnector
# this handler will be run for each incoming connection in a dedicated greenlet
def echo(sock, address):
- print ('New connection from %s:%s' % address)
+ print('New connection from %s:%s' % address)
while True:
data = sock.recv(1024)
if not data:
break
sock.send(data)
- print ("echoed %r" % data)
+ print("echoed %r" % data)
@@ -33,25 +33,25 @@ if __name__ == '__main__':
def runpool(data):
with pool.connection(**options) as conn:
- print ("conn: pool size: %s" % pool.size)
+ print("conn: pool size: %s" % pool.size)
sent = conn.send(data)
echo_data = conn.recv(1024)
assert data == echo_data
start = time.time()
- jobs = [gevent.spawn(runpool, "blahblah") for _ in xrange(50)]
+ jobs = [gevent.spawn(runpool, "blahblah") for _ in range(50)]
gevent.joinall(jobs)
delay = time.time() - start
- print ("final pool size: %s" % pool.size)
+ print("final pool size: %s" % pool.size)
with pool.connection(**options) as conn:
- print ("conn: pool size: %s" % pool.size)
+ print("conn: pool size: %s" % pool.size)
sent = conn.send("hello")
echo_data = conn.recv(1024)
assert "hello" == echo_data
- print ("final pool size: %s" % pool.size)
+ print("final pool size: %s" % pool.size)
--- a/examples/test_threaded.py
+++ b/examples/test_threaded.py
@@ -10,10 +10,10 @@ import threading
try:
from queue import *
except ImportError:
- from Queue import *
+ from queue import *
try:
- import SocketServer as socketserver
+ import socketserver as socketserver
except ImportError:
import socketserver
@@ -91,7 +91,7 @@ if __name__ == "__main__":
q.join()
- print ("final pool size: %s" % pool.size)
+ print("final pool size: %s" % pool.size)
pool.release_all()
server.shutdown()
--- a/socketpool/backend_thread.py
+++ b/socketpool/backend_thread.py
@@ -9,7 +9,7 @@ import threading
import time
try:
- import Queue as queue
+ import queue as queue
except ImportError: # py3
import queue
--- a/socketpool/conn.py
+++ b/socketpool/conn.py
@@ -31,7 +31,7 @@ class TcpConnector(Connector):
def __init__(self, host, port, backend_mod, pool=None):
self._s = backend_mod.Socket(socket.AF_INET, socket.SOCK_STREAM)
- self._s.connect((host, port))
+ self._s.connect(host, port)
self.host = host
self.port = port
self.backend_mod = backend_mod
@@ -57,7 +57,7 @@ class TcpConnector(Connector):
def handle_exception(self, exception):
print('got an exception')
- print(str(exception))
+ print(exception)
def get_lifetime(self):
return self._life
--- a/socketpool/pool.py
+++ b/socketpool/pool.py
@@ -88,7 +88,7 @@ class ConnectionPool(object):
for priority, candidate in self.pool:
current_pool_size -= 1
if not self.too_old(candidate):
- self.pool.put((priority, candidate))
+ self.pool.put(priority, candidate)
else:
self._reap_connection(candidate)
if current_pool_size <= 0:
@@ -120,7 +120,7 @@ class ConnectionPool(object):
if self.pool.qsize() < self.max_size:
connected = conn.is_connected()
if connected and not self.too_old(conn):
- self.pool.put((conn.get_lifetime(), conn))
+ self.pool.put(conn.get_lifetime(), conn)
else:
self._reap_connection(conn)
else:
@@ -150,7 +150,7 @@ class ConnectionPool(object):
matches = candidate.matches(**options)
if not matches:
# let's put it back
- unmatched.append((priority, candidate))
+ unmatched.append(priority, candidate)
else:
if candidate.is_connected():
found = candidate
--- a/tests/test_pool_01.py
+++ b/tests/test_pool_01.py
@@ -24,5 +24,5 @@ class PoolTestCase(unittest.TestCase):
def test_size_on_isconnected_failure(self):
pool = ConnectionPool(MessyConnector)
- self.assert_(pool.size == 0)
+ self.assertTrue(pool.size == 0)
self.assertRaises(MaxTriesError, pool.get)