From dc6e267bd15e7d074d11a12e05017ac7af8ff4c5 Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Tue, 11 Apr 2006 14:11:02 +0000 Subject: [PATCH] fixes #2080 --- pisi/atomicoperations.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pisi/atomicoperations.py b/pisi/atomicoperations.py index ee78c689..13675ca6 100644 --- a/pisi/atomicoperations.py +++ b/pisi/atomicoperations.py @@ -411,8 +411,12 @@ class Remove(AtomicOperation): else: if os.path.isfile(fpath) or os.path.islink(fpath): os.unlink(fpath) - elif os.path.isdir(fpath) and os.listdir(fpath)==[]: - os.rmdir(fpath) # remove directory if there is nothing under it + 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) else: ctx.ui.warning(_('Not removing non-file, non-link %s') % fpath, True)