summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-10-31 19:08:45 +0000
committerZac Medico <zmedico@gentoo.org>2009-10-31 19:08:45 +0000
commit8fe95db06ef385514d13dd8f292b7214e5ff5668 (patch)
treeaaebba98d479ef16ff2e8ccccc5ab93c804dcdef
parent35f78590d6b702f9cfbcacd77338b0c2382d18da (diff)
downloadportage-8fe95db06ef385514d13dd8f292b7214e5ff5668.tar.gz
portage-8fe95db06ef385514d13dd8f292b7214e5ff5668.tar.bz2
portage-8fe95db06ef385514d13dd8f292b7214e5ff5668.zip
Make dblink.delete() remove empty parent category directories.
svn path=/main/trunk/; revision=14754
-rw-r--r--pym/portage/dbapi/vartree.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index db91be3d5..137e22f26 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -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):