[gentoo-commits] proj/portage:master commit in: lib/portage/tests/ebuild/, lib/portage/tests/lazyimport/, ...
commit: 71ae5a58fe72bc32dce030210a73ea5c9eeb4a1c Author: Zac Medico gentoo org> AuthorDate: Wed Apr 8 05:13:17 2020 + Commit: Zac Medico gentoo org> CommitDate: Wed Apr 8 05:29:49 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=71ae5a58 Revert "AsynchronousTask: add coroutine async_start method" This reverts commit d66e9ec0b10522528d62e18b83e012c1ec121787. Bug: https://bugs.gentoo.org/716636 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/AsynchronousTask.py| 22 +- lib/_emerge/CompositeTask.py | 17 +++-- lib/_emerge/TaskSequence.py| 7 +-- lib/portage/tests/ebuild/test_doebuild_fd_pipes.py | 6 ++ lib/portage/tests/ebuild/test_doebuild_spawn.py| 6 +++--- lib/portage/tests/ebuild/test_fetch.py | 9 +++-- lib/portage/tests/ebuild/test_ipc_daemon.py| 4 ++-- lib/portage/tests/ebuild/test_spawn.py | 4 ++-- .../test_lazy_import_portage_baseline.py | 6 +++--- lib/portage/tests/locks/test_asynchronous_lock.py | 18 +- lib/portage/tests/process/test_PopenProcess.py | 6 +++--- .../tests/process/test_PopenProcessBlockingIO.py | 4 ++-- lib/portage/tests/process/test_poll.py | 4 ++-- .../util/futures/test_done_callback_after_exit.py | 2 +- .../tests/util/futures/test_iter_completed.py | 16 +--- lib/portage/tests/util/test_file_copier.py | 6 +++--- 16 files changed, 49 insertions(+), 88 deletions(-) diff --git a/lib/_emerge/AsynchronousTask.py b/lib/_emerge/AsynchronousTask.py index b25a146c7..28beb4992 100644 --- a/lib/_emerge/AsynchronousTask.py +++ b/lib/_emerge/AsynchronousTask.py @@ -1,11 +1,10 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import signal from portage import os from portage.util.futures import asyncio -from portage.util.futures.compat_coroutine import coroutine, coroutine_return from portage.util.SlotObject import SlotObject class AsynchronousTask(SlotObject): @@ -23,17 +22,6 @@ class AsynchronousTask(SlotObject): _cancelled_returncode = - signal.SIGINT - @coroutine - def async_start(self): - self._start_hook() - yield self._async_start() - - @coroutine - def _async_start(self): - self._start() - coroutine_return() - yield None - def start(self): """ Start an asynchronous task and then return as soon as possible. @@ -41,10 +29,6 @@ class AsynchronousTask(SlotObject): self._start_hook() self._start() - def _start(self): - self.returncode = os.EX_OK - self._async_wait() - def async_wait(self): """ Wait for returncode asynchronously. Notification is available @@ -65,6 +49,10 @@ class AsynchronousTask(SlotObject): self._async_wait() return waiter + def _start(self): + self.returncode = os.EX_OK + self._async_wait() + def isAlive(self): return self.returncode is None diff --git a/lib/_emerge/CompositeTask.py b/lib/_emerge/CompositeTask.py index 21129758a..72da6fac1 100644 --- a/lib/_emerge/CompositeTask.py +++ b/lib/_emerge/CompositeTask.py @@ -1,10 +1,8 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from _emerge.AsynchronousTask import AsynchronousTask from portage import os -from portage.util.futures import asyncio - class CompositeTask(AsynchronousTask): @@ -100,7 +98,7 @@ class CompositeTask(AsynchronousTask): def _start_task(self, task, exit_handler): """ Register exit handler for the given task, set it - as self._current_task, and call task.async_start(). + as self._current_task, and call task.start(). Subclasses can use this as a generic way to start a task. @@ -112,16 +110,7 @@ class CompositeTask(AsynchronousTask): pass task.addExitListener(exit_handler) self._current_task = task - result = asyncio.ensure_future(task.async_start(), loop=self.scheduler) - result.add_done_callback(self._current_task_start_cb) - - def _current_task_start_cb(self, future): - try: - future.result() - except asyncio.CancelledError: - self.cancelled = True - self._was_cancelled() - self._async_wait() + task.start() def _task_
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/ebuild/, lib/portage/tests/lazyimport/, ...
commit: 71ae5a58fe72bc32dce030210a73ea5c9eeb4a1c Author: Zac Medico gentoo org> AuthorDate: Wed Apr 8 05:13:17 2020 + Commit: Zac Medico gentoo org> CommitDate: Wed Apr 8 05:29:49 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=71ae5a58 Revert "AsynchronousTask: add coroutine async_start method" This reverts commit d66e9ec0b10522528d62e18b83e012c1ec121787. Bug: https://bugs.gentoo.org/716636 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/AsynchronousTask.py| 22 +- lib/_emerge/CompositeTask.py | 17 +++-- lib/_emerge/TaskSequence.py| 7 +-- lib/portage/tests/ebuild/test_doebuild_fd_pipes.py | 6 ++ lib/portage/tests/ebuild/test_doebuild_spawn.py| 6 +++--- lib/portage/tests/ebuild/test_fetch.py | 9 +++-- lib/portage/tests/ebuild/test_ipc_daemon.py| 4 ++-- lib/portage/tests/ebuild/test_spawn.py | 4 ++-- .../test_lazy_import_portage_baseline.py | 6 +++--- lib/portage/tests/locks/test_asynchronous_lock.py | 18 +- lib/portage/tests/process/test_PopenProcess.py | 6 +++--- .../tests/process/test_PopenProcessBlockingIO.py | 4 ++-- lib/portage/tests/process/test_poll.py | 4 ++-- .../util/futures/test_done_callback_after_exit.py | 2 +- .../tests/util/futures/test_iter_completed.py | 16 +--- lib/portage/tests/util/test_file_copier.py | 6 +++--- 16 files changed, 49 insertions(+), 88 deletions(-) diff --git a/lib/_emerge/AsynchronousTask.py b/lib/_emerge/AsynchronousTask.py index b25a146c7..28beb4992 100644 --- a/lib/_emerge/AsynchronousTask.py +++ b/lib/_emerge/AsynchronousTask.py @@ -1,11 +1,10 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import signal from portage import os from portage.util.futures import asyncio -from portage.util.futures.compat_coroutine import coroutine, coroutine_return from portage.util.SlotObject import SlotObject class AsynchronousTask(SlotObject): @@ -23,17 +22,6 @@ class AsynchronousTask(SlotObject): _cancelled_returncode = - signal.SIGINT - @coroutine - def async_start(self): - self._start_hook() - yield self._async_start() - - @coroutine - def _async_start(self): - self._start() - coroutine_return() - yield None - def start(self): """ Start an asynchronous task and then return as soon as possible. @@ -41,10 +29,6 @@ class AsynchronousTask(SlotObject): self._start_hook() self._start() - def _start(self): - self.returncode = os.EX_OK - self._async_wait() - def async_wait(self): """ Wait for returncode asynchronously. Notification is available @@ -65,6 +49,10 @@ class AsynchronousTask(SlotObject): self._async_wait() return waiter + def _start(self): + self.returncode = os.EX_OK + self._async_wait() + def isAlive(self): return self.returncode is None diff --git a/lib/_emerge/CompositeTask.py b/lib/_emerge/CompositeTask.py index 21129758a..72da6fac1 100644 --- a/lib/_emerge/CompositeTask.py +++ b/lib/_emerge/CompositeTask.py @@ -1,10 +1,8 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from _emerge.AsynchronousTask import AsynchronousTask from portage import os -from portage.util.futures import asyncio - class CompositeTask(AsynchronousTask): @@ -100,7 +98,7 @@ class CompositeTask(AsynchronousTask): def _start_task(self, task, exit_handler): """ Register exit handler for the given task, set it - as self._current_task, and call task.async_start(). + as self._current_task, and call task.start(). Subclasses can use this as a generic way to start a task. @@ -112,16 +110,7 @@ class CompositeTask(AsynchronousTask): pass task.addExitListener(exit_handler) self._current_task = task - result = asyncio.ensure_future(task.async_start(), loop=self.scheduler) - result.add_done_callback(self._current_task_start_cb) - - def _current_task_start_cb(self, future): - try: - future.result() - except asyncio.CancelledError: - self.cancelled = True - self._was_cancelled() - self._async_wait() + task.start() def _task_
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/ebuild/, lib/portage/tests/lazyimport/, ...
commit: 71ae5a58fe72bc32dce030210a73ea5c9eeb4a1c Author: Zac Medico gentoo org> AuthorDate: Wed Apr 8 05:13:17 2020 + Commit: Zac Medico gentoo org> CommitDate: Wed Apr 8 05:29:49 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=71ae5a58 Revert "AsynchronousTask: add coroutine async_start method" This reverts commit d66e9ec0b10522528d62e18b83e012c1ec121787. Bug: https://bugs.gentoo.org/716636 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/AsynchronousTask.py| 22 +- lib/_emerge/CompositeTask.py | 17 +++-- lib/_emerge/TaskSequence.py| 7 +-- lib/portage/tests/ebuild/test_doebuild_fd_pipes.py | 6 ++ lib/portage/tests/ebuild/test_doebuild_spawn.py| 6 +++--- lib/portage/tests/ebuild/test_fetch.py | 9 +++-- lib/portage/tests/ebuild/test_ipc_daemon.py| 4 ++-- lib/portage/tests/ebuild/test_spawn.py | 4 ++-- .../test_lazy_import_portage_baseline.py | 6 +++--- lib/portage/tests/locks/test_asynchronous_lock.py | 18 +- lib/portage/tests/process/test_PopenProcess.py | 6 +++--- .../tests/process/test_PopenProcessBlockingIO.py | 4 ++-- lib/portage/tests/process/test_poll.py | 4 ++-- .../util/futures/test_done_callback_after_exit.py | 2 +- .../tests/util/futures/test_iter_completed.py | 16 +--- lib/portage/tests/util/test_file_copier.py | 6 +++--- 16 files changed, 49 insertions(+), 88 deletions(-) diff --git a/lib/_emerge/AsynchronousTask.py b/lib/_emerge/AsynchronousTask.py index b25a146c7..28beb4992 100644 --- a/lib/_emerge/AsynchronousTask.py +++ b/lib/_emerge/AsynchronousTask.py @@ -1,11 +1,10 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import signal from portage import os from portage.util.futures import asyncio -from portage.util.futures.compat_coroutine import coroutine, coroutine_return from portage.util.SlotObject import SlotObject class AsynchronousTask(SlotObject): @@ -23,17 +22,6 @@ class AsynchronousTask(SlotObject): _cancelled_returncode = - signal.SIGINT - @coroutine - def async_start(self): - self._start_hook() - yield self._async_start() - - @coroutine - def _async_start(self): - self._start() - coroutine_return() - yield None - def start(self): """ Start an asynchronous task and then return as soon as possible. @@ -41,10 +29,6 @@ class AsynchronousTask(SlotObject): self._start_hook() self._start() - def _start(self): - self.returncode = os.EX_OK - self._async_wait() - def async_wait(self): """ Wait for returncode asynchronously. Notification is available @@ -65,6 +49,10 @@ class AsynchronousTask(SlotObject): self._async_wait() return waiter + def _start(self): + self.returncode = os.EX_OK + self._async_wait() + def isAlive(self): return self.returncode is None diff --git a/lib/_emerge/CompositeTask.py b/lib/_emerge/CompositeTask.py index 21129758a..72da6fac1 100644 --- a/lib/_emerge/CompositeTask.py +++ b/lib/_emerge/CompositeTask.py @@ -1,10 +1,8 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from _emerge.AsynchronousTask import AsynchronousTask from portage import os -from portage.util.futures import asyncio - class CompositeTask(AsynchronousTask): @@ -100,7 +98,7 @@ class CompositeTask(AsynchronousTask): def _start_task(self, task, exit_handler): """ Register exit handler for the given task, set it - as self._current_task, and call task.async_start(). + as self._current_task, and call task.start(). Subclasses can use this as a generic way to start a task. @@ -112,16 +110,7 @@ class CompositeTask(AsynchronousTask): pass task.addExitListener(exit_handler) self._current_task = task - result = asyncio.ensure_future(task.async_start(), loop=self.scheduler) - result.add_done_callback(self._current_task_start_cb) - - def _current_task_start_cb(self, future): - try: - future.result() - except asyncio.CancelledError: - self.cancelled = True - self._was_cancelled() - self._async_wait() + task.start() def _task_
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/ebuild/, lib/portage/tests/lazyimport/, ...
commit: 71ae5a58fe72bc32dce030210a73ea5c9eeb4a1c Author: Zac Medico gentoo org> AuthorDate: Wed Apr 8 05:13:17 2020 + Commit: Zac Medico gentoo org> CommitDate: Wed Apr 8 05:29:49 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=71ae5a58 Revert "AsynchronousTask: add coroutine async_start method" This reverts commit d66e9ec0b10522528d62e18b83e012c1ec121787. Bug: https://bugs.gentoo.org/716636 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/AsynchronousTask.py| 22 +- lib/_emerge/CompositeTask.py | 17 +++-- lib/_emerge/TaskSequence.py| 7 +-- lib/portage/tests/ebuild/test_doebuild_fd_pipes.py | 6 ++ lib/portage/tests/ebuild/test_doebuild_spawn.py| 6 +++--- lib/portage/tests/ebuild/test_fetch.py | 9 +++-- lib/portage/tests/ebuild/test_ipc_daemon.py| 4 ++-- lib/portage/tests/ebuild/test_spawn.py | 4 ++-- .../test_lazy_import_portage_baseline.py | 6 +++--- lib/portage/tests/locks/test_asynchronous_lock.py | 18 +- lib/portage/tests/process/test_PopenProcess.py | 6 +++--- .../tests/process/test_PopenProcessBlockingIO.py | 4 ++-- lib/portage/tests/process/test_poll.py | 4 ++-- .../util/futures/test_done_callback_after_exit.py | 2 +- .../tests/util/futures/test_iter_completed.py | 16 +--- lib/portage/tests/util/test_file_copier.py | 6 +++--- 16 files changed, 49 insertions(+), 88 deletions(-) diff --git a/lib/_emerge/AsynchronousTask.py b/lib/_emerge/AsynchronousTask.py index b25a146c7..28beb4992 100644 --- a/lib/_emerge/AsynchronousTask.py +++ b/lib/_emerge/AsynchronousTask.py @@ -1,11 +1,10 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import signal from portage import os from portage.util.futures import asyncio -from portage.util.futures.compat_coroutine import coroutine, coroutine_return from portage.util.SlotObject import SlotObject class AsynchronousTask(SlotObject): @@ -23,17 +22,6 @@ class AsynchronousTask(SlotObject): _cancelled_returncode = - signal.SIGINT - @coroutine - def async_start(self): - self._start_hook() - yield self._async_start() - - @coroutine - def _async_start(self): - self._start() - coroutine_return() - yield None - def start(self): """ Start an asynchronous task and then return as soon as possible. @@ -41,10 +29,6 @@ class AsynchronousTask(SlotObject): self._start_hook() self._start() - def _start(self): - self.returncode = os.EX_OK - self._async_wait() - def async_wait(self): """ Wait for returncode asynchronously. Notification is available @@ -65,6 +49,10 @@ class AsynchronousTask(SlotObject): self._async_wait() return waiter + def _start(self): + self.returncode = os.EX_OK + self._async_wait() + def isAlive(self): return self.returncode is None diff --git a/lib/_emerge/CompositeTask.py b/lib/_emerge/CompositeTask.py index 21129758a..72da6fac1 100644 --- a/lib/_emerge/CompositeTask.py +++ b/lib/_emerge/CompositeTask.py @@ -1,10 +1,8 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from _emerge.AsynchronousTask import AsynchronousTask from portage import os -from portage.util.futures import asyncio - class CompositeTask(AsynchronousTask): @@ -100,7 +98,7 @@ class CompositeTask(AsynchronousTask): def _start_task(self, task, exit_handler): """ Register exit handler for the given task, set it - as self._current_task, and call task.async_start(). + as self._current_task, and call task.start(). Subclasses can use this as a generic way to start a task. @@ -112,16 +110,7 @@ class CompositeTask(AsynchronousTask): pass task.addExitListener(exit_handler) self._current_task = task - result = asyncio.ensure_future(task.async_start(), loop=self.scheduler) - result.add_done_callback(self._current_task_start_cb) - - def _current_task_start_cb(self, future): - try: - future.result() - except asyncio.CancelledError: - self.cancelled = True - self._was_cancelled() - self._async_wait() + task.start() def _task_
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/ebuild/, lib/portage/tests/lazyimport/, ...
commit: 71ae5a58fe72bc32dce030210a73ea5c9eeb4a1c Author: Zac Medico gentoo org> AuthorDate: Wed Apr 8 05:13:17 2020 + Commit: Zac Medico gentoo org> CommitDate: Wed Apr 8 05:29:49 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=71ae5a58 Revert "AsynchronousTask: add coroutine async_start method" This reverts commit d66e9ec0b10522528d62e18b83e012c1ec121787. Bug: https://bugs.gentoo.org/716636 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/AsynchronousTask.py| 22 +- lib/_emerge/CompositeTask.py | 17 +++-- lib/_emerge/TaskSequence.py| 7 +-- lib/portage/tests/ebuild/test_doebuild_fd_pipes.py | 6 ++ lib/portage/tests/ebuild/test_doebuild_spawn.py| 6 +++--- lib/portage/tests/ebuild/test_fetch.py | 9 +++-- lib/portage/tests/ebuild/test_ipc_daemon.py| 4 ++-- lib/portage/tests/ebuild/test_spawn.py | 4 ++-- .../test_lazy_import_portage_baseline.py | 6 +++--- lib/portage/tests/locks/test_asynchronous_lock.py | 18 +- lib/portage/tests/process/test_PopenProcess.py | 6 +++--- .../tests/process/test_PopenProcessBlockingIO.py | 4 ++-- lib/portage/tests/process/test_poll.py | 4 ++-- .../util/futures/test_done_callback_after_exit.py | 2 +- .../tests/util/futures/test_iter_completed.py | 16 +--- lib/portage/tests/util/test_file_copier.py | 6 +++--- 16 files changed, 49 insertions(+), 88 deletions(-) diff --git a/lib/_emerge/AsynchronousTask.py b/lib/_emerge/AsynchronousTask.py index b25a146c7..28beb4992 100644 --- a/lib/_emerge/AsynchronousTask.py +++ b/lib/_emerge/AsynchronousTask.py @@ -1,11 +1,10 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import signal from portage import os from portage.util.futures import asyncio -from portage.util.futures.compat_coroutine import coroutine, coroutine_return from portage.util.SlotObject import SlotObject class AsynchronousTask(SlotObject): @@ -23,17 +22,6 @@ class AsynchronousTask(SlotObject): _cancelled_returncode = - signal.SIGINT - @coroutine - def async_start(self): - self._start_hook() - yield self._async_start() - - @coroutine - def _async_start(self): - self._start() - coroutine_return() - yield None - def start(self): """ Start an asynchronous task and then return as soon as possible. @@ -41,10 +29,6 @@ class AsynchronousTask(SlotObject): self._start_hook() self._start() - def _start(self): - self.returncode = os.EX_OK - self._async_wait() - def async_wait(self): """ Wait for returncode asynchronously. Notification is available @@ -65,6 +49,10 @@ class AsynchronousTask(SlotObject): self._async_wait() return waiter + def _start(self): + self.returncode = os.EX_OK + self._async_wait() + def isAlive(self): return self.returncode is None diff --git a/lib/_emerge/CompositeTask.py b/lib/_emerge/CompositeTask.py index 21129758a..72da6fac1 100644 --- a/lib/_emerge/CompositeTask.py +++ b/lib/_emerge/CompositeTask.py @@ -1,10 +1,8 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from _emerge.AsynchronousTask import AsynchronousTask from portage import os -from portage.util.futures import asyncio - class CompositeTask(AsynchronousTask): @@ -100,7 +98,7 @@ class CompositeTask(AsynchronousTask): def _start_task(self, task, exit_handler): """ Register exit handler for the given task, set it - as self._current_task, and call task.async_start(). + as self._current_task, and call task.start(). Subclasses can use this as a generic way to start a task. @@ -112,16 +110,7 @@ class CompositeTask(AsynchronousTask): pass task.addExitListener(exit_handler) self._current_task = task - result = asyncio.ensure_future(task.async_start(), loop=self.scheduler) - result.add_done_callback(self._current_task_start_cb) - - def _current_task_start_cb(self, future): - try: - future.result() - except asyncio.CancelledError: - self.cancelled = True - self._was_cancelled() - self._async_wait() + task.start() def _task_
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/ebuild/, lib/portage/tests/lazyimport/, ...
commit: 71ae5a58fe72bc32dce030210a73ea5c9eeb4a1c Author: Zac Medico gentoo org> AuthorDate: Wed Apr 8 05:13:17 2020 + Commit: Zac Medico gentoo org> CommitDate: Wed Apr 8 05:29:49 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=71ae5a58 Revert "AsynchronousTask: add coroutine async_start method" This reverts commit d66e9ec0b10522528d62e18b83e012c1ec121787. Bug: https://bugs.gentoo.org/716636 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/AsynchronousTask.py| 22 +- lib/_emerge/CompositeTask.py | 17 +++-- lib/_emerge/TaskSequence.py| 7 +-- lib/portage/tests/ebuild/test_doebuild_fd_pipes.py | 6 ++ lib/portage/tests/ebuild/test_doebuild_spawn.py| 6 +++--- lib/portage/tests/ebuild/test_fetch.py | 9 +++-- lib/portage/tests/ebuild/test_ipc_daemon.py| 4 ++-- lib/portage/tests/ebuild/test_spawn.py | 4 ++-- .../test_lazy_import_portage_baseline.py | 6 +++--- lib/portage/tests/locks/test_asynchronous_lock.py | 18 +- lib/portage/tests/process/test_PopenProcess.py | 6 +++--- .../tests/process/test_PopenProcessBlockingIO.py | 4 ++-- lib/portage/tests/process/test_poll.py | 4 ++-- .../util/futures/test_done_callback_after_exit.py | 2 +- .../tests/util/futures/test_iter_completed.py | 16 +--- lib/portage/tests/util/test_file_copier.py | 6 +++--- 16 files changed, 49 insertions(+), 88 deletions(-) diff --git a/lib/_emerge/AsynchronousTask.py b/lib/_emerge/AsynchronousTask.py index b25a146c7..28beb4992 100644 --- a/lib/_emerge/AsynchronousTask.py +++ b/lib/_emerge/AsynchronousTask.py @@ -1,11 +1,10 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import signal from portage import os from portage.util.futures import asyncio -from portage.util.futures.compat_coroutine import coroutine, coroutine_return from portage.util.SlotObject import SlotObject class AsynchronousTask(SlotObject): @@ -23,17 +22,6 @@ class AsynchronousTask(SlotObject): _cancelled_returncode = - signal.SIGINT - @coroutine - def async_start(self): - self._start_hook() - yield self._async_start() - - @coroutine - def _async_start(self): - self._start() - coroutine_return() - yield None - def start(self): """ Start an asynchronous task and then return as soon as possible. @@ -41,10 +29,6 @@ class AsynchronousTask(SlotObject): self._start_hook() self._start() - def _start(self): - self.returncode = os.EX_OK - self._async_wait() - def async_wait(self): """ Wait for returncode asynchronously. Notification is available @@ -65,6 +49,10 @@ class AsynchronousTask(SlotObject): self._async_wait() return waiter + def _start(self): + self.returncode = os.EX_OK + self._async_wait() + def isAlive(self): return self.returncode is None diff --git a/lib/_emerge/CompositeTask.py b/lib/_emerge/CompositeTask.py index 21129758a..72da6fac1 100644 --- a/lib/_emerge/CompositeTask.py +++ b/lib/_emerge/CompositeTask.py @@ -1,10 +1,8 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from _emerge.AsynchronousTask import AsynchronousTask from portage import os -from portage.util.futures import asyncio - class CompositeTask(AsynchronousTask): @@ -100,7 +98,7 @@ class CompositeTask(AsynchronousTask): def _start_task(self, task, exit_handler): """ Register exit handler for the given task, set it - as self._current_task, and call task.async_start(). + as self._current_task, and call task.start(). Subclasses can use this as a generic way to start a task. @@ -112,16 +110,7 @@ class CompositeTask(AsynchronousTask): pass task.addExitListener(exit_handler) self._current_task = task - result = asyncio.ensure_future(task.async_start(), loop=self.scheduler) - result.add_done_callback(self._current_task_start_cb) - - def _current_task_start_cb(self, future): - try: - future.result() - except asyncio.CancelledError: - self.cancelled = True - self._was_cancelled() - self._async_wait() + task.start() def _task_
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/ebuild/, lib/portage/tests/lazyimport/, ...
commit: 71ae5a58fe72bc32dce030210a73ea5c9eeb4a1c Author: Zac Medico gentoo org> AuthorDate: Wed Apr 8 05:13:17 2020 + Commit: Zac Medico gentoo org> CommitDate: Wed Apr 8 05:29:49 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=71ae5a58 Revert "AsynchronousTask: add coroutine async_start method" This reverts commit d66e9ec0b10522528d62e18b83e012c1ec121787. Bug: https://bugs.gentoo.org/716636 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/AsynchronousTask.py| 22 +- lib/_emerge/CompositeTask.py | 17 +++-- lib/_emerge/TaskSequence.py| 7 +-- lib/portage/tests/ebuild/test_doebuild_fd_pipes.py | 6 ++ lib/portage/tests/ebuild/test_doebuild_spawn.py| 6 +++--- lib/portage/tests/ebuild/test_fetch.py | 9 +++-- lib/portage/tests/ebuild/test_ipc_daemon.py| 4 ++-- lib/portage/tests/ebuild/test_spawn.py | 4 ++-- .../test_lazy_import_portage_baseline.py | 6 +++--- lib/portage/tests/locks/test_asynchronous_lock.py | 18 +- lib/portage/tests/process/test_PopenProcess.py | 6 +++--- .../tests/process/test_PopenProcessBlockingIO.py | 4 ++-- lib/portage/tests/process/test_poll.py | 4 ++-- .../util/futures/test_done_callback_after_exit.py | 2 +- .../tests/util/futures/test_iter_completed.py | 16 +--- lib/portage/tests/util/test_file_copier.py | 6 +++--- 16 files changed, 49 insertions(+), 88 deletions(-) diff --git a/lib/_emerge/AsynchronousTask.py b/lib/_emerge/AsynchronousTask.py index b25a146c7..28beb4992 100644 --- a/lib/_emerge/AsynchronousTask.py +++ b/lib/_emerge/AsynchronousTask.py @@ -1,11 +1,10 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import signal from portage import os from portage.util.futures import asyncio -from portage.util.futures.compat_coroutine import coroutine, coroutine_return from portage.util.SlotObject import SlotObject class AsynchronousTask(SlotObject): @@ -23,17 +22,6 @@ class AsynchronousTask(SlotObject): _cancelled_returncode = - signal.SIGINT - @coroutine - def async_start(self): - self._start_hook() - yield self._async_start() - - @coroutine - def _async_start(self): - self._start() - coroutine_return() - yield None - def start(self): """ Start an asynchronous task and then return as soon as possible. @@ -41,10 +29,6 @@ class AsynchronousTask(SlotObject): self._start_hook() self._start() - def _start(self): - self.returncode = os.EX_OK - self._async_wait() - def async_wait(self): """ Wait for returncode asynchronously. Notification is available @@ -65,6 +49,10 @@ class AsynchronousTask(SlotObject): self._async_wait() return waiter + def _start(self): + self.returncode = os.EX_OK + self._async_wait() + def isAlive(self): return self.returncode is None diff --git a/lib/_emerge/CompositeTask.py b/lib/_emerge/CompositeTask.py index 21129758a..72da6fac1 100644 --- a/lib/_emerge/CompositeTask.py +++ b/lib/_emerge/CompositeTask.py @@ -1,10 +1,8 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from _emerge.AsynchronousTask import AsynchronousTask from portage import os -from portage.util.futures import asyncio - class CompositeTask(AsynchronousTask): @@ -100,7 +98,7 @@ class CompositeTask(AsynchronousTask): def _start_task(self, task, exit_handler): """ Register exit handler for the given task, set it - as self._current_task, and call task.async_start(). + as self._current_task, and call task.start(). Subclasses can use this as a generic way to start a task. @@ -112,16 +110,7 @@ class CompositeTask(AsynchronousTask): pass task.addExitListener(exit_handler) self._current_task = task - result = asyncio.ensure_future(task.async_start(), loop=self.scheduler) - result.add_done_callback(self._current_task_start_cb) - - def _current_task_start_cb(self, future): - try: - future.result() - except asyncio.CancelledError: - self.cancelled = True - self._was_cancelled() - self._async_wait() + task.start() def _task_
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/ebuild/, lib/portage/tests/lazyimport/, ...
commit: 71ae5a58fe72bc32dce030210a73ea5c9eeb4a1c Author: Zac Medico gentoo org> AuthorDate: Wed Apr 8 05:13:17 2020 + Commit: Zac Medico gentoo org> CommitDate: Wed Apr 8 05:29:49 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=71ae5a58 Revert "AsynchronousTask: add coroutine async_start method" This reverts commit d66e9ec0b10522528d62e18b83e012c1ec121787. Bug: https://bugs.gentoo.org/716636 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/AsynchronousTask.py| 22 +- lib/_emerge/CompositeTask.py | 17 +++-- lib/_emerge/TaskSequence.py| 7 +-- lib/portage/tests/ebuild/test_doebuild_fd_pipes.py | 6 ++ lib/portage/tests/ebuild/test_doebuild_spawn.py| 6 +++--- lib/portage/tests/ebuild/test_fetch.py | 9 +++-- lib/portage/tests/ebuild/test_ipc_daemon.py| 4 ++-- lib/portage/tests/ebuild/test_spawn.py | 4 ++-- .../test_lazy_import_portage_baseline.py | 6 +++--- lib/portage/tests/locks/test_asynchronous_lock.py | 18 +- lib/portage/tests/process/test_PopenProcess.py | 6 +++--- .../tests/process/test_PopenProcessBlockingIO.py | 4 ++-- lib/portage/tests/process/test_poll.py | 4 ++-- .../util/futures/test_done_callback_after_exit.py | 2 +- .../tests/util/futures/test_iter_completed.py | 16 +--- lib/portage/tests/util/test_file_copier.py | 6 +++--- 16 files changed, 49 insertions(+), 88 deletions(-) diff --git a/lib/_emerge/AsynchronousTask.py b/lib/_emerge/AsynchronousTask.py index b25a146c7..28beb4992 100644 --- a/lib/_emerge/AsynchronousTask.py +++ b/lib/_emerge/AsynchronousTask.py @@ -1,11 +1,10 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import signal from portage import os from portage.util.futures import asyncio -from portage.util.futures.compat_coroutine import coroutine, coroutine_return from portage.util.SlotObject import SlotObject class AsynchronousTask(SlotObject): @@ -23,17 +22,6 @@ class AsynchronousTask(SlotObject): _cancelled_returncode = - signal.SIGINT - @coroutine - def async_start(self): - self._start_hook() - yield self._async_start() - - @coroutine - def _async_start(self): - self._start() - coroutine_return() - yield None - def start(self): """ Start an asynchronous task and then return as soon as possible. @@ -41,10 +29,6 @@ class AsynchronousTask(SlotObject): self._start_hook() self._start() - def _start(self): - self.returncode = os.EX_OK - self._async_wait() - def async_wait(self): """ Wait for returncode asynchronously. Notification is available @@ -65,6 +49,10 @@ class AsynchronousTask(SlotObject): self._async_wait() return waiter + def _start(self): + self.returncode = os.EX_OK + self._async_wait() + def isAlive(self): return self.returncode is None diff --git a/lib/_emerge/CompositeTask.py b/lib/_emerge/CompositeTask.py index 21129758a..72da6fac1 100644 --- a/lib/_emerge/CompositeTask.py +++ b/lib/_emerge/CompositeTask.py @@ -1,10 +1,8 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from _emerge.AsynchronousTask import AsynchronousTask from portage import os -from portage.util.futures import asyncio - class CompositeTask(AsynchronousTask): @@ -100,7 +98,7 @@ class CompositeTask(AsynchronousTask): def _start_task(self, task, exit_handler): """ Register exit handler for the given task, set it - as self._current_task, and call task.async_start(). + as self._current_task, and call task.start(). Subclasses can use this as a generic way to start a task. @@ -112,16 +110,7 @@ class CompositeTask(AsynchronousTask): pass task.addExitListener(exit_handler) self._current_task = task - result = asyncio.ensure_future(task.async_start(), loop=self.scheduler) - result.add_done_callback(self._current_task_start_cb) - - def _current_task_start_cb(self, future): - try: - future.result() - except asyncio.CancelledError: - self.cancelled = True - self._was_cancelled() - self._async_wait() + task.start() def _task_