Make dblink.delete() remove empty parent category directories.
authorZac Medico <zmedico@gentoo.org>
Sat, 31 Oct 2009 19:08:45 +0000 (19:08 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 31 Oct 2009 19:08:45 +0000 (19:08 -0000)
svn path=/main/trunk/; revision=14754

pym/portage/dbapi/vartree.py

index db91be3d5fcba2ceec10b5b1f782df152fb8731c..137e22f269325eaf451795481c9c5aa7fd01fd68 100644 (file)
@@ -1947,6 +1947,11 @@ class dblink(object):
                        return
 
                shutil.rmtree(self.dbdir)
+               # If empty, remove parent category directory.
+               try:
+                       os.rmdir(os.path.dirname(self.dbdir))
+               except OSError:
+                       pass
                self.vartree.dbapi._remove(self)
 
        def clearcontents(self):