Skip to content

Commit 4b88e07

Browse files
committed
fix(packages): make zerorpc work with Debian trixie
zerorpc was using methods future.utils to be compatible with both Python 2.x and 3.x but Debian trixie does not ship python3-future. Replace uses of the future module with (hopefully) equivalent Python 3.x constructs. Signed-off-by: Cedric Hombourger <[email protected]>
1 parent 0dd5804 commit 4b88e07

File tree

3 files changed

+83
-1
lines changed

3 files changed

+83
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
License and copyright for files modified by this patch:
2+
3+
SPDX-License-Identifier: MIT
4+
Copyright (c) 2015 François-Xavier Bourlet ([email protected])
5+
6+
Index: zerorpc-0.6.3/zerorpc/context.py
7+
===================================================================
8+
--- zerorpc-0.6.3.orig/zerorpc/context.py
9+
+++ zerorpc-0.6.3/zerorpc/context.py
10+
@@ -23,9 +23,6 @@
11+
# SOFTWARE.
12+
13+
14+
-from __future__ import absolute_import
15+
-from future.utils import tobytes
16+
-
17+
import uuid
18+
import random
19+
20+
@@ -103,7 +100,7 @@ class Context(zmq.Context):
21+
return Context._instance
22+
23+
def _reset_msgid(self):
24+
- self._msg_id_base = tobytes(uuid.uuid4().hex)[8:]
25+
+ self._msg_id_base = uuid.uuid4().hex[8:].encode('ascii')
26+
self._msg_id_counter = random.randrange(0, 2 ** 32)
27+
self._msg_id_counter_stop = random.randrange(self._msg_id_counter, 2 ** 32)
28+
29+
@@ -112,7 +109,7 @@ class Context(zmq.Context):
30+
self._reset_msgid()
31+
else:
32+
self._msg_id_counter = (self._msg_id_counter + 1)
33+
- return tobytes('{0:08x}'.format(self._msg_id_counter)) + self._msg_id_base
34+
+ return f'{self._msg_id_counter:08x}'.encode('ascii') + self._msg_id_base
35+
36+
def register_middleware(self, middleware_instance):
37+
registered_count = 0
38+
Index: zerorpc-0.6.3/zerorpc/core.py
39+
===================================================================
40+
--- zerorpc-0.6.3.orig/zerorpc/core.py
41+
+++ zerorpc-0.6.3/zerorpc/core.py
42+
@@ -23,10 +23,8 @@
43+
# SOFTWARE.
44+
45+
46+
-from __future__ import absolute_import
47+
from builtins import str
48+
from builtins import zip
49+
-from future.utils import iteritems
50+
51+
import sys
52+
import traceback
53+
@@ -67,7 +65,7 @@ class ServerBase(object):
54+
self._inject_builtins()
55+
self._heartbeat_freq = heartbeat
56+
57+
- for (k, functor) in iteritems(self._methods):
58+
+ for (k, functor) in self._methods.items():
59+
if not isinstance(functor, DecoratorBase):
60+
self._methods[k] = rep(functor)
61+
62+
@@ -102,11 +100,11 @@ class ServerBase(object):
63+
return r
64+
65+
def _zerorpc_inspect(self):
66+
- methods = dict((m, f) for m, f in iteritems(self._methods)
67+
+ methods = dict((m, f) for m, f in self._methods.items()
68+
if not m.startswith('_'))
69+
detailled_methods = dict((m,
70+
dict(args=self._format_args_spec(f._zerorpc_args()),
71+
- doc=f._zerorpc_doc())) for (m, f) in iteritems(methods))
72+
+ doc=f._zerorpc_doc())) for (m, f) in methods.items())
73+
return {'name': self._name,
74+
'methods': detailled_methods}
75+

meta-isar/recipes-python/zerorpc/files/zerorpc-0.6.3/debian/changelog

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
zerorpc-python (0.6.3-6) testing; urgency=low
2+
3+
* Remove use of the future module since not supported in Debian trixie
4+
5+
-- Cedric Hombourger <[email protected]> Mon, 06 Jan 2024 15:30:00 +0100
6+
17
zerorpc-python (0.6.3-5) testing; urgency=low
28

39
* Pull fix submitted upstream for zerorpc to work with pyzmq 23.0.0 (issue #251)

meta-isar/recipes-python/zerorpc/zerorpc-python_0.6.3.bb

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ inherit dpkg
1010
SRC_URI = " \
1111
https://files.pythonhosted.org/packages/73/ff/d61ef9f5d10e671421d1368e87d3525325483ebd7da262b1d3087443662b/zerorpc-${PV}.tar.gz \
1212
file://0001-gevent_zmq-import-enums-from-pyzmq-23.0.0.patch \
13+
file://0002-do-not-use-future.patch \
1314
file://zerorpc-${PV}/debian \
1415
"
1516

16-
PR = "5"
17+
PR = "6"
1718
S = "${WORKDIR}/zerorpc-${PV}"
1819
SRC_URI[sha256sum] = "d2ee247a566fc703f29c277d767f6f61f1e12f76d0402faea4bd815f32cbf37f"

0 commit comments

Comments
 (0)