All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 0/4] use python3 explicitly
@ 2021-09-15 19:48 Petr Vorel
  2021-09-15 19:48 ` [Buildroot] [PATCH v2 1/4] support: utils: " Petr Vorel
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Petr Vorel @ 2021-09-15 19:48 UTC (permalink / raw)
  To: buildroot; +Cc: David Laight, Edgar Bonet

Hi,

changes v1->v2:
* 3 more commits
* remove also python2 compatibility imports

Kind regards,
Petr

Petr Vorel (4):
  support: utils: use python3
  utils/scanpypi: remove python2 compatibility imports
  utils/getdeveloperlib.py: use python3 explicitly
  testing/tests/package: use python3 explicitly

 support/scripts/cve.py                                        | 2 +-
 support/scripts/graph-build-time                              | 2 +-
 support/scripts/graph-depends                                 | 2 +-
 support/scripts/pycompile.py                                  | 4 +---
 support/scripts/size-stats                                    | 2 +-
 support/testing/tests/package/sample_gst1_python.py           | 2 +-
 support/testing/tests/package/sample_python_gobject.py        | 2 +-
 support/testing/tests/package/test_crudini.py                 | 2 ++
 support/testing/tests/package/test_gst1_python.py             | 2 ++
 support/testing/tests/package/test_ipython.py                 | 2 ++
 support/testing/tests/package/test_libftdi1.py                | 2 ++
 support/testing/tests/package/test_python.py                  | 2 ++
 support/testing/tests/package/test_python_argh.py             | 2 ++
 support/testing/tests/package/test_python_attrs.py            | 2 ++
 support/testing/tests/package/test_python_augeas.py           | 2 ++
 support/testing/tests/package/test_python_autobahn.py         | 2 ++
 support/testing/tests/package/test_python_automat.py          | 2 ++
 support/testing/tests/package/test_python_avro.py             | 2 ++
 support/testing/tests/package/test_python_bitstring.py        | 2 ++
 support/testing/tests/package/test_python_can.py              | 2 ++
 support/testing/tests/package/test_python_cbor.py             | 2 ++
 support/testing/tests/package/test_python_click.py            | 2 ++
 support/testing/tests/package/test_python_colorzero.py        | 2 ++
 support/testing/tests/package/test_python_constantly.py       | 2 ++
 support/testing/tests/package/test_python_crossbar.py         | 2 ++
 support/testing/tests/package/test_python_cryptography.py     | 2 ++
 support/testing/tests/package/test_python_dbus_next.py        | 2 ++
 support/testing/tests/package/test_python_django.py           | 2 ++
 support/testing/tests/package/test_python_gitdb2.py           | 2 ++
 support/testing/tests/package/test_python_gobject.py          | 2 ++
 support/testing/tests/package/test_python_gpiozero.py         | 2 ++
 support/testing/tests/package/test_python_incremental.py      | 2 ++
 support/testing/tests/package/test_python_passlib.py          | 2 ++
 support/testing/tests/package/test_python_pexpect.py          | 2 ++
 support/testing/tests/package/test_python_pynacl.py           | 2 ++
 support/testing/tests/package/test_python_pytest.py           | 2 ++
 support/testing/tests/package/test_python_pytest_asyncio.py   | 2 ++
 support/testing/tests/package/test_python_pyyaml.py           | 2 ++
 support/testing/tests/package/test_python_rpi_gpio.py         | 2 ++
 support/testing/tests/package/test_python_rsa.py              | 2 ++
 support/testing/tests/package/test_python_service_identity.py | 2 ++
 support/testing/tests/package/test_python_smmap2.py           | 2 ++
 support/testing/tests/package/test_python_subprocess32.py     | 2 ++
 support/testing/tests/package/test_python_treq.py             | 2 ++
 support/testing/tests/package/test_python_twisted.py          | 2 ++
 support/testing/tests/package/test_python_txaio.py            | 2 ++
 support/testing/tests/package/test_python_txtorcon.py         | 2 ++
 support/testing/tests/package/test_python_ubjson.py           | 2 ++
 utils/check-package                                           | 3 +--
 utils/genrandconfig                                           | 4 +---
 utils/get-developers                                          | 2 +-
 utils/getdeveloperlib.py                                      | 3 ++-
 utils/scanpypi                                                | 2 --
 utils/size-stats-compare                                      | 2 +-
 54 files changed, 95 insertions(+), 19 deletions(-)

-- 
2.33.0

_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 1/4] support: utils: use python3 explicitly
  2021-09-15 19:48 [Buildroot] [PATCH v2 0/4] use python3 explicitly Petr Vorel
@ 2021-09-15 19:48 ` Petr Vorel
  2021-09-21 20:20   ` Romain Naour
  2021-09-15 19:48 ` [Buildroot] [PATCH v2 2/4] utils/scanpypi: remove python2 compatibility imports Petr Vorel
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Petr Vorel @ 2021-09-15 19:48 UTC (permalink / raw)
  To: buildroot; +Cc: David Laight, Edgar Bonet

Python 2 is EOL sice 2020 [1], it's still available on distros, but may not
be installed by default (as being replaced by python3).

Thus remove compatibility imports:
from __future__ import print_function
from __future__ import absolute_import

Tested with python3 -m py_compile.

[1] https://www.python.org/doc/sunset-python-2/

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
changes v1->v2:
* remove also python2 compatibility imports

 support/scripts/cve.py                                 | 2 +-
 support/scripts/graph-build-time                       | 2 +-
 support/scripts/graph-depends                          | 2 +-
 support/scripts/pycompile.py                           | 4 +---
 support/scripts/size-stats                             | 2 +-
 support/testing/tests/package/sample_gst1_python.py    | 2 +-
 support/testing/tests/package/sample_python_gobject.py | 2 +-
 utils/check-package                                    | 3 +--
 utils/genrandconfig                                    | 4 +---
 utils/get-developers                                   | 2 +-
 utils/size-stats-compare                               | 2 +-
 11 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/support/scripts/cve.py b/support/scripts/cve.py
index 13c29fabe0..7cd6fce4d8 100755
--- a/support/scripts/cve.py
+++ b/support/scripts/cve.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # Copyright (C) 2009 by Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
 # Copyright (C) 2020 by Gregory CLEMENT <gregory.clement@bootlin.com>
diff --git a/support/scripts/graph-build-time b/support/scripts/graph-build-time
index ba3cdad85b..742c9a7a50 100755
--- a/support/scripts/graph-build-time
+++ b/support/scripts/graph-build-time
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # Copyright (C) 2011 by Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
 # Copyright (C) 2013 by Yann E. MORIN <yann.morin.1998@free.fr>
diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
index d42bebce9d..a66fb28f41 100755
--- a/support/scripts/graph-depends
+++ b/support/scripts/graph-depends
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # Usage (the graphviz package must be installed in your distribution)
 #  ./support/scripts/graph-depends [-p package-name] > test.dot
diff --git a/support/scripts/pycompile.py b/support/scripts/pycompile.py
index b8cd3cee6c..8774144a90 100644
--- a/support/scripts/pycompile.py
+++ b/support/scripts/pycompile.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 """
 Byte compile all .py files from provided directories. This script is an
@@ -6,8 +6,6 @@ alternative implementation of compileall.compile_dir written with
 cross-compilation in mind.
 """
 
-from __future__ import print_function
-
 import argparse
 import os
 import py_compile
diff --git a/support/scripts/size-stats b/support/scripts/size-stats
index dea3a6007c..bf3d12a9b7 100755
--- a/support/scripts/size-stats
+++ b/support/scripts/size-stats
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # Copyright (C) 2014 by Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
 
diff --git a/support/testing/tests/package/sample_gst1_python.py b/support/testing/tests/package/sample_gst1_python.py
index fab7e74f40..2d7e0e1ed9 100644
--- a/support/testing/tests/package/sample_gst1_python.py
+++ b/support/testing/tests/package/sample_gst1_python.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 """A simple test that uses gst1-python to run a fake videotestsrc for 100
 frames
 """
diff --git a/support/testing/tests/package/sample_python_gobject.py b/support/testing/tests/package/sample_python_gobject.py
index 50564aa79f..4490a73613 100644
--- a/support/testing/tests/package/sample_python_gobject.py
+++ b/support/testing/tests/package/sample_python_gobject.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 """A simple test that uses python-gobject to find the path of sh."""
 from gi.repository import GLib
 
diff --git a/utils/check-package b/utils/check-package
index dd18d19c25..a959fef079 100755
--- a/utils/check-package
+++ b/utils/check-package
@@ -1,7 +1,6 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # See utils/checkpackagelib/readme.txt before editing this file.
 
-from __future__ import print_function
 import argparse
 import inspect
 import os
diff --git a/utils/genrandconfig b/utils/genrandconfig
index 622cfd4891..a1431bf1a8 100755
--- a/utils/genrandconfig
+++ b/utils/genrandconfig
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # Copyright (C) 2014 by Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
 #
@@ -18,8 +18,6 @@
 
 # This script generates a random configuration for testing Buildroot.
 
-from __future__ import print_function
-
 import contextlib
 import csv
 import os
diff --git a/utils/get-developers b/utils/get-developers
index 9182b2d85f..22accaf181 100755
--- a/utils/get-developers
+++ b/utils/get-developers
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 import argparse
 import getdeveloperlib
diff --git a/utils/size-stats-compare b/utils/size-stats-compare
index a3d7f250c6..422972e488 100755
--- a/utils/size-stats-compare
+++ b/utils/size-stats-compare
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # Copyright (C) 2016 Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
 
-- 
2.33.0

_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 2/4] utils/scanpypi: remove python2 compatibility imports
  2021-09-15 19:48 [Buildroot] [PATCH v2 0/4] use python3 explicitly Petr Vorel
  2021-09-15 19:48 ` [Buildroot] [PATCH v2 1/4] support: utils: " Petr Vorel
@ 2021-09-15 19:48 ` Petr Vorel
  2021-09-15 19:48 ` [Buildroot] [PATCH v2 3/4] utils/getdeveloperlib.py: use python3 explicitly Petr Vorel
  2021-09-15 19:48 ` [Buildroot] [PATCH v2 4/4] testing/tests/package: " Petr Vorel
  3 siblings, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2021-09-15 19:48 UTC (permalink / raw)
  To: buildroot; +Cc: David Laight, Edgar Bonet

ee8b680816 ("utils/scanpypi: use python3 explicitly") started to use python3,
thus compatibility can be removed:

from __future__ import print_function
from __future__ import absolute_import

Tested with python3 -m py_compile.

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
New in v2

 utils/scanpypi | 2 --
 1 file changed, 2 deletions(-)

diff --git a/utils/scanpypi b/utils/scanpypi
index 9dede4e119..1f3326cf4d 100755
--- a/utils/scanpypi
+++ b/utils/scanpypi
@@ -6,8 +6,6 @@ Utility for building Buildroot packages for existing PyPI packages
 Any package built by scanpypi should be manually checked for
 errors.
 """
-from __future__ import print_function
-from __future__ import absolute_import
 import argparse
 import json
 import sys
-- 
2.33.0

_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 3/4] utils/getdeveloperlib.py: use python3 explicitly
  2021-09-15 19:48 [Buildroot] [PATCH v2 0/4] use python3 explicitly Petr Vorel
  2021-09-15 19:48 ` [Buildroot] [PATCH v2 1/4] support: utils: " Petr Vorel
  2021-09-15 19:48 ` [Buildroot] [PATCH v2 2/4] utils/scanpypi: remove python2 compatibility imports Petr Vorel
@ 2021-09-15 19:48 ` Petr Vorel
  2021-09-16 18:42   ` Arnout Vandecappelle
  2021-09-15 19:48 ` [Buildroot] [PATCH v2 4/4] testing/tests/package: " Petr Vorel
  3 siblings, 1 reply; 9+ messages in thread
From: Petr Vorel @ 2021-09-15 19:48 UTC (permalink / raw)
  To: buildroot; +Cc: David Laight, Edgar Bonet

+ remove python2 compatibility imports

library is used by support/scripts/pkg-stats and utils/get-developers
which both use python3. Although library does not require shebang,
it's better to state python3 use.

Tested with python3 -m py_compile.

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
New in v2

 utils/getdeveloperlib.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/utils/getdeveloperlib.py b/utils/getdeveloperlib.py
index ce822320f8..74a3a420ee 100644
--- a/utils/getdeveloperlib.py
+++ b/utils/getdeveloperlib.py
@@ -1,4 +1,5 @@
-from __future__ import print_function
+#!/usr/bin/env python3
+
 from io import open
 import os
 import re
-- 
2.33.0

_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 4/4] testing/tests/package: use python3 explicitly
  2021-09-15 19:48 [Buildroot] [PATCH v2 0/4] use python3 explicitly Petr Vorel
                   ` (2 preceding siblings ...)
  2021-09-15 19:48 ` [Buildroot] [PATCH v2 3/4] utils/getdeveloperlib.py: use python3 explicitly Petr Vorel
@ 2021-09-15 19:48 ` Petr Vorel
  3 siblings, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2021-09-15 19:48 UTC (permalink / raw)
  To: buildroot; +Cc: David Laight, Edgar Bonet

in all testing libraries. Although library does not require shebang,
it's better to state python3 use.

NOTE: keep code "from __future__ import print_function;" in
TestPythonBase() as code itself test both python versions.

Tested with python3 -m py_compile.

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
New in v2

 support/testing/tests/package/test_crudini.py                 | 2 ++
 support/testing/tests/package/test_gst1_python.py             | 2 ++
 support/testing/tests/package/test_ipython.py                 | 2 ++
 support/testing/tests/package/test_libftdi1.py                | 2 ++
 support/testing/tests/package/test_python.py                  | 2 ++
 support/testing/tests/package/test_python_argh.py             | 2 ++
 support/testing/tests/package/test_python_attrs.py            | 2 ++
 support/testing/tests/package/test_python_augeas.py           | 2 ++
 support/testing/tests/package/test_python_autobahn.py         | 2 ++
 support/testing/tests/package/test_python_automat.py          | 2 ++
 support/testing/tests/package/test_python_avro.py             | 2 ++
 support/testing/tests/package/test_python_bitstring.py        | 2 ++
 support/testing/tests/package/test_python_can.py              | 2 ++
 support/testing/tests/package/test_python_cbor.py             | 2 ++
 support/testing/tests/package/test_python_click.py            | 2 ++
 support/testing/tests/package/test_python_colorzero.py        | 2 ++
 support/testing/tests/package/test_python_constantly.py       | 2 ++
 support/testing/tests/package/test_python_crossbar.py         | 2 ++
 support/testing/tests/package/test_python_cryptography.py     | 2 ++
 support/testing/tests/package/test_python_dbus_next.py        | 2 ++
 support/testing/tests/package/test_python_django.py           | 2 ++
 support/testing/tests/package/test_python_gitdb2.py           | 2 ++
 support/testing/tests/package/test_python_gobject.py          | 2 ++
 support/testing/tests/package/test_python_gpiozero.py         | 2 ++
 support/testing/tests/package/test_python_incremental.py      | 2 ++
 support/testing/tests/package/test_python_passlib.py          | 2 ++
 support/testing/tests/package/test_python_pexpect.py          | 2 ++
 support/testing/tests/package/test_python_pynacl.py           | 2 ++
 support/testing/tests/package/test_python_pytest.py           | 2 ++
 support/testing/tests/package/test_python_pytest_asyncio.py   | 2 ++
 support/testing/tests/package/test_python_pyyaml.py           | 2 ++
 support/testing/tests/package/test_python_rpi_gpio.py         | 2 ++
 support/testing/tests/package/test_python_rsa.py              | 2 ++
 support/testing/tests/package/test_python_service_identity.py | 2 ++
 support/testing/tests/package/test_python_smmap2.py           | 2 ++
 support/testing/tests/package/test_python_subprocess32.py     | 2 ++
 support/testing/tests/package/test_python_treq.py             | 2 ++
 support/testing/tests/package/test_python_twisted.py          | 2 ++
 support/testing/tests/package/test_python_txaio.py            | 2 ++
 support/testing/tests/package/test_python_txtorcon.py         | 2 ++
 support/testing/tests/package/test_python_ubjson.py           | 2 ++
 41 files changed, 82 insertions(+)

diff --git a/support/testing/tests/package/test_crudini.py b/support/testing/tests/package/test_crudini.py
index e320d3207e..c86cf9de27 100644
--- a/support/testing/tests/package/test_crudini.py
+++ b/support/testing/tests/package/test_crudini.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 import os
 from tests.package.test_python import TestPythonPackageBase
 
diff --git a/support/testing/tests/package/test_gst1_python.py b/support/testing/tests/package/test_gst1_python.py
index caae3e6b2d..43b150b094 100644
--- a/support/testing/tests/package/test_gst1_python.py
+++ b/support/testing/tests/package/test_gst1_python.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 import os
 from tests.package.test_python import TestPythonPackageBase
 
diff --git a/support/testing/tests/package/test_ipython.py b/support/testing/tests/package/test_ipython.py
index 50b00da7c2..0bde89b729 100644
--- a/support/testing/tests/package/test_ipython.py
+++ b/support/testing/tests/package/test_ipython.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonBase
 #
 # The following pythong tests are not being used here:
diff --git a/support/testing/tests/package/test_libftdi1.py b/support/testing/tests/package/test_libftdi1.py
index 78c928484c..04718f7b7d 100644
--- a/support/testing/tests/package/test_libftdi1.py
+++ b/support/testing/tests/package/test_libftdi1.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python.py b/support/testing/tests/package/test_python.py
index 60da8765c4..98f6c68c50 100644
--- a/support/testing/tests/package/test_python.py
+++ b/support/testing/tests/package/test_python.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 import os
 
 import infra.basetest
diff --git a/support/testing/tests/package/test_python_argh.py b/support/testing/tests/package/test_python_argh.py
index de4b4cbe74..66b5bc15b1 100644
--- a/support/testing/tests/package/test_python_argh.py
+++ b/support/testing/tests/package/test_python_argh.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_attrs.py b/support/testing/tests/package/test_python_attrs.py
index 9f597034ae..917fa99771 100644
--- a/support/testing/tests/package/test_python_attrs.py
+++ b/support/testing/tests/package/test_python_attrs.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_augeas.py b/support/testing/tests/package/test_python_augeas.py
index c1424668d6..59c58d413d 100644
--- a/support/testing/tests/package/test_python_augeas.py
+++ b/support/testing/tests/package/test_python_augeas.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_autobahn.py b/support/testing/tests/package/test_python_autobahn.py
index a237ce465d..d97b743a3e 100644
--- a/support/testing/tests/package/test_python_autobahn.py
+++ b/support/testing/tests/package/test_python_autobahn.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_automat.py b/support/testing/tests/package/test_python_automat.py
index 00a7ed6526..b71e44d3eb 100644
--- a/support/testing/tests/package/test_python_automat.py
+++ b/support/testing/tests/package/test_python_automat.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_avro.py b/support/testing/tests/package/test_python_avro.py
index 6eee2760da..64b3b00aa3 100644
--- a/support/testing/tests/package/test_python_avro.py
+++ b/support/testing/tests/package/test_python_avro.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_bitstring.py b/support/testing/tests/package/test_python_bitstring.py
index 63b3fdb69c..7a57f993e8 100644
--- a/support/testing/tests/package/test_python_bitstring.py
+++ b/support/testing/tests/package/test_python_bitstring.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_can.py b/support/testing/tests/package/test_python_can.py
index d509d05dbb..07131fda01 100644
--- a/support/testing/tests/package/test_python_can.py
+++ b/support/testing/tests/package/test_python_can.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_cbor.py b/support/testing/tests/package/test_python_cbor.py
index 9da3503763..2c0a5cc2e7 100644
--- a/support/testing/tests/package/test_python_cbor.py
+++ b/support/testing/tests/package/test_python_cbor.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_click.py b/support/testing/tests/package/test_python_click.py
index db57d3aa9f..b64594354a 100644
--- a/support/testing/tests/package/test_python_click.py
+++ b/support/testing/tests/package/test_python_click.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_colorzero.py b/support/testing/tests/package/test_python_colorzero.py
index d67f77bdd4..b62c4b3cbb 100644
--- a/support/testing/tests/package/test_python_colorzero.py
+++ b/support/testing/tests/package/test_python_colorzero.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_constantly.py b/support/testing/tests/package/test_python_constantly.py
index 5be01c4f8c..4a12d11c5c 100644
--- a/support/testing/tests/package/test_python_constantly.py
+++ b/support/testing/tests/package/test_python_constantly.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_crossbar.py b/support/testing/tests/package/test_python_crossbar.py
index d7843ddd8b..82076a99e5 100644
--- a/support/testing/tests/package/test_python_crossbar.py
+++ b/support/testing/tests/package/test_python_crossbar.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_cryptography.py b/support/testing/tests/package/test_python_cryptography.py
index 62f0ca0def..1fb4fc9f98 100644
--- a/support/testing/tests/package/test_python_cryptography.py
+++ b/support/testing/tests/package/test_python_cryptography.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_dbus_next.py b/support/testing/tests/package/test_python_dbus_next.py
index 3c597ad198..1a99f18039 100644
--- a/support/testing/tests/package/test_python_dbus_next.py
+++ b/support/testing/tests/package/test_python_dbus_next.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 import textwrap
 
 
diff --git a/support/testing/tests/package/test_python_django.py b/support/testing/tests/package/test_python_django.py
index 0b7d35bb6a..01b6c30c83 100644
--- a/support/testing/tests/package/test_python_django.py
+++ b/support/testing/tests/package/test_python_django.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_gitdb2.py b/support/testing/tests/package/test_python_gitdb2.py
index fc55f20821..6b4d96ad36 100644
--- a/support/testing/tests/package/test_python_gitdb2.py
+++ b/support/testing/tests/package/test_python_gitdb2.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_gobject.py b/support/testing/tests/package/test_python_gobject.py
index cd8a43252b..79cdc717c6 100644
--- a/support/testing/tests/package/test_python_gobject.py
+++ b/support/testing/tests/package/test_python_gobject.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 import os
 from tests.package.test_python import TestPythonPackageBase
 
diff --git a/support/testing/tests/package/test_python_gpiozero.py b/support/testing/tests/package/test_python_gpiozero.py
index 4fe155e6ce..4088def82b 100644
--- a/support/testing/tests/package/test_python_gpiozero.py
+++ b/support/testing/tests/package/test_python_gpiozero.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_incremental.py b/support/testing/tests/package/test_python_incremental.py
index 49800d8937..51ada9dea1 100644
--- a/support/testing/tests/package/test_python_incremental.py
+++ b/support/testing/tests/package/test_python_incremental.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_passlib.py b/support/testing/tests/package/test_python_passlib.py
index 7c85882bf8..cb7a913685 100644
--- a/support/testing/tests/package/test_python_passlib.py
+++ b/support/testing/tests/package/test_python_passlib.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_pexpect.py b/support/testing/tests/package/test_python_pexpect.py
index ba31cdbdbe..c506d95eea 100644
--- a/support/testing/tests/package/test_python_pexpect.py
+++ b/support/testing/tests/package/test_python_pexpect.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_pynacl.py b/support/testing/tests/package/test_python_pynacl.py
index f4dd54940a..e78ccab291 100644
--- a/support/testing/tests/package/test_python_pynacl.py
+++ b/support/testing/tests/package/test_python_pynacl.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_pytest.py b/support/testing/tests/package/test_python_pytest.py
index 1a631adfd3..b214b63793 100644
--- a/support/testing/tests/package/test_python_pytest.py
+++ b/support/testing/tests/package/test_python_pytest.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 import os
 
 from tests.package.test_python import TestPythonPackageBase
diff --git a/support/testing/tests/package/test_python_pytest_asyncio.py b/support/testing/tests/package/test_python_pytest_asyncio.py
index e09abf2abb..06373c3804 100644
--- a/support/testing/tests/package/test_python_pytest_asyncio.py
+++ b/support/testing/tests/package/test_python_pytest_asyncio.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 import os
 
 from tests.package.test_python import TestPythonPackageBase
diff --git a/support/testing/tests/package/test_python_pyyaml.py b/support/testing/tests/package/test_python_pyyaml.py
index cd45a57b86..e83b3f49e6 100644
--- a/support/testing/tests/package/test_python_pyyaml.py
+++ b/support/testing/tests/package/test_python_pyyaml.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_rpi_gpio.py b/support/testing/tests/package/test_python_rpi_gpio.py
index c938ea39bb..83da2d893c 100644
--- a/support/testing/tests/package/test_python_rpi_gpio.py
+++ b/support/testing/tests/package/test_python_rpi_gpio.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_rsa.py b/support/testing/tests/package/test_python_rsa.py
index e63d63e1de..58c9a4716a 100644
--- a/support/testing/tests/package/test_python_rsa.py
+++ b/support/testing/tests/package/test_python_rsa.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_service_identity.py b/support/testing/tests/package/test_python_service_identity.py
index 09cfbe0a26..e501941892 100644
--- a/support/testing/tests/package/test_python_service_identity.py
+++ b/support/testing/tests/package/test_python_service_identity.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_smmap2.py b/support/testing/tests/package/test_python_smmap2.py
index 07c0e6621e..61593886f2 100644
--- a/support/testing/tests/package/test_python_smmap2.py
+++ b/support/testing/tests/package/test_python_smmap2.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_subprocess32.py b/support/testing/tests/package/test_python_subprocess32.py
index d2878046d1..cf90f0be5d 100644
--- a/support/testing/tests/package/test_python_subprocess32.py
+++ b/support/testing/tests/package/test_python_subprocess32.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_treq.py b/support/testing/tests/package/test_python_treq.py
index d7a23829ea..43bb9aaa71 100644
--- a/support/testing/tests/package/test_python_treq.py
+++ b/support/testing/tests/package/test_python_treq.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_twisted.py b/support/testing/tests/package/test_python_twisted.py
index e87312db13..b33be1616a 100644
--- a/support/testing/tests/package/test_python_twisted.py
+++ b/support/testing/tests/package/test_python_twisted.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_txaio.py b/support/testing/tests/package/test_python_txaio.py
index f1bb2c79a6..d3e0db0d33 100644
--- a/support/testing/tests/package/test_python_txaio.py
+++ b/support/testing/tests/package/test_python_txaio.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_txtorcon.py b/support/testing/tests/package/test_python_txtorcon.py
index 8e74190ee1..a43fd187e9 100644
--- a/support/testing/tests/package/test_python_txtorcon.py
+++ b/support/testing/tests/package/test_python_txtorcon.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
diff --git a/support/testing/tests/package/test_python_ubjson.py b/support/testing/tests/package/test_python_ubjson.py
index 85c707e292..5b86352774 100644
--- a/support/testing/tests/package/test_python_ubjson.py
+++ b/support/testing/tests/package/test_python_ubjson.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
 from tests.package.test_python import TestPythonPackageBase
 
 
-- 
2.33.0

_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH v2 3/4] utils/getdeveloperlib.py: use python3 explicitly
  2021-09-15 19:48 ` [Buildroot] [PATCH v2 3/4] utils/getdeveloperlib.py: use python3 explicitly Petr Vorel
@ 2021-09-16 18:42   ` Arnout Vandecappelle
  2021-09-16 19:51     ` Petr Vorel
  0 siblings, 1 reply; 9+ messages in thread
From: Arnout Vandecappelle @ 2021-09-16 18:42 UTC (permalink / raw)
  To: Petr Vorel, buildroot; +Cc: David Laight, Edgar Bonet



On 15/09/2021 21:48, Petr Vorel wrote:
> + remove python2 compatibility imports
> 
> library is used by support/scripts/pkg-stats and utils/get-developers
> which both use python3. Although library does not require shebang,
> it's better to state python3 use.

 Do you have some supporting evidence of this claim "it's better to add a shebang"?

 Looking at a few random projects with python files, I see none that do it.

 And it seems like a lot of noise to add this for no obvious gain. If it's about
documenting the minimum python version, it's not even correct: some of these
scripts will require python3.4 or python3.5 and that's not documented...

 Regards,
 Arnout

> 
> Tested with python3 -m py_compile.
> 
> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> ---
> New in v2
> 
>  utils/getdeveloperlib.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/utils/getdeveloperlib.py b/utils/getdeveloperlib.py
> index ce822320f8..74a3a420ee 100644
> --- a/utils/getdeveloperlib.py
> +++ b/utils/getdeveloperlib.py
> @@ -1,4 +1,5 @@
> -from __future__ import print_function
> +#!/usr/bin/env python3
> +
>  from io import open
>  import os
>  import re
> 
_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH v2 3/4] utils/getdeveloperlib.py: use python3 explicitly
  2021-09-16 18:42   ` Arnout Vandecappelle
@ 2021-09-16 19:51     ` Petr Vorel
  0 siblings, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2021-09-16 19:51 UTC (permalink / raw)
  To: Arnout Vandecappelle; +Cc: David Laight, Edgar Bonet, buildroot

Hi Arnout,

> On 15/09/2021 21:48, Petr Vorel wrote:
> > + remove python2 compatibility imports

> > library is used by support/scripts/pkg-stats and utils/get-developers
> > which both use python3. Although library does not require shebang,
> > it's better to state python3 use.

>  Do you have some supporting evidence of this claim "it's better to add a shebang"?
No.

>  Looking at a few random projects with python files, I see none that do it.
I'm sorry, I was obviously wrong.

>  And it seems like a lot of noise to add this for no obvious gain. If it's about
> documenting the minimum python version, it's not even correct: some of these
> scripts will require python3.4 or python3.5 and that's not documented...
Agree => setting this commit and the 4th commit in patchwork as Rejected.

Thanks a lot for your input.

Kind regards,
Petr

>  Regards,
>  Arnout
_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH v2 1/4] support: utils: use python3 explicitly
  2021-09-15 19:48 ` [Buildroot] [PATCH v2 1/4] support: utils: " Petr Vorel
@ 2021-09-21 20:20   ` Romain Naour
  2021-09-21 20:57     ` Petr Vorel
  0 siblings, 1 reply; 9+ messages in thread
From: Romain Naour @ 2021-09-21 20:20 UTC (permalink / raw)
  To: Petr Vorel, buildroot; +Cc: David Laight, Edgar Bonet

Hello Petr,

Le 15/09/2021 à 21:48, Petr Vorel a écrit :
> Python 2 is EOL sice 2020 [1], it's still available on distros, but may not
> be installed by default (as being replaced by python3).
> 
> Thus remove compatibility imports:
> from __future__ import print_function
> from __future__ import absolute_import
> 
> Tested with python3 -m py_compile.
> 
> [1] https://www.python.org/doc/sunset-python-2/
> 
> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> ---

> diff --git a/utils/get-developers b/utils/get-developers
> index 9182b2d85f..22accaf181 100755
> --- a/utils/get-developers
> +++ b/utils/get-developers
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env python
> +#!/usr/bin/env python3
>  
>  import argparse
>  import getdeveloperlib

There is one remaining __future__ to remove:

utils/getdeveloperlib.py:from __future__ import print_function

It was removed by your patch 3/4 but it was rejected:
http://patchwork.ozlabs.org/project/buildroot/patch/20210915194839.22122-4-petr.vorel@gmail.com/

Maybe it can be removed directly from this patch.

Best regards,
Romain


> diff --git a/utils/size-stats-compare b/utils/size-stats-compare
> index a3d7f250c6..422972e488 100755
> --- a/utils/size-stats-compare
> +++ b/utils/size-stats-compare
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env python
> +#!/usr/bin/env python3
>  
>  # Copyright (C) 2016 Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>  
> 

_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH v2 1/4] support: utils: use python3 explicitly
  2021-09-21 20:20   ` Romain Naour
@ 2021-09-21 20:57     ` Petr Vorel
  0 siblings, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2021-09-21 20:57 UTC (permalink / raw)
  To: Romain Naour; +Cc: David Laight, Edgar Bonet, buildroot

Hi Romain,

> Hello Petr,

> Le 15/09/2021 à 21:48, Petr Vorel a écrit :
> > Python 2 is EOL sice 2020 [1], it's still available on distros, but may not
> > be installed by default (as being replaced by python3).

> > Thus remove compatibility imports:
> > from __future__ import print_function
> > from __future__ import absolute_import

> > Tested with python3 -m py_compile.

> > [1] https://www.python.org/doc/sunset-python-2/

> > Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> > ---

> > diff --git a/utils/get-developers b/utils/get-developers
> > index 9182b2d85f..22accaf181 100755
> > --- a/utils/get-developers
> > +++ b/utils/get-developers
> > @@ -1,4 +1,4 @@
> > -#!/usr/bin/env python
> > +#!/usr/bin/env python3

> >  import argparse
> >  import getdeveloperlib

> There is one remaining __future__ to remove:

> utils/getdeveloperlib.py:from __future__ import print_function
Thanks!

> It was removed by your patch 3/4 but it was rejected:
> http://patchwork.ozlabs.org/project/buildroot/patch/20210915194839.22122-4-petr.vorel@gmail.com/

I set it as rejected.

> Maybe it can be removed directly from this patch.
Nah, I can send v3 with this fixed.

> Best regards,
> Romain
_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-09-21 20:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15 19:48 [Buildroot] [PATCH v2 0/4] use python3 explicitly Petr Vorel
2021-09-15 19:48 ` [Buildroot] [PATCH v2 1/4] support: utils: " Petr Vorel
2021-09-21 20:20   ` Romain Naour
2021-09-21 20:57     ` Petr Vorel
2021-09-15 19:48 ` [Buildroot] [PATCH v2 2/4] utils/scanpypi: remove python2 compatibility imports Petr Vorel
2021-09-15 19:48 ` [Buildroot] [PATCH v2 3/4] utils/getdeveloperlib.py: use python3 explicitly Petr Vorel
2021-09-16 18:42   ` Arnout Vandecappelle
2021-09-16 19:51     ` Petr Vorel
2021-09-15 19:48 ` [Buildroot] [PATCH v2 4/4] testing/tests/package: " Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.