[elbe-devel] [PATCH 4/9] elbepack: filesystem: remove utime()

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


There is only one internal caller, so inline the functionality.

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

diff --git a/elbepack/filesystem.py b/elbepack/filesystem.py
index 0b58714f2d99..7f73c9031639 100644
--- a/elbepack/filesystem.py
+++ b/elbepack/filesystem.py
@@ -272,9 +272,6 @@ class Filesystem:
     def chmod(self, path, mode):
         os.chmod(self.fname(path), mode)
 
-    def utime(self, path, times=None):
-        os.utime(self.fname(path), times)
-
     def remove(self, path, noerr=False):
         """
         >>> this.remove("remove") # doctest: +ELLIPSIS
@@ -388,10 +385,10 @@ class Filesystem:
 
     def touch_file(self, fname):
         if self.exists(fname):
-            self.utime(fname)
+            os.utime(self.fname(fname))
         else:
-            fp = self.open(fname, 'w')
-            fp.close()
+            with self.open(fname, 'w'):
+                pass
 
     def walk_files(self, directory='', exclude_dirs=None):
         if not exclude_dirs:

-- 
2.45.2



More information about the elbe-devel mailing list