[PATCH] cleanup empty directories in /needsign

Josh Boyer jwboyer at jdub.homelinux.org
Sat Jun 4 14:47:48 UTC 2005


Hi,

The patch below cleans up the empty directories in extras-push.py.  My
python isn't the best, but it should work well enough.  Feel free to
apply it if you'd like.

josh

 extras-push.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletion(-)

Index: utils/extras-push.py
===================================================================
--- utils.orig/extras-push.py	2005-05-31 23:17:07.000000000 -0500
+++ utils/extras-push.py	2005-06-04 09:43:45.013729048 -0500
@@ -82,6 +82,14 @@ def find_files(path):
             filedict[which].append(fullfile)
     return filedict
 
+def prune_empty_dirs(top):
+    for root, dirs, files in os.walk(top, topdown=False):
+        for name in dirs:
+            try:
+                os.rmdir(os.path.join(root, name))
+            except:
+                debugprint('%s was not empty' % os.path.join(root, name))
+
 def naevr(pkg):
     """return nevra from the package srpm"""
 
@@ -279,7 +287,8 @@ def main(dist):
         debugprint('removing %s' % file)
         os.unlink(file)
     
-    # FIXME clean up empty dirs, too.
+    # clean up empty dirs, too.
+    prune_empty_dirs(needsign)
     
 if __name__ == '__main__':
     me = os.getcwd()




More information about the Fedora-buildsys-list mailing list