* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/util/futures/, pym/portage/dbapi/, pym/portage/util/futures/, ...
@ 2018-05-01 6:48 99% Zac Medico
0 siblings, 0 replies; 1+ results
From: Zac Medico @ 2018-05-01 6:48 UTC (permalink / raw
To: gentoo-commits
commit: 90d78484d6be481a9caf22c017c62ea43f8ffe33
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue May 1 06:22:10 2018 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue May 1 06:46:27 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=90d78484
_PortageEventLoop: add _asyncio_* properties for internal use
It's better to avoid accessing the _PortageEventLoop._loop
attribute which exposes *all* EventLoop methods, therefore expose
_asyncio_child_watcher and _asyncio_wrapper attributes for use by
portage internals, providing minimal compatibility between
_PortageEventloop and EventLoop.
pym/portage/dbapi/porttree.py | 2 +-
.../util/futures/asyncio/test_subprocess_exec.py | 2 +-
.../tests/util/futures/test_iter_completed.py | 2 +-
pym/portage/util/futures/executor/fork.py | 2 +-
pym/portage/util/futures/iter_completed.py | 2 +-
pym/portage/util/futures/unix_events.py | 22 ++++++++++++++++++++++
6 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 3ce214cd7..6c38232bb 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -667,7 +667,7 @@ class portdbapi(dbapi):
proc = EbuildMetadataPhase(cpv=mycpv,
ebuild_hash=ebuild_hash, portdb=self,
- repo_path=mylocation, scheduler=loop._loop,
+ repo_path=mylocation, scheduler=loop,
settings=self.doebuild_settings)
proc.addExitListener(functools.partial(self._aux_get_return,
diff --git a/pym/portage/tests/util/futures/asyncio/test_subprocess_exec.py b/pym/portage/tests/util/futures/asyncio/test_subprocess_exec.py
index 8c8c395ca..be103a9e0 100644
--- a/pym/portage/tests/util/futures/asyncio/test_subprocess_exec.py
+++ b/pym/portage/tests/util/futures/asyncio/test_subprocess_exec.py
@@ -34,7 +34,7 @@ class _Reader(object):
def __init__(self, future, input_file, loop):
self._future = future
self._pipe_reader = PipeReader(
- input_files={'input_file':input_file}, scheduler=loop._loop)
+ input_files={'input_file':input_file}, scheduler=loop)
self._future.add_done_callback(self._cancel_callback)
self._pipe_reader.addExitListener(self._eof)
diff --git a/pym/portage/tests/util/futures/test_iter_completed.py b/pym/portage/tests/util/futures/test_iter_completed.py
index 71343c22d..90668eb02 100644
--- a/pym/portage/tests/util/futures/test_iter_completed.py
+++ b/pym/portage/tests/util/futures/test_iter_completed.py
@@ -46,7 +46,7 @@ class IterCompletedTestCase(TestCase):
def future_generator():
for task in tasks:
task.future = loop.create_future()
- task.scheduler = loop._loop
+ task.scheduler = loop
task.start()
yield task.future
diff --git a/pym/portage/util/futures/executor/fork.py b/pym/portage/util/futures/executor/fork.py
index 51367f934..81c292e2c 100644
--- a/pym/portage/util/futures/executor/fork.py
+++ b/pym/portage/util/futures/executor/fork.py
@@ -54,7 +54,7 @@ class ForkExecutor(object):
future, proc = self._submit_queue.popleft()
future.add_done_callback(functools.partial(self._cancel_cb, proc))
proc.addExitListener(functools.partial(self._proc_exit, future))
- proc.scheduler = self._loop._loop
+ proc.scheduler = self._loop
proc.start()
self._running_tasks[id(proc)] = proc
diff --git a/pym/portage/util/futures/iter_completed.py b/pym/portage/util/futures/iter_completed.py
index 1d6a9a4bd..8b0f417d9 100644
--- a/pym/portage/util/futures/iter_completed.py
+++ b/pym/portage/util/futures/iter_completed.py
@@ -77,7 +77,7 @@ def async_iter_completed(futures, max_jobs=None, max_load=None, loop=None):
task_generator(),
max_jobs=max_jobs,
max_load=max_load,
- event_loop=loop._loop)
+ event_loop=loop)
def done_callback(future_done_set, wait_result):
"""Propagate results from wait_result to future_done_set."""
diff --git a/pym/portage/util/futures/unix_events.py b/pym/portage/util/futures/unix_events.py
index 1a86ed439..00f522b61 100644
--- a/pym/portage/util/futures/unix_events.py
+++ b/pym/portage/util/futures/unix_events.py
@@ -72,6 +72,28 @@ class _PortageEventLoop(events.AbstractEventLoop):
self.set_debug = loop.set_debug
self.get_debug = loop.get_debug
+ @property
+ def _asyncio_child_watcher(self):
+ """
+ In order to avoid accessing the internal _loop attribute, portage
+ internals should use this property when possible.
+
+ @rtype: asyncio.AbstractChildWatcher
+ @return: the internal event loop's AbstractChildWatcher interface
+ """
+ return self._loop._asyncio_child_watcher
+
+ @property
+ def _asyncio_wrapper(self):
+ """
+ In order to avoid accessing the internal _loop attribute, portage
+ internals should use this property when possible.
+
+ @rtype: asyncio.AbstractEventLoop
+ @return: the internal event loop's AbstractEventLoop interface
+ """
+ return self
+
def create_task(self, coro):
"""
Schedule a coroutine object.
^ permalink raw reply related [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2018-05-01 6:48 99% [gentoo-commits] proj/portage:master commit in: pym/portage/tests/util/futures/, pym/portage/dbapi/, pym/portage/util/futures/, Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox