* Fix AsynchronousTask.poll() to call _wait_hook() when necessary.
authorZac Medico <zmedico@gentoo.org>
Sat, 5 Jul 2008 23:17:01 +0000 (23:17 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 5 Jul 2008 23:17:01 +0000 (23:17 -0000)
* Use the default poll() and cancel() implementations for BinpkgVerifier.

svn path=/main/trunk/; revision=10947

pym/_emerge/__init__.py

index d25358faa2ebb7d05ad0924a8e9c4bc765ddef54..0665701f760ff4b44a4061f63914efdb2a077d4d 100644 (file)
@@ -1467,6 +1467,8 @@ class AsynchronousTask(SlotObject):
                return self.returncode is None
 
        def poll(self):
+               if self.returncode is not None:
+                       self._wait_hook()
                return self.returncode
 
        def wait(self):
@@ -1474,7 +1476,8 @@ class AsynchronousTask(SlotObject):
                return self.returncode
 
        def cancel(self):
-               pass
+               self.cancelled = True
+               self.wait()
 
        def addExitListener(self, f):
                """
@@ -2619,12 +2622,6 @@ class BinpkgVerifier(AsynchronousTask):
 
                self.returncode = rval
 
-       def cancel(self):
-               self.cancelled = True
-
-       def poll(self):
-               return self.returncode
-
 class BinpkgExtractorAsync(SpawnProcess):
 
        __slots__ = ("image_dir", "pkg", "pkg_path")