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

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



commit 5b33d3a3e9e1658ce2393f0cdd3cb13332faaf94
Author: juga0 <juga@xxxxxxxxxx>
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.")



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits