commit: 03b4af7b288589d0fa475af2a2c9f66022203649
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 7 14:43:59 2021 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Mar 7 14:44:16 2021 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=03b4af7b
BuildLogger: Use async and await syntax
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
lib/portage/util/_async/BuildLogger.py | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/lib/portage/util/_async/BuildLogger.py
b/lib/portage/util/_async/BuildLogger.py
index 5a9c076b6..896e4d7b5 100644
--- a/lib/portage/util/_async/BuildLogger.py
+++ b/lib/portage/util/_async/BuildLogger.py
@@ -1,4 +1,4 @@
-# Copyright 2020 Gentoo Authors
+# Copyright 2020-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
import functools
@@ -11,7 +11,6 @@ from portage.util import shlex_split
from portage.util._async.PipeLogger import PipeLogger
from portage.util._async.PopenProcess import PopenProcess
from portage.util.futures import asyncio
-from portage.util.futures.compat_coroutine import coroutine
class BuildLogger(AsynchronousTask):
"""
@@ -78,16 +77,15 @@ class BuildLogger(AsynchronousTask):
pipe_logger.start()
self._main_task_cancel = functools.partial(self._main_cancel,
filter_proc, pipe_logger)
- self._main_task = asyncio.ensure_future(self._main(filter_proc,
pipe_logger, loop=self.scheduler), loop=self.scheduler)
+ self._main_task = asyncio.ensure_future(self._main(filter_proc,
pipe_logger), loop=self.scheduler)
self._main_task.add_done_callback(self._main_exit)
- @coroutine
- def _main(self, filter_proc, pipe_logger, loop=None):
+ async def _main(self, filter_proc, pipe_logger):
try:
if pipe_logger.poll() is None:
- yield pipe_logger.async_wait()
+ await pipe_logger.async_wait()
if filter_proc is not None and filter_proc.poll() is
None:
- yield filter_proc.async_wait()
+ await filter_proc.async_wait()
except asyncio.CancelledError:
self._main_cancel(filter_proc, pipe_logger)
raise