commit:     3f25e307ba5116892beb48fec2809500882dcf4f
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Mon Dec  2 22:15:14 2019 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Dec  5 02:23:20 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=3f25e307

eclean: Delete empty directories

Closes: https://bugs.gentoo.org/671592
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 pym/gentoolkit/eclean/clean.py | 4 ++++
 1 file changed, 4 insertions(+)

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)

Reply via email to