On Mon, Nov 25, 2019 at 16:58:39 +0100, Erik Skultety wrote:
On Mon, Nov 25, 2019 at 04:37:36PM +0100, Peter Krempa 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(a)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)
Not a deal breaker, but IMO should at least the "new" syntax for string
formatting using the .format() method (works both with python 2 and 3).
This rest of this script uses the % syntax so I'm not going to add a
different style into this file nor do a conversion of irrelevant parts
in this patch.
Obviously if you have suggestions you can update the coding style
guidelines and/or convert the scripts to use the more pythonic syntax.