[elbe-devel] [PATCH v1 3/3] pkgutils: use f-strings

Holger Dengler dengler at linutronix.de
Fri Jul 2 18:14:35 CEST 2021


While at it, use f-strings wherever possible.

Signed-off-by: Holger Dengler <dengler at linutronix.de>
---
 elbepack/pkgutils.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/elbepack/pkgutils.py b/elbepack/pkgutils.py
index c04bcf99..9bbd10e8 100644
--- a/elbepack/pkgutils.py
+++ b/elbepack/pkgutils.py
@@ -27,8 +27,8 @@ def get_sources_list(prj):
                                  prj.text("mirror/primary_host").replace(
             "LOCALMACHINE", "10.0.2.2"),
             prj.text("mirror/primary_path"))
-        slist += "deb %s %s main\n" % (mirror, suite)
-        slist += "deb-src %s %s main\n" % (mirror, suite)
+        slist += f"deb {mirror} {suite} main\n"
+        slist += f"deb-src {mirror} {suite} main\n"
 
     if prj.node("mirror/url-list"):
         for n in prj.node("mirror/url-list"):
@@ -70,7 +70,7 @@ def get_dsc_size(fname):
 class ChangelogNeedsDependency(Exception):
     def __init__(self, pkgname):
         Exception.__init__(self,
-                           'Changelog extraction depends on "%s"' % (pkgname))
+                           f'Changelog extraction depends on "{pkgname}"')
         self.pkgname = pkgname
 
 
@@ -84,7 +84,7 @@ def extract_pkg_changelog(fname, extra_pkg=None):
     pkgname = m.group('name')
     pkgarch = m.group('arch')
 
-    print('pkg: %s, arch: %s' % (pkgname, pkgarch))
+    print(f'pkg: {pkgname}, arch: {pkgarch}')
 
     fs = TmpdirFilesystem()
 
@@ -94,15 +94,15 @@ def extract_pkg_changelog(fname, extra_pkg=None):
 
     system('dpkg -x "%s" "%s"' % (fname, fs.fname('/')))
 
-    dch_dir = '/usr/share/doc/%s' % pkgname
+    dch_dir = f'/usr/share/doc/{pkgname}'
 
     if fs.islink(dch_dir) and not extra_pkg:
         l = fs.readlink(dch_dir)
         print(dch_dir, l)
         raise ChangelogNeedsDependency(l)
 
-    dch_bin = '/usr/share/doc/%s/changelog.Debian.%s.gz' % (pkgname, pkgarch)
-    dch_src = '/usr/share/doc/%s/changelog.Debian.gz' % pkgname
+    dch_bin = f'/usr/share/doc/{pkgname}/changelog.Debian.{pkgarch}.gz'
+    dch_src = f'/usr/share/doc/{pkgname}/changelog.Debian.gz'
 
     ret = ""
 
-- 
2.32.0



More information about the elbe-devel mailing list