From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Vincent Fazio <vfazio@gmail.com>
Cc: Ricardo Martincoski <ricardo.martincoski@datacom.com.br>,
buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] utils/check-package: drop six usage
Date: Mon, 10 Apr 2023 21:04:01 +0200 [thread overview]
Message-ID: <20230410190401.GI2819@scaer> (raw)
In-Reply-To: <20230403013530.3502-1-vfazio@gmail.com>
Vincent, All,
On 2023-04-02 20:35 -0500, Vincent Fazio spake thusly:
> The shebang in check-package now defines python3. There is no longer a
> need to maintain support with python 2.x.
>
> See-also: 02b165dc71 (check-package: fix Python3 support)
>
> Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Applied to master, thanks.
> ---
> utils/check-package | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/utils/check-package b/utils/check-package
> index 98a25bd0b2..46f2897b51 100755
> --- a/utils/check-package
> +++ b/utils/check-package
> @@ -6,7 +6,6 @@ import inspect
> import magic
> import os
> import re
> -import six
> import sys
>
> import checkpackagelib.base
> @@ -218,12 +217,9 @@ def check_file_using_lib(fname):
> if fail > 0:
> failed.add(name)
> nwarnings += warn
> - if six.PY3:
> - f = open(fname, "r", errors="surrogateescape")
> - else:
> - f = open(fname, "r")
> +
> lastline = ""
> - for lineno, text in enumerate(f.readlines()):
> + for lineno, text in enumerate(open(fname, "r", errors="surrogateescape").readlines()):
As seen on IRC: it does not leak a fileobject: it is not bound to a
variable, so the object is garbage-collected as soon as it is no longer
referenced, i.e. right after the function call ends.
Regards,
Yann E. MORIN.
> nlines += 1
> for name, cf in objects:
> if cf.disable.search(lastline):
> @@ -233,7 +229,7 @@ def check_file_using_lib(fname):
> failed.add(name)
> nwarnings += warn
> lastline = text
> - f.close()
> +
> for name, cf in objects:
> warn, fail = print_warnings(cf.after(), name in xfail)
> if fail > 0:
> --
> 2.25.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2023-04-10 19:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-03 1:35 [Buildroot] [PATCH] utils/check-package: drop six usage Vincent Fazio
2023-04-07 17:10 ` James Knight
2023-04-10 17:44 ` Yann E. MORIN
2023-04-10 19:11 ` Arnout Vandecappelle
2023-04-10 19:04 ` Yann E. MORIN [this message]
2023-04-22 21:10 ` Peter Korsgaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230410190401.GI2819@scaer \
--to=yann.morin.1998@free.fr \
--cc=buildroot@buildroot.org \
--cc=ricardo.martincoski@datacom.com.br \
--cc=vfazio@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox