[library-web] wipe stale versions for real



commit 3831070fdf09bc18f0dde45f2eaa7e58d8489b72
Author: Frédéric Péters <fpeters 0d be>
Date:   Sat Sep 6 10:44:03 2014 +0200

    wipe stale versions for real

 src/document.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/document.py b/src/document.py
index 33c4876..540b53b 100644
--- a/src/document.py
+++ b/src/document.py
@@ -18,6 +18,7 @@
 
 import logging
 import os
+import shutil
 import stat
 import subprocess
 
@@ -181,7 +182,12 @@ class Document:
                 continue
             if filename in ['stable', 'unstable']:
                 continue
-            logging.info('Should wipe %s' % os.path.join(dirname, filename))
+            wipe_path = os.path.join(dirname, filename)
+            logging.info('wiping %s' % wipe_path)
+            if os.path.isdir(wipe_path):
+                shutil.rmtree(wipe_path, ignore_errors=True)
+            else:
+                os.unlink(wipe_path)
 
 
 class RemoteDocument(Document):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]