use python3 explicitly
v3 cover use python3 explicitly
Hi,
changes v2->v3:
* remove __future__ from utils/getdeveloperlib.py (previously in 3rd commit [1]; noted by Romain [2])
changes v1->v2:
* 3 more commits
* remove also python2 compatibility imports
Kind regards,
Petr
[1] https://lore.kernel.org/buildroot/[email protected]/
[2] https://lore.kernel.org/buildroot/[email protected]/
Petr Vorel (2):
support: utils: use python3 explicitly utils/scanpypi: remove 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/getdeveloperlib.py | 1 - utils/scanpypi | 2 -- utils/size-stats-compare | 2 +- 13 files changed, 11 insertions(+), 19 deletions(-)
Signature · 6 lines
2.33.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
RFC PATCH v3 1/2 support: utils: use python3 explicitly
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/
---
Changes v2->v3:
* remove __future__ from utils/getdeveloperlib.py (previously in 3rd
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/getdeveloperlib.py | 1 - utils/size-stats-compare | 2 +- 12 files changed, 11 insertions(+), 17 deletions(-)
support/scripts/cve.py +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (C) 2009 by Thomas Petazzoni <[email protected]> # Copyright (C) 2020 by Gregory CLEMENT <[email protected]>
support/scripts/graph-build-time +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (C) 2011 by Thomas Petazzoni <[email protected]> # Copyright (C) 2013 by Yann E. MORIN <[email protected]>
support/scripts/graph-depends +1 -1
@@ -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
support/scripts/pycompile.py +1 -3
@@ -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
support/scripts/size-stats +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (C) 2014 by Thomas Petazzoni <[email protected]>
support/testing/tests/package/sample_gst1_python.py +1 -1
@@ -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 """
support/testing/tests/package/sample_python_gobject.py +1 -1
@@ -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
utils/check-package +1 -2
@@ -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
utils/genrandconfig +1 -3
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (C) 2014 by Thomas Petazzoni <[email protected]> #
@@ -18,8 +18,6 @@ # This script generates a random configuration for testing Buildroot. -from __future__ import print_function - import contextlib import csv import os
utils/get-developers +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import argparse import getdeveloperlib
utils/getdeveloperlib.py +0 -1
@@ -1,4 +1,3 @@ -from __future__ import print_function from io import open import os import re
utils/size-stats-compare +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (C) 2016 Thomas De Schampheleire <[email protected]>
Signature · 6 lines
2.33.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [RFC PATCH v3 1/2] support: utils: use python3 explicitly
Quoted 2 lines · Petr Vorel
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).
I do not mind if everyone wants to make a transition to Python 3-only support utilities, but I just wanted to mention that RHEL still supports Python 2.x until June 2024 [1]. I am not aware of what environments may be using RHEL8 to perform Buildroot-related development and RHEL8 does support Python 3, so it may not be an issue.
[1]: https://access.redhat.com/support/policy/updates/rhel8-app-streams-life-cycle
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [RFC PATCH v3 1/2] support: utils: use python3 explicitly
Quoted 10 lines · James Knight
Quoted 2 lines · Petr Vorel
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).
I do not mind if everyone wants to make a transition to Python 3-only support utilities, but I just wanted to mention that RHEL still supports Python 2.x until June 2024 [1]. I am not aware of what environments may be using RHEL8 to perform Buildroot-related development and RHEL8 does support Python 3, so it may not be an issue.
Even on RHEL, it's possible to install python3.6 (maybe even 3.7) through
rhscl. So RedHat is definitely not keeping us back to switch to Python3.
The reason RHEL still maintains python2 is to keep existing scripts that
*don't* work on python3 operational.
Regards,
Arnout
Quoted 7 lines
[1]: https://access.redhat.com/support/policy/updates/rhel8-app-streams-life-cycle
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
RFC PATCH v3 2/2 utils/scanpypi: remove python2 compatibility imports
In reply to Petr Vorelee8b680816 ("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.
---
Changes v2->v3:
* The same as v2
utils/scanpypi | 2 -- 1 file changed, 2 deletions(-)
utils/scanpypi +0 -2
@@ -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
Signature · 6 lines
2.33.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [RFC PATCH v3 2/2] utils/scanpypi: remove python2 compatibility imports
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Petr" == Petr Vorel <[email protected]> writes:
ee8b680816("utils/scanpypi: use python3 explicitly") started to use python3, thus compatibility can be removed:from
__future__importprint_function
from__future__importabsolute_importTested with python3 -m
py_compile.Signed-off-by Petr Vorel <[email protected]>
Committed to 2021.02.x, 2021.05.x and 2021.08.x, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 13 lines · Petr Vorel
Hi,
changes
v2->v3:
* remove__future__fromutils/getdeveloperlib.py(previously in 3rd commit [1]; noted by Romain [2])changes
v1->v2:
* 3 more commits
* remove also python2 compatibility importsKind regards,
Petr
Quoted 6 lines
[1] https://lore.kernel.org/buildroot/[email protected]/
[2] https://lore.kernel.org/buildroot/[email protected]/Petr Vorel (2):
support: utils: use python3 explicitly utils/scanpypi: remove python2 compatibility imports
Both applied to master, thanks.
I found that also utils/diffconfig was still using pyhon, so I sent a patch to
fix that one as well. I checked in the kernel, they made the same change there.
Regards,
Arnout
Quoted 16 lines
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/getdeveloperlib.py | 1 - utils/scanpypi | 2 -- utils/size-stats-compare | 2 +- 13 files changed, 11 insertions(+), 19 deletions(-)
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot