[elbe-devel] [PATCH 5/9] elbepack: filesystem: simplify append_file()

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Jul 29 10:46:32 CEST 2024


The 'mode' argument is never passed, so drop it.
This allows the logic to be simplified significantly.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/filesystem.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/elbepack/filesystem.py b/elbepack/filesystem.py
index 7f73c9031639..c63445c2ec85 100644
--- a/elbepack/filesystem.py
+++ b/elbepack/filesystem.py
@@ -341,9 +341,9 @@ class Filesystem:
         path = self.realpath(path)
         self._write_file(path, open(path, 'w'), cont, mode)
 
-    def append_file(self, path, cont, mode=None):
-        path = self.realpath(path)
-        self._write_file(path, open(path, 'a'), cont, mode)
+    def append_file(self, path, cont):
+        with self.open(path, 'a') as f:
+            f.write(cont)
 
     def read_file(self, path, gz=False):
         path = self.realpath(path)

-- 
2.45.2



More information about the elbe-devel mailing list