From ee41c99ef45b7ceb62ed6c046b1cb486c509da9a4c39335a859278dd691242bd Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Thu, 27 Apr 2023 22:07:27 +0000 Subject: [PATCH] Accepting request 1082708 from home:pgajdos:python - version update to 1.1.6 * no upstream changelog found - added patches fix https://github.com/mbr/tinyrpc/issues/103 + python-tinyrpc-no-six.patch OBS-URL: https://build.opensuse.org/request/show/1082708 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-tinyrpc?expand=0&rev=22 --- 1.1.4.tar.gz | 3 - 1.1.6.tar.gz | 3 + python-tinyrpc-no-six.patch | 256 ++++++++++++++++++++++++++++++++++++ python-tinyrpc.changes | 9 ++ python-tinyrpc.spec | 15 ++- 5 files changed, 276 insertions(+), 10 deletions(-) delete mode 100644 1.1.4.tar.gz create mode 100644 1.1.6.tar.gz create mode 100644 python-tinyrpc-no-six.patch diff --git a/1.1.4.tar.gz b/1.1.4.tar.gz deleted file mode 100644 index 4e67333..0000000 --- a/1.1.4.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c952754558ecb3079ac32b7407a9eabcac28fad37e9b72a9316eb6f0a39213bc -size 77281 diff --git a/1.1.6.tar.gz b/1.1.6.tar.gz new file mode 100644 index 0000000..1500201 --- /dev/null +++ b/1.1.6.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c97ee7375bf4dfbd08edd8281fad18233f205dcb364561c789e12124fd3f48ef +size 77333 diff --git a/python-tinyrpc-no-six.patch b/python-tinyrpc-no-six.patch new file mode 100644 index 0000000..112f9a4 --- /dev/null +++ b/python-tinyrpc-no-six.patch @@ -0,0 +1,256 @@ +Index: tinyrpc-1.1.6/requirements.txt +=================================================================== +--- tinyrpc-1.1.6.orig/requirements.txt ++++ tinyrpc-1.1.6/requirements.txt +@@ -6,6 +6,5 @@ pytest==6.2.4 + pytest-cov==2.11.1 + pyzmq==22.0.3 + requests==2.25.1 +-six==1.16.0 + Werkzeug==2.0.0 + +Index: tinyrpc-1.1.6/setup.py +=================================================================== +--- tinyrpc-1.1.6.orig/setup.py ++++ tinyrpc-1.1.6/setup.py +@@ -22,7 +22,7 @@ setup( + maintainer_email='leo@noordergraaf.net', + url='http://github.com/mbr/tinyrpc', + license='MIT', +- install_requires=['six'], ++ install_requires=[], + extras_require={ + 'gevent': ['gevent'], + 'httpclient': ['requests', 'websocket-client', 'gevent-websocket'], +Index: tinyrpc-1.1.6/tests/_compat.py +=================================================================== +--- tinyrpc-1.1.6.orig/tests/_compat.py ++++ /dev/null +@@ -1,8 +0,0 @@ +-# from http://stackoverflow.com/questions/28215214/how-to-add-custom-renames-in-six +- +-import six +-mod = six.MovedModule('mock', 'mock', 'unittest.mock') +-six.add_move(mod) +-six._importer._add_module(mod, "moves." + mod.name) +- +-# issue open at https://bitbucket.org/gutworth/six/issue/116/enable-importing-from-within-custom +Index: tinyrpc-1.1.6/tests/test_jsonrpc.py +=================================================================== +--- tinyrpc-1.1.6.orig/tests/test_jsonrpc.py ++++ tinyrpc-1.1.6/tests/test_jsonrpc.py +@@ -3,7 +3,6 @@ + + import json + +-import six + import pytest + + from tinyrpc import MethodNotFoundError, InvalidRequestError, ServerError, \ +@@ -65,7 +64,7 @@ def prot(): + def test_parsing_good_request_samples(prot, data, attrs): + req = prot.parse_request(data) + +- for k, v in six.iteritems(attrs): ++ for k, v in attrs.items(): + assert getattr(req, k) == v + + +Index: tinyrpc-1.1.6/tests/test_msgpackrpc.py +=================================================================== +--- tinyrpc-1.1.6.orig/tests/test_msgpackrpc.py ++++ tinyrpc-1.1.6/tests/test_msgpackrpc.py +@@ -2,7 +2,6 @@ + # -*- coding: utf-8 -*- + + import msgpack +-import six + import pytest + + from tinyrpc import InvalidReplyError, MethodNotFoundError +@@ -48,7 +47,7 @@ def prot(): + def test_parsing_good_request_samples(prot, data, attrs): + req = prot.parse_request(data) + +- for k, v in six.iteritems(attrs): ++ for k, v in attrs.items(): + assert getattr(req, k) == v + + +Index: tinyrpc-1.1.6/tests/test_transport.py +=================================================================== +--- tinyrpc-1.1.6.orig/tests/test_transport.py ++++ tinyrpc-1.1.6/tests/test_transport.py +@@ -2,7 +2,6 @@ + # -*- coding: utf-8 -*- + + import pytest +-import six + + import zmq + import zmq.green +@@ -60,11 +59,9 @@ def zmq_green_context(request): + return ctx + + +-if six.PY3: +- # zmq and zmq.green fail on python3 +- SERVERS=['dummy'] +-else: +- SERVERS=['dummy', 'zmq', 'zmq.green'] ++# zmq and zmq.green fail on python3 ++SERVERS=['dummy'] ++ + @pytest.fixture(params=SERVERS) + def transport(request, zmq_context, zmq_green_context): + if request.param == 'dummy': +@@ -87,10 +84,7 @@ def transport(request, zmq_context, zmq_ + + SAMPLE_MESSAGES = ['asdf', 'loremipsum' * 1500, '', '\x00', 'b\x00a', '\r\n', + '\n', u'\u1234'.encode('utf8')] +-if six.PY3: +- BAD_MESSAGES = [b'asdf', b'', 1234, 1.2, None, True, False, ('foo',)] +-else: +- BAD_MESSAGES = [u'asdf', u'', 1234, 1.2, None, True, False, ('foo',)] ++BAD_MESSAGES = [b'asdf', b'', 1234, 1.2, None, True, False, ('foo',)] + + + @pytest.fixture(scope='session', +Index: tinyrpc-1.1.6/tests/test_wsgi_transport.py +=================================================================== +--- tinyrpc-1.1.6.orig/tests/test_wsgi_transport.py ++++ tinyrpc-1.1.6/tests/test_wsgi_transport.py +@@ -3,8 +3,7 @@ + + import pytest + +- +-import six ++import importlib + import gevent + import gevent.queue + import gevent.monkey +@@ -33,7 +32,7 @@ def monkey_patches(request): + aggressive=False) + + def fin(): +- six.moves.reload_module(socket) ++ importlib.reload(socket) + + request.addfinalizer(fin) + +@@ -70,21 +69,21 @@ def test_server_supports_post_only(wsgi_ + + + @pytest.mark.parametrize(('msg',), +- [(six.b('foo'),), (six.b(''),), (six.b('bar'),), (six.b('1234'),), (six.b('{}'),), (six.b('{'),), (six.b('\x00\r\n'),)]) ++ [(b'foo',), (b'',), (b'bar',), (b'1234',), (b'{}',), (b'{',), (b'\x00\r\n',)]) + def test_server_receives_messages(wsgi_server, msg): + transport, addr = wsgi_server + + def consumer(): + context, received_msg = transport.receive_message() + assert received_msg == msg +- reply = six.b('reply:') + msg ++ reply = b'reply:' + msg + transport.send_reply(context, reply) + + gevent.spawn(consumer) + + r = requests.post(addr, data=msg) + +- assert r.content == six.b('reply:') + msg ++ assert r.content == b'reply:' + msg + + + @pytest.fixture +@@ -106,20 +105,20 @@ def non_sessioned_client(): + + + @pytest.mark.parametrize(('msg',), +- [(six.b('foo'),), (six.b(''),), (six.b('bar'),), (six.b('1234'),), (six.b('{}'),), (six.b('{'),), (six.b('\x00\r\n'),)]) ++ [(b'foo',), (b'',), (b'bar',), (b'1234',), (b'{}',), (b'{',), (b'\x00\r\n',)]) + def test_sessioned_http_sessioned_client(wsgi_server, sessioned_client, msg): + transport, addr = wsgi_server + + def consumer(): + context, received_msg = transport.receive_message() + assert received_msg == msg +- reply = six.b('reply:') + msg ++ reply = b'reply:' + msg + transport.send_reply(context, reply) + + gevent.spawn(consumer) + + result = sessioned_client.send_message(msg) +- assert result == six.b('reply:') + msg ++ assert result == b'reply:' + msg + + + @pytest.mark.skip('somehow fails on travis') +@@ -137,22 +136,22 @@ def test_exhaust_ports(wsgi_server, non_ + + def consumer(): + context, received_msg = transport.receive_message() +- reply = six.b('reply:') + received_msg ++ reply = b'reply:' + received_msg + transport.send_reply(context, reply) + + def send_and_receive(i): + try: + gevent.spawn(consumer) +- msg = six.b('msg_%s' % i) ++ msg = b'msg_%s' % i + result = non_sessioned_client.send_message(msg) +- return result == six.b('reply:') + msg ++ return result == b'reply:' + msg + except Exception as e: + return e + + pool = gevent.pool.Pool(500) + + with pytest.raises(requests.ConnectionError): +- for result in pool.imap_unordered(send_and_receive, six.moves.xrange(55000)): ++ for result in pool.imap_unordered(send_and_receive, range(55000)): + assert result + if isinstance(result, Exception): + raise result +Index: tinyrpc-1.1.6/tinyrpc/protocols/msgpackrpc.py +=================================================================== +--- tinyrpc-1.1.6.orig/tinyrpc/protocols/msgpackrpc.py ++++ tinyrpc-1.1.6/tinyrpc/protocols/msgpackrpc.py +@@ -14,7 +14,6 @@ from .. import ( + ) + + import msgpack +-import six + + from typing import Any, Dict, List, Optional, Tuple, Union, Generator + +@@ -104,7 +103,7 @@ class MSGPACKRPCErrorResponse(RPCErrorRe + + + def _get_code_and_message(error): +- assert isinstance(error, (Exception, six.string_types)) ++ assert isinstance(error, (Exception, str)) + if isinstance(error, Exception): + if hasattr(error, "msgpackrpc_error_code"): + code = error.msgpackrpc_error_code +@@ -390,7 +389,7 @@ class MSGPACKRPCProtocol(RPCProtocol): + raise MSGPACKRPCInvalidRequestError() + + def _parse_notification(self, req): +- if not isinstance(req[1], six.string_types): ++ if not isinstance(req[1], str): + raise MSGPACKRPCInvalidRequestError() + + request = MSGPACKRPCRequest() +@@ -408,7 +407,7 @@ class MSGPACKRPCProtocol(RPCProtocol): + return request + + def _parse_request(self, req): +- if not isinstance(req[2], six.string_types): ++ if not isinstance(req[2], str): + raise MSGPACKRPCInvalidRequestError(request_id=req[1]) + + request = MSGPACKRPCRequest() diff --git a/python-tinyrpc.changes b/python-tinyrpc.changes index 2fb741b..60784f5 100644 --- a/python-tinyrpc.changes +++ b/python-tinyrpc.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Tue Apr 25 09:14:21 UTC 2023 - pgajdos@suse.com + +- version update to 1.1.6 + * no upstream changelog found +- added patches + fix https://github.com/mbr/tinyrpc/issues/103 + + python-tinyrpc-no-six.patch + ------------------------------------------------------------------- Sat Oct 1 13:51:06 UTC 2022 - Dirk Müller diff --git a/python-tinyrpc.spec b/python-tinyrpc.spec index 9db2f3c..b328c9a 100644 --- a/python-tinyrpc.spec +++ b/python-tinyrpc.spec @@ -1,7 +1,7 @@ # # spec file for package python-tinyrpc # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,15 +16,16 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-tinyrpc -Version: 1.1.4 +Version: 1.1.6 Release: 0 Summary: A modular transport and protocol neutral RPC library License: MIT URL: https://github.com/mbr/tinyrpc Source: https://github.com/mbr/tinyrpc/archive/%{version}.tar.gz +# https://github.com/mbr/tinyrpc/issues/103 +Patch0: python-tinyrpc-no-six.patch BuildRequires: %{python_module Werkzeug} BuildRequires: %{python_module gevent} BuildRequires: %{python_module msgpack} @@ -33,10 +34,8 @@ BuildRequires: %{python_module pytest} BuildRequires: %{python_module pyzmq} BuildRequires: %{python_module requests} BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module six} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-six BuildArch: noarch %python_subpackages @@ -51,7 +50,7 @@ transport (i.e. going from json via TCP to an implementation using WebSockets or ZeroMQ). %prep -%setup -q -n tinyrpc-%{version} +%autosetup -p1 -n tinyrpc-%{version} %build %python_build @@ -59,6 +58,8 @@ WebSockets or ZeroMQ). %install %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} +%python_expand rm -r %{buildroot}%{$python_sitelib}/tests +%python_expand find %{buildroot}%{$python_sitelib}/tinyrpc -name "*.py" | xargs sed -i '1 {/^#!/ d}' %check # test_batch_dispatch - needs old pytest syntax, skip @@ -67,6 +68,6 @@ WebSockets or ZeroMQ). %files %{python_files} %license LICENSE %doc README.rst -%{python_sitelib}/* +%{python_sitelib}/tinyrpc* %changelog