From 3f25e307ba5116892beb48fec2809500882dcf4f Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Mon, 2 Dec 2019 17:15:14 -0500 Subject: eclean: Delete empty directories Closes: https://bugs.gentoo.org/671592 Signed-off-by: Matt Turner --- pym/gentoolkit/eclean/clean.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pym') 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) -- cgit v1.2.3