From: Zac Medico Date: Sat, 31 Oct 2009 19:08:45 +0000 (-0000) Subject: Make dblink.delete() remove empty parent category directories. X-Git-Tag: v2.2_rc48~6 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8fe95db06ef385514d13dd8f292b7214e5ff5668;p=portage.git Make dblink.delete() remove empty parent category directories. svn path=/main/trunk/; revision=14754 --- 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):