Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: lib/_emerge/
Date: Tue, 21 Sep 2021 05:51:56
Message-Id: 1632202430.371049edb5ba6ffc472b7f21770ca7b48d9ffa3b.zmedico@gentoo
1 commit: 371049edb5ba6ffc472b7f21770ca7b48d9ffa3b
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Tue Sep 21 04:57:50 2021 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 21 05:33:50 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=371049ed
7
8 SequentialTaskQueue: convert compat coroutine to async
9
10 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
11
12 lib/_emerge/SequentialTaskQueue.py | 10 ++++------
13 1 file changed, 4 insertions(+), 6 deletions(-)
14
15 diff --git a/lib/_emerge/SequentialTaskQueue.py b/lib/_emerge/SequentialTaskQueue.py
16 index 5bf803ec1..829f44ba6 100644
17 --- a/lib/_emerge/SequentialTaskQueue.py
18 +++ b/lib/_emerge/SequentialTaskQueue.py
19 @@ -1,10 +1,9 @@
20 -# Copyright 1999-2020 Gentoo Authors
21 +# Copyright 1999-2021 Gentoo Authors
22 # Distributed under the terms of the GNU General Public License v2
23
24 from collections import deque
25
26 from portage.util.futures import asyncio
27 -from portage.util.futures.compat_coroutine import coroutine
28 from portage.util.SlotObject import SlotObject
29
30
31 @@ -69,8 +68,7 @@ class SequentialTaskQueue(SlotObject):
32 for task in list(self.running_tasks):
33 task.cancel()
34
35 - @coroutine
36 - def wait(self, loop=None):
37 + async def wait(self, loop=None):
38 """
39 Wait for the queue to become empty. This method is a coroutine.
40 """
41 @@ -78,9 +76,9 @@ class SequentialTaskQueue(SlotObject):
42 task = next(iter(self.running_tasks), None)
43 if task is None:
44 # Wait for self.running_tasks to populate.
45 - yield asyncio.sleep(0, loop=loop)
46 + await asyncio.sleep(0, loop=loop)
47 else:
48 - yield task.async_wait()
49 + await task.async_wait()
50
51 def __bool__(self):
52 return bool(self._task_queue or self.running_tasks)