commit:     27801746e9aa7e9ffc02408b2b005aa106c0d8a7
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 28 21:51:01 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Apr 28 21:55:46 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=27801746

MirrorDistTask: fix deprecated _wait usage (bug 653856)

Override AsynchronousTask._async_wait() for cleanup, since
AsynchronousTask._wait() is deprecated.

Bug: https://bugs.gentoo.org/653856

 pym/portage/_emirrordist/MirrorDistTask.py | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/pym/portage/_emirrordist/MirrorDistTask.py 
b/pym/portage/_emirrordist/MirrorDistTask.py
index 48d0f7cf2..a0912d673 100644
--- a/pym/portage/_emirrordist/MirrorDistTask.py
+++ b/pym/portage/_emirrordist/MirrorDistTask.py
@@ -1,4 +1,4 @@
-# Copyright 2013-2014 Gentoo Foundation
+# Copyright 2013-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import errno
@@ -46,7 +46,7 @@ class MirrorDistTask(CompositeTask):
 
                self._assert_current(fetch)
                if self._was_cancelled():
-                       self.wait()
+                       self._async_wait()
                        return
 
                if self._config.options.delete:
@@ -63,7 +63,7 @@ class MirrorDistTask(CompositeTask):
 
                self._assert_current(deletion)
                if self._was_cancelled():
-                       self.wait()
+                       self._async_wait()
                        return
 
                self._post_deletion()
@@ -80,7 +80,7 @@ class MirrorDistTask(CompositeTask):
 
                self.returncode = os.EX_OK
                self._current_task = None
-               self.wait()
+               self._async_wait()
 
        def _update_recycle_db(self):
 
@@ -242,5 +242,15 @@ class MirrorDistTask(CompositeTask):
                        self._async_wait()
 
        def _wait(self):
+               """
+               Deprecated. Use _async_wait() instead.
+               """
                CompositeTask._wait(self)
                self._cleanup()
+
+       def _async_wait(self):
+               """
+               Override _async_wait to call self._cleanup().
+               """
+               self._cleanup()
+               super(CompositeTask, self)._async_wait()

Reply via email to