1 |
commit: 3d81af6440cfd20cd007568779d6129083f1de24 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Apr 28 22:45:56 2018 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Apr 28 22:45:56 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3d81af64 |
7 |
|
8 |
AsyncScheduler: fix deprecated _wait usage (bug 653856) |
9 |
|
10 |
Override AsynchronousTask._async_wait() for cleanup, since |
11 |
AsynchronousTask._wait() is deprecated. |
12 |
|
13 |
Bug: https://bugs.gentoo.org/653856 |
14 |
|
15 |
pym/portage/util/_async/AsyncScheduler.py | 13 +++++++++++-- |
16 |
1 file changed, 11 insertions(+), 2 deletions(-) |
17 |
|
18 |
diff --git a/pym/portage/util/_async/AsyncScheduler.py b/pym/portage/util/_async/AsyncScheduler.py |
19 |
index 1b870c771..2ddbaa885 100644 |
20 |
--- a/pym/portage/util/_async/AsyncScheduler.py |
21 |
+++ b/pym/portage/util/_async/AsyncScheduler.py |
22 |
@@ -29,12 +29,11 @@ class AsyncScheduler(AsynchronousTask, PollScheduler): |
23 |
|
24 |
def _poll(self): |
25 |
if not (self._is_work_scheduled() or self._keep_scheduling()): |
26 |
- self._cleanup() |
27 |
- |
28 |
if self._error_count > 0: |
29 |
self.returncode = 1 |
30 |
else: |
31 |
self.returncode = os.EX_OK |
32 |
+ self._async_wait() |
33 |
return self.returncode |
34 |
|
35 |
def _cancel(self): |
36 |
@@ -91,7 +90,17 @@ class AsyncScheduler(AsynchronousTask, PollScheduler): |
37 |
self._event_loop.source_remove(self._loadavg_check_id) |
38 |
self._loadavg_check_id = None |
39 |
|
40 |
+ def _async_wait(self): |
41 |
+ """ |
42 |
+ Override _async_wait to call self._cleanup(). |
43 |
+ """ |
44 |
+ self._cleanup() |
45 |
+ super(AsyncScheduler, self)._async_wait() |
46 |
+ |
47 |
def _wait(self): |
48 |
+ """ |
49 |
+ Deprecated. Use _async_wait() instead. |
50 |
+ """ |
51 |
# Loop while there are jobs to be scheduled. |
52 |
while self._keep_scheduling(): |
53 |
self._event_loop.iteration() |