From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B972B1382C5 for ; Tue, 1 May 2018 06:48:10 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C065AE0874; Tue, 1 May 2018 06:48:09 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8AE11E0874 for ; Tue, 1 May 2018 06:48:09 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id BEBB0335C80 for ; Tue, 1 May 2018 06:48:07 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 20107281 for ; Tue, 1 May 2018 06:48:06 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1525157187.90d78484d6be481a9caf22c017c62ea43f8ffe33.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/util/futures/, pym/portage/dbapi/, pym/portage/util/futures/, ... X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dbapi/porttree.py pym/portage/tests/util/futures/asyncio/test_subprocess_exec.py pym/portage/tests/util/futures/test_iter_completed.py pym/portage/util/futures/executor/fork.py pym/portage/util/futures/iter_completed.py pym/portage/util/futures/unix_events.py X-VCS-Directories: pym/portage/tests/util/futures/ pym/portage/dbapi/ pym/portage/util/futures/ pym/portage/tests/util/futures/asyncio/ pym/portage/util/futures/executor/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 90d78484d6be481a9caf22c017c62ea43f8ffe33 X-VCS-Branch: master Date: Tue, 1 May 2018 06:48:06 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: dc773d84-e5f3-41cc-b0a6-a1c36a967183 X-Archives-Hash: c0ce7d666c901c8bfb803bdaef47319a commit: 90d78484d6be481a9caf22c017c62ea43f8ffe33 Author: Zac Medico gentoo org> AuthorDate: Tue May 1 06:22:10 2018 +0000 Commit: Zac Medico gentoo 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.