[elbe-devel] [PATCH v2 56/75] packers: use f-strings

Daniel Braunwarth daniel at braunwarth.dev
Wed Nov 2 20:14:38 CET 2022


Signed-off-by: Daniel Braunwarth <daniel at braunwarth.dev>
---
 elbepack/packers.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/elbepack/packers.py b/elbepack/packers.py
index 71957af46..110dcddbf 100644
--- a/elbepack/packers.py
+++ b/elbepack/packers.py
@@ -28,7 +28,7 @@ class InPlacePacker(Packer):
     def pack_file(self, builddir, fname):
         try:
             fpath = os.path.join(builddir, fname)
-            do('%s "%s"' % (self.cmd, fpath))
+            do(f'{self.cmd} "{fpath}"')
         except CommandError:
             # in case of an error, we just return None
             # which means, that the orig file does not
@@ -50,9 +50,10 @@ class TarArchiver(Packer):
             dirname = os.path.dirname(fpath)
             basename = os.path.basename(fpath)
             archname = fpath + self.suffix
-            do('tar --create --verbose --sparse %s --file "%s" --directory "%s" "%s"' %
-               (self.flag, archname, dirname, basename))
-            do('rm -f "%s"' % fpath)
+            do(
+                f'tar --create --verbose --sparse {self.flag} '
+                f'--file "{archname}" --directory "{dirname}" "{basename}"')
+            do(f'rm -f "{fpath}"')
         except CommandError:
             # in case of an error, we just return None
             # which means, that the orig file does not
-- 
2.38.1



More information about the elbe-devel mailing list