[elbe-devel] [PATCH v3 1/8] Add support for lexists and fix dangling symbolic links

dion at linutronix.de dion at linutronix.de
Wed May 29 16:24:53 CEST 2019


From: Olivier Dion <dion at linutronix.de>

>From issue #199: https://github.com/Linutronix/elbe/issues/199

lexists acts like:
------------------------------------------------------------
os.path.exist(path) or os.path.islink(path).
------------------------------------------------------------
on systems supporting os.stats.

This should ensure moving/removing of broken links works as expected.

Signed-off-by: Olivier Dion <dion at linutronix.de>
Acked-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/filesystem.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/elbepack/filesystem.py b/elbepack/filesystem.py
index cc7d08f5..d9f3e50e 100644
--- a/elbepack/filesystem.py
+++ b/elbepack/filesystem.py
@@ -78,6 +78,9 @@ class Filesystem(object):
     def exists(self, path):
         return os.path.exists(self.fname(path))
 
+    def lexists(self, path):
+        return os.path.lexists(self.fname(path))
+
     def mkdir(self, path):
         os.makedirs(self.fname(path))
 
-- 
2.11.0




More information about the elbe-devel mailing list