[Buildroot] [git commit branch/2023.02.x] utils/check-package: drop six usage

Peter Korsgaard peter at korsgaard.com
Sat Apr 22 21:08:32 UTC 2023


commit: https://git.buildroot.net/buildroot/commit/?id=aa658bec37677fa6b7259e186a80a75231ab5b92
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2023.02.x

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 at gmail.com>
Tested-by: James Knight <james.d.knight at live.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
(cherry picked from commit b7d4ae98faac020e2f620fda47c2777ad1deddfa)
Signed-off-by: Peter Korsgaard <peter at korsgaard.com>
---
 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()):
         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:



More information about the buildroot mailing list