Binpkg: handle missing dir after chpathtool
authorZac Medico <zmedico@gentoo.org>
Sat, 10 Dec 2011 03:55:36 +0000 (19:55 -0800)
committerZac Medico <zmedico@gentoo.org>
Sat, 10 Dec 2011 03:55:36 +0000 (19:55 -0800)
pym/_emerge/Binpkg.py

index 57b170f53c58e9a4ea08cbc166993dcd626c05d6..49368780c204e4e4560780dcb779a266c8467eb5 100644 (file)
@@ -351,11 +351,17 @@ class Binpkg(CompositeTask):
                # Move the files to the correct location for merge.
                image_tmp_dir = os.path.join(
                        self.settings["PORTAGE_BUILDDIR"], "image_tmp")
-               os.rename(os.path.join(self.settings["D"],
-                       self._build_prefix.lstrip(os.sep)), image_tmp_dir)
-               shutil.rmtree(self._image_dir)
-               ensure_dirs(os.path.dirname(self.settings["ED"].rstrip(os.sep)))
-               os.rename(image_tmp_dir, self.settings["ED"])
+               build_d = os.path.join(self.settings["D"],
+                       self._build_prefix.lstrip(os.sep))
+               if not os.path.isdir(build_d):
+                       # Assume this is a virtual package or something.
+                       shutil.rmtree(self._image_dir)
+                       ensure_dirs(self.settings["ED"])
+               else:
+                       os.rename(build_d, image_tmp_dir)
+                       shutil.rmtree(self._image_dir)
+                       ensure_dirs(os.path.dirname(self.settings["ED"].rstrip(os.sep)))
+                       os.rename(image_tmp_dir, self.settings["ED"])
 
                self.wait()