commit: 371049edb5ba6ffc472b7f21770ca7b48d9ffa3b
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 21 04:57:50 2021 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Sep 21 05:33:50 2021 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=371049ed
SequentialTaskQueue: convert compat coroutine to async
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
lib/_emerge/SequentialTaskQueue.py | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/lib/_emerge/SequentialTaskQueue.py
b/lib/_emerge/SequentialTaskQueue.py
index 5bf803ec1..829f44ba6 100644
--- a/lib/_emerge/SequentialTaskQueue.py
+++ b/lib/_emerge/SequentialTaskQueue.py
@@ -1,10 +1,9 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
from collections import deque
from portage.util.futures import asyncio
-from portage.util.futures.compat_coroutine import coroutine
from portage.util.SlotObject import SlotObject
@@ -69,8 +68,7 @@ class SequentialTaskQueue(SlotObject):
for task in list(self.running_tasks):
task.cancel()
- @coroutine
- def wait(self, loop=None):
+ async def wait(self, loop=None):
"""
Wait for the queue to become empty. This method is a coroutine.
"""
@@ -78,9 +76,9 @@ class SequentialTaskQueue(SlotObject):
task = next(iter(self.running_tasks), None)
if task is None:
# Wait for self.running_tasks to populate.
- yield asyncio.sleep(0, loop=loop)
+ await asyncio.sleep(0, loop=loop)
else:
- yield task.async_wait()
+ await task.async_wait()
def __bool__(self):
return bool(self._task_queue or self.running_tasks)