diff mbox series

[3/6] moveconfig: Drop check for old Python

Message ID 20211218215435.1159723-4-sjg@chromium.org
State Accepted
Commit 478920dc586458e49cd4801654b31f5c8ea58569
Delegated to: Tom Rini
Headers show
Series moveconfig: Improve the pylist score a little | expand

Commit Message

Simon Glass Dec. 18, 2021, 9:54 p.m. UTC
Python 2 is not supported anymore and Python 3 has had subprocess.DEVNULL
since version 3.3 which was released in 2012. Drop the unnecessary check.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/moveconfig.py | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

Comments

Heinrich Schuchardt Dec. 18, 2021, 10:27 p.m. UTC | #1
On 12/18/21 22:54, Simon Glass wrote:
> Python 2 is not supported anymore and Python 3 has had subprocess.DEVNULL
> since version 3.3 which was released in 2012. Drop the unnecessary check.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

> ---
>
>   tools/moveconfig.py | 10 +---------
>   1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/tools/moveconfig.py b/tools/moveconfig.py
> index 521297f7d58..0b33f3190e3 100755
> --- a/tools/moveconfig.py
> +++ b/tools/moveconfig.py
> @@ -91,14 +91,6 @@ SIZES = {
>   }
>
>   ### helper functions ###
> -def get_devnull():
> -    """Get the file object of '/dev/null' device."""
> -    try:
> -        devnull = subprocess.DEVNULL # py3k
> -    except AttributeError:
> -        devnull = open(os.devnull, 'wb')
> -    return devnull
> -
>   def check_top_directory():
>       """Exit if we are not at the top of source directory."""
>       for f in ('README', 'Licenses'):
> @@ -1083,7 +1075,7 @@ class Slots:
>           """
>           self.args = args
>           self.slots = []
> -        devnull = get_devnull()
> +        devnull = subprocess.DEVNULL
>           make_cmd = get_make_cmd()
>           for i in range(args.jobs):
>               self.slots.append(Slot(toolchains, configs, args, progress,
Tom Rini Jan. 25, 2022, 3:58 p.m. UTC | #2
On Sat, Dec 18, 2021 at 02:54:32PM -0700, Simon Glass wrote:

> Python 2 is not supported anymore and Python 3 has had subprocess.DEVNULL
> since version 3.3 which was released in 2012. Drop the unnecessary check.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index 521297f7d58..0b33f3190e3 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -91,14 +91,6 @@  SIZES = {
 }
 
 ### helper functions ###
-def get_devnull():
-    """Get the file object of '/dev/null' device."""
-    try:
-        devnull = subprocess.DEVNULL # py3k
-    except AttributeError:
-        devnull = open(os.devnull, 'wb')
-    return devnull
-
 def check_top_directory():
     """Exit if we are not at the top of source directory."""
     for f in ('README', 'Licenses'):
@@ -1083,7 +1075,7 @@  class Slots:
         """
         self.args = args
         self.slots = []
-        devnull = get_devnull()
+        devnull = subprocess.DEVNULL
         make_cmd = get_make_cmd()
         for i in range(args.jobs):
             self.slots.append(Slot(toolchains, configs, args, progress,