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

Bastian Germann bage at linutronix.de
Fri Jul 2 18:40:46 CEST 2021


Am 02.07.21 um 18:36 schrieb Holger Dengler:
> On 02.07.21 18:33, Bastian Germann wrote:
>> Am 02.07.21 um 18:14 schrieb Holger Dengler:
>>> While at it, use f-strings wherever possible.
>>>
>>> Signed-off-by: Holger Dengler <dengler at linutronix.de>
>>
>> I suppose this code is only run on the initvm, which is the precondition for having this change.
> 
> No, this code is also used in elbe check_updates, if you generate a changelogs.xml. I can drop this commit, if this may cause problems.

Yes, please do that.

> 
>>
>> Acked-by: Bastian Germann <bage 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 = ""
>>>   
> 


More information about the elbe-devel mailing list