From: Zac Medico Date: Sat, 31 Oct 2009 19:44:04 +0000 (-0000) Subject: Make dblink.delete() remove empty parent category directories. (trunk r14754) X-Git-Tag: v2.1.7.3~5 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=96e4cf57b2306372490e167247f7b219c8566afa;p=portage.git Make dblink.delete() remove empty parent category directories. (trunk r14754) svn path=/main/branches/2.1.7/; revision=14758 --- diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 4284eff9b..aae16e43f 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1230,6 +1230,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):