From 1e1c18b4d3b000d4ba2e49606c5f65480b9d5ca4 Mon Sep 17 00:00:00 2001 From: Jason Stubbs Date: Sun, 25 Dec 2005 08:39:22 +0000 Subject: Only do one round of directory removal attempts. As symlinks are now removed before directory removal begins, more than one round is unnecessary. svn path=/main/trunk/; revision=2457 --- pym/portage.py | 51 +++++++++++++++------------------------------------ 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/pym/portage.py b/pym/portage.py index ab665ce64..854901956 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -5739,44 +5739,23 @@ class dblink: elif pkgfiles[obj][0]=="dev": print "--- ","dev",obj - #progress -- are we making progress? Initialized to 1 so loop will start - progress=1 - while progress: - #let's see if we're able to make progress this iteration... - progress=0 - - pos = 0 - while pos0: - #we won't remove this directory (yet), continue - pos += 1 - continue - elif (objld != None): - #zappo time - del mydirs[pos] - #we've made progress! - progress = 1 - try: - os.rmdir(obj) - print "<<< ","dir",obj - except (OSError,IOError),e: - #immutable? - pass + for obj in mydirs: + if not last_non_empty.startswith(obj) and not listdir(obj): + try: + os.rmdir(obj) + print "<<< ","dir",obj + last_non_empty = "" + except (OSError,IOError),e: + #immutable? + pass - #directories that aren't empty: - for x in mydirs: - print "--- !empty dir", x + print "--- !empty dir", obj + last_non_empty = obj + continue #remove self from vartree database so that our own virtual gets zapped if we're the last node db[self.myroot]["vartree"].zap(self.mycpv) -- cgit v1.2.3-1-g7c22