summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gentoo.org>2019-12-02 17:15:14 -0500
committerMatt Turner <mattst88@gentoo.org>2019-12-04 21:23:20 -0500
commit3f25e307ba5116892beb48fec2809500882dcf4f (patch)
tree55c91fe17c7b4f73005b88484e9e38f5f10331b4
parenteclean: Inline _sort_keys method (diff)
downloadgentoolkit-3f25e307ba5116892beb48fec2809500882dcf4f.tar.gz
gentoolkit-3f25e307ba5116892beb48fec2809500882dcf4f.tar.bz2
gentoolkit-3f25e307ba5116892beb48fec2809500882dcf4f.zip
eclean: Delete empty directories
Closes: https://bugs.gentoo.org/671592 Signed-off-by: Matt Turner <mattst88@gentoo.org>
-rw-r--r--pym/gentoolkit/eclean/clean.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/pym/gentoolkit/eclean/clean.py b/pym/gentoolkit/eclean/clean.py
index e00bcc0..c62abb9 100644
--- a/pym/gentoolkit/eclean/clean.py
+++ b/pym/gentoolkit/eclean/clean.py
@@ -139,6 +139,10 @@ class CleanUp(object):
# only count size if successfully deleted and not a link
if statinfo.st_nlink == 1:
clean_size += statinfo.st_size
+ try:
+ os.rmdir(os.path.dirname(file_))
+ except OSError:
+ pass
except EnvironmentError as er:
print( pp.error("Could not delete "+file_), file=sys.stderr)
print( pp.error("Error: %s" %str(er)), file=sys.stderr)