fix: use trio.lowlevel instead of trio.hazmat with Trio >= 0.15
Signed-off-by: zhangliangpengkun <zhangliangpengkun@xfusion.com>
This commit is contained in:
parent
32dec01552
commit
b19920a6c8
53
fix-use-trio-lowlevel-instead-of-trio.patch
Normal file
53
fix-use-trio-lowlevel-instead-of-trio.patch
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
From a57465c94ba3a401531853b42e1bd071bcd2e93c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tamas Nepusz <ntamas@gmail.com>
|
||||||
|
Date: Mon, 2 Nov 2020 15:48:51 +0100
|
||||||
|
Subject: [PATCH] fix: use trio.lowlevel instead of trio.hazmat with Trio >=
|
||||||
|
0.15
|
||||||
|
|
||||||
|
---
|
||||||
|
urwid/_async_kw_event_loop.py | 18 +++++++++++++++---
|
||||||
|
1 file changed, 15 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/urwid/_async_kw_event_loop.py b/urwid/_async_kw_event_loop.py
|
||||||
|
index d146a49..4038405 100644
|
||||||
|
--- a/urwid/_async_kw_event_loop.py
|
||||||
|
+++ b/urwid/_async_kw_event_loop.py
|
||||||
|
@@ -42,7 +42,11 @@ class TrioEventLoop(EventLoop):
|
||||||
|
self._nursery = None
|
||||||
|
|
||||||
|
self._sleep = trio.sleep
|
||||||
|
- self._wait_readable = trio.hazmat.wait_readable
|
||||||
|
+ try:
|
||||||
|
+ self._wait_readable = trio.lowlevel.wait_readable
|
||||||
|
+ except AttributeError:
|
||||||
|
+ # Trio 0.14 or older
|
||||||
|
+ self._wait_readable = trio.hazmat.wait_readable
|
||||||
|
|
||||||
|
def alarm(self, seconds, callback):
|
||||||
|
"""Calls `callback()` a given time from now. No parameters are passed
|
||||||
|
@@ -155,12 +159,20 @@ class TrioEventLoop(EventLoop):
|
||||||
|
|
||||||
|
emulate_idle_callbacks = TrioIdleCallbackInstrument()
|
||||||
|
|
||||||
|
+ try:
|
||||||
|
+ add_instrument = self._trio.lowlevel.add_instrument
|
||||||
|
+ remove_instrument = self._trio.lowlevel.remove_instrument
|
||||||
|
+ except AttributeError:
|
||||||
|
+ # Trio 0.14 or older
|
||||||
|
+ add_instrument = self._trio.hazmat.add_instrument
|
||||||
|
+ remove_instrument = self._trio.hazmat.remove_instrument
|
||||||
|
+
|
||||||
|
with self._trio.MultiError.catch(self._handle_main_loop_exception):
|
||||||
|
- self._trio.hazmat.add_instrument(emulate_idle_callbacks)
|
||||||
|
+ add_instrument(emulate_idle_callbacks)
|
||||||
|
try:
|
||||||
|
await self._main_task()
|
||||||
|
finally:
|
||||||
|
- self._trio.hazmat.remove_instrument(emulate_idle_callbacks)
|
||||||
|
+ remove_instrument(emulate_idle_callbacks)
|
||||||
|
|
||||||
|
def watch_file(self, fd, callback):
|
||||||
|
"""Calls `callback()` when the given file descriptor has some data
|
||||||
|
--
|
||||||
|
2.39.0.windows.2
|
||||||
|
|
||||||
@ -1,10 +1,11 @@
|
|||||||
Name: python-urwid
|
Name: python-urwid
|
||||||
Version: 2.1.2
|
Version: 2.1.2
|
||||||
Release: 2
|
Release: 3
|
||||||
Summary: Console user interface library
|
Summary: Console user interface library
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
URL: http://excess.org/urwid/
|
URL: http://excess.org/urwid/
|
||||||
Source0: https://pypi.python.org/packages/source/u/urwid/urwid-%{version}.tar.gz
|
Source0: https://pypi.python.org/packages/source/u/urwid/urwid-%{version}.tar.gz
|
||||||
|
Patch0: fix-use-trio-lowlevel-instead-of-trio.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Urwid is a console user interface library for Python. It includes
|
Urwid is a console user interface library for Python. It includes
|
||||||
@ -40,6 +41,9 @@ PYTHON=%{__python3} %{__python3} setup.py test
|
|||||||
%{python3_sitearch}/urwid-%{version}*.egg-info
|
%{python3_sitearch}/urwid-%{version}*.egg-info
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Jan 13 2023 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 2.1.2-3
|
||||||
|
- fix-use-trio-lowlevel-instead-of-trio.patch
|
||||||
|
|
||||||
* Tue Jul 27 2021 liyanan <liyanan32@huawei.com> - 2.1.2-2
|
* Tue Jul 27 2021 liyanan <liyanan32@huawei.com> - 2.1.2-2
|
||||||
- Add buildrequires glibc-all-langpacks to fix build failed
|
- Add buildrequires glibc-all-langpacks to fix build failed
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user