[libvirt] [PATCH] check-symfile: Use pythonesque string formatting instead of perl

Ján Tomko jtomko at redhat.com
Tue Nov 26 09:16:12 UTC 2019


On Tue, Nov 26, 2019 at 09:51:18AM +0100, Fabiano Fidêncio wrote:
>On Mon, Nov 25, 2019 at 4:41 PM Peter Krempa <pkrempa at redhat.com> wrote:
>>
>> Commit d30a1ad0443 translated the symbol file checker from perl to
>> python by doing a literal translation in most cases. Unfortunately one
>> string formatting operation was not really translated into python
>> leaving users with non-helpful error:
>>
>> 'Symbol $1 is listed twice'
>>
>> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>> ---
>>  scripts/check-symfile.py | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/scripts/check-symfile.py b/scripts/check-symfile.py
>> index 0c02591991..34396b8623 100755
>> --- a/scripts/check-symfile.py
>> +++ b/scripts/check-symfile.py
>> @@ -52,7 +52,7 @@ with open(symfile, "r") as fh:
>>          line = line.strip(";")
>>
>>          if line in wantsyms:
>> -            print("Symbol $1 is listed twice", file=sys.stderr)
>> +            print("Symbol %s is listed twice" % line ,file=sys.stderr)
>
>Nitpick, 'line ,file=...' -> 'line, file=...'
>

These are easily caught by syntax-check:

../scripts/check-symfile.py:55:53: E203 whitespace before ','
            print("Symbol %s is listed twice" % line ,file=sys.stderr)
                                                    ^
../scripts/check-symfile.py:55:54: E231 missing whitespace after ','
            print("Symbol %s is listed twice" % line ,file=sys.stderr)
                                                     ^
make: *** [../build-aux/syntax-check.mk:917: sc_flake8] Error 123
make: *** Waiting for unfinished jobs....

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 484 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20191126/d89cee14/attachment-0001.sig>


More information about the libvir-list mailing list