commit:     7957a7f4c2ef4656f6f9a29d2c9bab6e44daae1f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 21 05:08:21 2021 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Sep 21 05:33:51 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7957a7f4

bindbapi: convert compat coroutine to async

Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/portage/dbapi/bintree.py | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index 024a9b5f6..777fc4918 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -39,7 +39,6 @@ from portage.localization import _
 from portage.package.ebuild.profile_iuse import iter_iuse_vars
 from portage.util.file_copy import copyfile
 from portage.util.futures import asyncio
-from portage.util.futures.compat_coroutine import coroutine
 from portage.util.futures.executor.fork import ForkExecutor
 from portage import _movefile
 from portage import os
@@ -253,8 +252,7 @@ class bindbapi(fakedbapi):
         # inject will clear stale caches via cpv_inject.
         self.bintree.inject(cpv)
 
-    @coroutine
-    def unpack_metadata(self, pkg, dest_dir, loop=None):
+    async def unpack_metadata(self, pkg, dest_dir, loop=None):
         """
         Unpack package metadata to a directory. This method is a coroutine.
 
@@ -271,17 +269,16 @@ class bindbapi(fakedbapi):
         key = self._instance_key(cpv)
         add_pkg = self.bintree._additional_pkgs.get(key)
         if add_pkg is not None:
-            yield add_pkg._db.unpack_metadata(pkg, dest_dir, loop=loop)
+            await add_pkg._db.unpack_metadata(pkg, dest_dir, loop=loop)
         else:
             tbz2_file = self.bintree.getname(cpv)
-            yield loop.run_in_executor(
+            await loop.run_in_executor(
                 ForkExecutor(loop=loop),
                 portage.xpak.tbz2(tbz2_file).unpackinfo,
                 dest_dir,
             )
 
-    @coroutine
-    def unpack_contents(self, pkg, dest_dir, loop=None):
+    async def unpack_contents(self, pkg, dest_dir, loop=None):
         """
         Unpack package contents to a directory. This method is a coroutine.
 
@@ -313,7 +310,7 @@ class bindbapi(fakedbapi):
             )
 
             extractor.start()
-            yield extractor.async_wait()
+            await extractor.async_wait()
             if extractor.returncode != os.EX_OK:
                 raise PortageException("Error Extracting 
'{}'".format(pkg_path))
 
@@ -322,7 +319,7 @@ class bindbapi(fakedbapi):
             add_pkg = self.bintree._additional_pkgs.get(instance_key)
             if add_pkg is None:
                 raise portage.exception.PackageNotFound(cpv)
-            yield add_pkg._db.unpack_contents(pkg, dest_dir, loop=loop)
+            await add_pkg._db.unpack_contents(pkg, dest_dir, loop=loop)
 
     def cp_list(self, *pargs, **kwargs):
         if not self.bintree.populated:

Reply via email to