New package: python3-jsonrpc-server-0.3.2.

This commit is contained in:
k4leg 2019-12-30 19:10:26 +03:00 committed by Piotr
parent 0a92fb503e
commit 1d05df7190
2 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,60 @@
diff -uprb python-jsonrpc-server-0.2.0.orig/pyls_jsonrpc/endpoint.py python-jsonrpc-server-0.2.0/pyls_jsonrpc/endpoint.py
--- python-jsonrpc-server-0.2.0.orig/pyls_jsonrpc/endpoint.py 2019-06-27 18:42:22.000000000 +0300
+++ python-jsonrpc-server-0.2.0/pyls_jsonrpc/endpoint.py 2019-11-02 23:24:59.407851208 +0200
@@ -98,7 +98,7 @@ class Endpoint(object):
message (dict): The JSON RPC message sent by the client
"""
if 'jsonrpc' not in message or message['jsonrpc'] != JSONRPC_VERSION:
- log.warn("Unknown message type %s", message)
+ log.warning("Unknown message type %s", message)
return
if 'id' not in message:
@@ -135,7 +135,7 @@ class Endpoint(object):
try:
handler = self._dispatcher[method]
except KeyError:
- log.warn("Ignoring notification for unknown method %s", method)
+ log.warning("Ignoring notification for unknown method %s", method)
return
try:
@@ -165,7 +165,7 @@ class Endpoint(object):
request_future = self._client_request_futures.pop(msg_id, None)
if not request_future:
- log.warn("Received cancel notification for unknown message id %s", msg_id)
+ log.warning("Received cancel notification for unknown message id %s", msg_id)
return
# Will only work if the request hasn't started executing
@@ -230,12 +230,13 @@ class Endpoint(object):
request_future = self._server_request_futures.pop(msg_id, None)
if not request_future:
- log.warn("Received response to unknown message id %s", msg_id)
+ log.warning("Received response to unknown message id %s", msg_id)
return
if error is not None:
log.debug("Received error response to message %s: %s", msg_id, error)
request_future.set_exception(JsonRpcException.from_dict(error))
+ return
log.debug("Received result for message %s: %s", msg_id, result)
request_future.set_result(result)
diff -uprb python-jsonrpc-server-0.2.0.orig/test/test_endpoint.py python-jsonrpc-server-0.2.0/test/test_endpoint.py
--- python-jsonrpc-server-0.2.0.orig/test/test_endpoint.py 2019-06-27 18:42:22.000000000 +0300
+++ python-jsonrpc-server-0.2.0/test/test_endpoint.py 2019-11-02 23:24:21.033838729 +0200
@@ -115,9 +115,9 @@ def test_request_cancel(endpoint, consum
'params': {'id': MSG_ID}
})
- with pytest.raises(exceptions.JsonRpcException) as exc_info:
+ with pytest.raises((exceptions.JsonRpcException, futures.CancelledError)) as exc_info:
assert future.result(timeout=2)
- assert exc_info.type == exceptions.JsonRpcRequestCancelled
+ assert exc_info.type in (exceptions.JsonRpcRequestCancelled, futures.CancelledError)
def test_consume_notification(endpoint, dispatcher):

View file

@ -0,0 +1,20 @@
# Template file for 'python3-jsonrpc-server'
pkgname=python3-jsonrpc-server
version=0.3.2
revision=1
archs=noarch
wrksrc="${pkgname/3}-${version}"
build_style=python3-module
hostmakedepends="python3-setuptools"
depends="python3-future python3-ultrajson"
short_desc="Python library implementing asynchronous JSON RPC server"
maintainer="k4leg <d0xi@inbox.ru>"
license="MIT"
homepage="https://github.com/palantir/python-jsonrpc-server"
distfiles="${PYPI_SITE}/p/${pkgname/3}/${pkgname/3}-${version}.tar.gz"
checksum=05bcf26eac4c98c96afec266acdf563d8f454e12612da9a3f9aabb66c46daf35
patch_args="-Np1"
post_install() {
vlicense LICENSE
}