From 64f310717d79127ce23dc5cbcff7425f090c5031 Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Tue, 11 Apr 2006 18:00:52 +0000 Subject: [PATCH] up up and away... --- pisi/atomicoperations.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pisi/atomicoperations.py b/pisi/atomicoperations.py index 13675ca6..3a4b53ba 100644 --- a/pisi/atomicoperations.py +++ b/pisi/atomicoperations.py @@ -411,14 +411,17 @@ class Remove(AtomicOperation): else: if os.path.isfile(fpath) or os.path.islink(fpath): os.unlink(fpath) - dpath = os.path.dirname(fpath) - while dpath != '/' and not os.listdir(dpath): - os.rmdir(dpath) - dpath = os.path.dirname(dpath) - elif os.path.isdir(fpath) and not os.listdir(fpath): - os.rmdir(fpath) + elif os.path.isdir(fpath) and not os.listdir(fpath): + os.rmdir(fpath) else: ctx.ui.warning(_('Not removing non-file, non-link %s') % fpath, True) + return + + # remove emptied directories + dpath = os.path.dirname(fpath) + while dpath != '/' and not os.listdir(dpath): + os.rmdir(dpath) + dpath = os.path.dirname(dpath) remove_file = staticmethod(remove_file)