Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/
Date: Sun, 29 Apr 2018 22:24:27
Message-Id: 1525038067.4da425966a82bfbbb68908010995941a44b45598.zmedico@gentoo
1 commit: 4da425966a82bfbbb68908010995941a44b45598
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sun Apr 29 21:39:28 2018 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sun Apr 29 21:41:07 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=4da42596
7
8 AbstractEbuildProcess: call_later asyncio compat (bug 591760)
9
10 Use call_later for asyncio compatibility.
11
12 Bug: https://bugs.gentoo.org/591760
13
14 pym/_emerge/AbstractEbuildProcess.py | 11 ++++-------
15 pym/_emerge/SubProcess.py | 2 +-
16 2 files changed, 5 insertions(+), 8 deletions(-)
17
18 diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
19 index 2ed175750..ccc3b8e32 100644
20 --- a/pym/_emerge/AbstractEbuildProcess.py
21 +++ b/pym/_emerge/AbstractEbuildProcess.py
22 @@ -37,7 +37,7 @@ class AbstractEbuildProcess(SpawnProcess):
23 # doesn't hurt to be generous here since the scheduler
24 # continues to process events during this period, and it can
25 # return long before the timeout expires.
26 - _exit_timeout = 10000 # 10 seconds
27 + _exit_timeout = 10 # seconds
28
29 # The EbuildIpcDaemon support is well tested, but this variable
30 # is left so we can temporarily disable it if any issues arise.
31 @@ -247,7 +247,7 @@ class AbstractEbuildProcess(SpawnProcess):
32 if self._registered:
33 # Let the process exit naturally, if possible.
34 self._exit_timeout_id = \
35 - self.scheduler.timeout_add(self._exit_timeout,
36 + self.scheduler.call_later(self._exit_timeout,
37 self._exit_command_timeout_cb)
38
39 def _exit_command_timeout_cb(self):
40 @@ -258,17 +258,14 @@ class AbstractEbuildProcess(SpawnProcess):
41 # being killed by a signal.
42 self.cancel()
43 self._exit_timeout_id = \
44 - self.scheduler.timeout_add(self._cancel_timeout,
45 + self.scheduler.call_later(self._cancel_timeout,
46 self._cancel_timeout_cb)
47 else:
48 self._exit_timeout_id = None
49
50 - return False # only run once
51 -
52 def _cancel_timeout_cb(self):
53 self._exit_timeout_id = None
54 self._async_waitpid()
55 - return False # only run once
56
57 def _orphan_process_warn(self):
58 phase = self.phase
59 @@ -363,7 +360,7 @@ class AbstractEbuildProcess(SpawnProcess):
60 SpawnProcess._async_waitpid_cb(self, *args, **kwargs)
61
62 if self._exit_timeout_id is not None:
63 - self.scheduler.source_remove(self._exit_timeout_id)
64 + self._exit_timeout_id.cancel()
65 self._exit_timeout_id = None
66
67 if self._ipc_daemon is not None:
68
69 diff --git a/pym/_emerge/SubProcess.py b/pym/_emerge/SubProcess.py
70 index aa4778737..a37482ca4 100644
71 --- a/pym/_emerge/SubProcess.py
72 +++ b/pym/_emerge/SubProcess.py
73 @@ -16,7 +16,7 @@ class SubProcess(AbstractPollTask):
74
75 # This is how much time we allow for waitpid to succeed after
76 # we've sent a kill signal to our subprocess.
77 - _cancel_timeout = 1000 # 1 second
78 + _cancel_timeout = 1 # seconds
79
80 def _poll(self):
81 # Simply rely on _async_waitpid_cb to set the returncode.