All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [RFC PATCH 1/1] support: utils: Use python3
@ 2021-09-14 17:43 Petr Vorel
  2021-09-15  8:13 ` David Laight
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2021-09-14 17:43 UTC (permalink / raw)
  To: buildroot

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).

Tested with python3 -m py_compile.

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

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
 support/scripts/cve.py                                 | 2 +-
 support/scripts/graph-build-time                       | 2 +-
 support/scripts/graph-depends                          | 2 +-
 support/scripts/pycompile.py                           | 2 +-
 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                                    | 2 +-
 utils/genrandconfig                                    | 2 +-
 utils/get-developers                                   | 2 +-
 utils/size-stats-compare                               | 2 +-
 11 files changed, 11 insertions(+), 11 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..549272ab33 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
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..6540af6b2d 100755
--- a/utils/check-package
+++ b/utils/check-package
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # See utils/checkpackagelib/readme.txt before editing this file.
 
 from __future__ import print_function
diff --git a/utils/genrandconfig b/utils/genrandconfig
index 622cfd4891..062f9f77d6 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>
 #
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] 4+ messages in thread

* Re: [Buildroot] [RFC PATCH 1/1] support: utils: Use python3
  2021-09-14 17:43 [Buildroot] [RFC PATCH 1/1] support: utils: Use python3 Petr Vorel
@ 2021-09-15  8:13 ` David Laight
  2021-09-15  8:49   ` Edgar Bonet
  2021-09-15 19:10   ` Petr Vorel
  0 siblings, 2 replies; 4+ messages in thread
From: David Laight @ 2021-09-15  8:13 UTC (permalink / raw)
  To: 'Petr Vorel', buildroot

From: Petr Vorel
> Sent: 14 September 2021 18:43
> 
> 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).
> 
...
> -#!/usr/bin/env python
> +#!/usr/bin/env python3

Doesn't python3 just get installed as python?
So you don't need to change these lines.

...
> diff --git a/utils/check-package b/utils/check-package
> index dd18d19c25..6540af6b2d 100755
> --- a/utils/check-package
> +++ b/utils/check-package
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env python
> +#!/usr/bin/env python3
>  # See utils/checkpackagelib/readme.txt before editing this file.
> 
>  from __future__ import print_function

For p3 you can also remove that import.

FWIW that didn't help me get some python scripts to run under
p2 and p3 because one of the p2 installations was too old to
support it.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

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

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

* Re: [Buildroot] [RFC PATCH 1/1] support: utils: Use python3
  2021-09-15  8:13 ` David Laight
@ 2021-09-15  8:49   ` Edgar Bonet
  2021-09-15 19:10   ` Petr Vorel
  1 sibling, 0 replies; 4+ messages in thread
From: Edgar Bonet @ 2021-09-15  8:49 UTC (permalink / raw)
  To: buildroot

Hi!

David asked:
> Doesn't python3 just get installed as python?

On Ubuntu and Debian Bullseye, the Python 3 interpreter is installed as
python3, and Python 2, if requested, is installed as python2. All
packaged Python scripts explicitly request either python3 or, for some
legacy packages, python2.

There are two optional packages named python-is-python2 and
python-is-python3 that install a symlink named "python" pointing to
either python2 or python3. These are intended for compatibility with
non-Ubuntu or non-Debian scripts that call the unversioned "python".
They are, obviously, incompatible with one another.

On Ubuntu and Debian, at least, it is then preferred to explicitly
request either python2 or python3 as the interpreter.

Regards,

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

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

* Re: [Buildroot] [RFC PATCH 1/1] support: utils: Use python3
  2021-09-15  8:13 ` David Laight
  2021-09-15  8:49   ` Edgar Bonet
@ 2021-09-15 19:10   ` Petr Vorel
  1 sibling, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2021-09-15 19:10 UTC (permalink / raw)
  To: David Laight; +Cc: buildroot

> From: Petr Vorel
> > Sent: 14 September 2021 18:43

> > 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).

> ...
> > -#!/usr/bin/env python
> > +#!/usr/bin/env python3

> Doesn't python3 just get installed as python?
No, that's for python2. At least on Debian and openSUSE. On current Debian
testing it's only python3. Sure, I can install python2 package now, but sooner
or later python2 will be removed. And I'm not sure if all distros just change
python symlink to python3 binary, when they remove python2 package.

> So you don't need to change these lines.

> ...
> > diff --git a/utils/check-package b/utils/check-package
> > index dd18d19c25..6540af6b2d 100755
> > --- a/utils/check-package
> > +++ b/utils/check-package
> > @@ -1,4 +1,4 @@
> > -#!/usr/bin/env python
> > +#!/usr/bin/env python3
> >  # See utils/checkpackagelib/readme.txt before editing this file.

> >  from __future__ import print_function

> For p3 you can also remove that import.
Ah, correct, thanks! I'll add it in v2:

Kind regards,
Petr

> FWIW that didn't help me get some python scripts to run under
> p2 and p3 because one of the p2 installations was too old to
> support it.

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

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

end of thread, other threads:[~2021-09-15 19:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14 17:43 [Buildroot] [RFC PATCH 1/1] support: utils: Use python3 Petr Vorel
2021-09-15  8:13 ` David Laight
2021-09-15  8:49   ` Edgar Bonet
2021-09-15 19:10   ` 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.