From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/util/futures/, pym/portage/dbapi/, pym/portage/util/futures/, ...
Date: Tue, 1 May 2018 06:48:06 +0000 (UTC) [thread overview]
Message-ID: <1525157187.90d78484d6be481a9caf22c017c62ea43f8ffe33.zmedico@gentoo> (raw)
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.
reply other threads:[~2018-05-01 6:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1525157187.90d78484d6be481a9caf22c017c62ea43f8ffe33.zmedico@gentoo \
--to=zmedico@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox