[tor-commits] [sbws/master] Add method to remove latest link

juga at torproject.org juga at torproject.org
Wed Oct 24 09:40:23 UTC 2018


commit 5b33d3a3e9e1658ce2393f0cdd3cb13332faaf94
Author: juga0 <juga at riseup.net>
Date:   Tue Oct 16 15:01:18 2018 +0000

    Add method to remove latest link
---
 sbws/lib/v3bwfile.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sbws/lib/v3bwfile.py b/sbws/lib/v3bwfile.py
index 58056b1..c69e674 100644
--- a/sbws/lib/v3bwfile.py
+++ b/sbws/lib/v3bwfile.py
@@ -842,6 +842,17 @@ class V3BWFile(object):
         ys = [[getattr(l, k) for l in self.bw_lines] for k in attrs]
         return x, ys, attrs
 
+    def rm_link(self, output):
+        """"""
+        out_dir = os.path.dirname(output)
+        out_link = os.path.join(out_dir, 'latest.v3bw')
+        log.info('Removing %s link.', output)
+        with DirectoryLock(out_dir):
+            try:
+                os.unlink(out_link)
+            except FileNotFoundError:
+                pass
+
     def write(self, output):
         if output == '/dev/stdout':
             log.info("Writing to stdout is not supported.")





More information about the tor-commits mailing list