Fix EbuildFetcher._wait_hook() so it can be called more than once without
authorZac Medico <zmedico@gentoo.org>
Tue, 7 Oct 2008 08:04:55 +0000 (08:04 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 7 Oct 2008 08:04:55 +0000 (08:04 -0000)
throwing an AttributeError.

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

pym/_emerge/__init__.py

index 4e9070612917c889046c7bad9d562a4db842199d..cffaf542661735b4a2a26aceb50f3a616da2097d 100644 (file)
@@ -2278,16 +2278,17 @@ class EbuildFetcher(SpawnProcess):
        def _wait_hook(self):
                # Collect elog messages that might have been
                # created by the pkg_nofetch phase.
-               portage.elog.elog_process(self.pkg.cpv, self._build_dir.settings)
-               try:
-                       shutil.rmtree(self._build_dir.settings["PORTAGE_BUILDDIR"])
-               except EnvironmentError, e:
-                       if e.errno != errno.ENOENT:
-                               raise
-                       del e
-               self._build_dir.unlock()
-               self.config_pool.deallocate(self._build_dir.settings)
-               self._build_dir = None
+               if self._build_dir is not None:
+                       portage.elog.elog_process(self.pkg.cpv, self._build_dir.settings)
+                       try:
+                               shutil.rmtree(self._build_dir.settings["PORTAGE_BUILDDIR"])
+                       except EnvironmentError, e:
+                               if e.errno != errno.ENOENT:
+                                       raise
+                               del e
+                       self._build_dir.unlock()
+                       self.config_pool.deallocate(self._build_dir.settings)
+                       self._build_dir = None
                SpawnProcess._wait_hook(self)
 
 class EbuildBuildDir(SlotObject):