diff mbox

[U-Boot,RFC,v2,2/2] tools: make genboardscfg.py compatible with Python 2.5

Message ID 1407147794-32066-3-git-send-email-yamada.m@jp.panasonic.com
State RFC
Delegated to: Tom Rini
Headers show

Commit Message

Masahiro Yamada Aug. 4, 2014, 10:23 a.m. UTC
The statement "exception ... as ..." can be used in Python 2.6
or lator. Avoid using it.
Tested on Python 2.5.6.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

Changes in v2:
  - Fix git-description.  s/exception/except/

 tools/genboardscfg.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Masahiro Yamada Aug. 22, 2014, 6:01 a.m. UTC | #1
Tom, 


I noticed this patch's gone to RFC.

Did you decide to drop python2.5 from support?

If so, I will use "except ... as ..." and "with ... as ..."
statements in my other patches.


Best Regards
Masahiro Yamada



On Mon,  4 Aug 2014 19:23:14 +0900
Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:

> The statement "exception ... as ..." can be used in Python 2.6
> or lator. Avoid using it.
> Tested on Python 2.5.6.
> 
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> ---
> 
> Changes in v2:
>   - Fix git-description.  s/exception/except/
> 
>  tools/genboardscfg.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py
> index 734d90b..9e4892f 100755
> --- a/tools/genboardscfg.py
> +++ b/tools/genboardscfg.py
> @@ -57,7 +57,7 @@ def get_terminal_columns():
>          arg = struct.pack('hhhh', 0, 0, 0, 0)
>          try:
>              ret = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, arg)
> -        except IOError as exception:
> +        except IOError, exception:
>              if exception.errno != errno.ENOTTY:
>                  raise
>              # If 'Inappropriate ioctl for device' error occurs,
> @@ -473,7 +473,7 @@ def gen_boards_cfg(jobs):
>          # We should remove incomplete boards.cfg
>          try:
>              os.remove(BOARD_FILE)
> -        except OSError as exception:
> +        except OSError, exception:
>              # Ignore 'No such file or directory' error
>              if exception.errno != errno.ENOENT:
>                  raise
> -- 
> 1.9.1
Masahiro Yamada Aug. 22, 2014, 6:18 a.m. UTC | #2
Tom,


A litte more info:


Buildman does not work on python 2.5.
(only 2.6 and 2.7)
No complaint about it so far.

This tools is intended to be a work-around for using
MAKEALL and Buildman, but we are removing the former.

In that case, having only this tool support python 2.5
seems meaningless.


Best Regards
Masahiro Yamada





On Fri, 22 Aug 2014 15:01:30 +0900
Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:

> Tom, 
> 
> 
> I noticed this patch's gone to RFC.
> 
> Did you decide to drop python2.5 from support?
> 
> If so, I will use "except ... as ..." and "with ... as ..."
> statements in my other patches.
> 
> 
> Best Regards
> Masahiro Yamada
> 
> 
> 
> On Mon,  4 Aug 2014 19:23:14 +0900
> Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
> 
> > The statement "exception ... as ..." can be used in Python 2.6
> > or lator. Avoid using it.
> > Tested on Python 2.5.6.
> > 
> > Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> > ---
> > 
> > Changes in v2:
> >   - Fix git-description.  s/exception/except/
> > 
> >  tools/genboardscfg.py | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py
> > index 734d90b..9e4892f 100755
> > --- a/tools/genboardscfg.py
> > +++ b/tools/genboardscfg.py
> > @@ -57,7 +57,7 @@ def get_terminal_columns():
> >          arg = struct.pack('hhhh', 0, 0, 0, 0)
> >          try:
> >              ret = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, arg)
> > -        except IOError as exception:
> > +        except IOError, exception:
> >              if exception.errno != errno.ENOTTY:
> >                  raise
> >              # If 'Inappropriate ioctl for device' error occurs,
> > @@ -473,7 +473,7 @@ def gen_boards_cfg(jobs):
> >          # We should remove incomplete boards.cfg
> >          try:
> >              os.remove(BOARD_FILE)
> > -        except OSError as exception:
> > +        except OSError, exception:
> >              # Ignore 'No such file or directory' error
> >              if exception.errno != errno.ENOENT:
> >                  raise
> > -- 
> > 1.9.1
> 
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Tom Rini Aug. 23, 2014, 12:44 p.m. UTC | #3
On Fri, Aug 22, 2014 at 03:01:30PM +0900, Masahiro Yamada wrote:

> Tom, 
> 
> 
> I noticed this patch's gone to RFC.
> 
> Did you decide to drop python2.5 from support?
> 
> If so, I will use "except ... as ..." and "with ... as ..."
> statements in my other patches.

So, I'm not 100% sure just yet how to handle this.  I'm biased about
supporting python2.6 since that's what my big compute resources are
pinned to (until Ubuntu 10.04 LTS is no longer supported).  And I'm
making them switch to buildman too.  It's also possible (and encouraged,
relatively speaking, by the admins) to add required new software
/over/there.  So how hard is it to keep what MAKEALL/buildman needs (so
genboardscfg.py) and maybe even convert buildman to python2.5-or-later ?
Masahiro Yamada Aug. 25, 2014, 1:53 a.m. UTC | #4
Hi Tom,


On Sat, 23 Aug 2014 08:44:49 -0400
Tom Rini <trini@ti.com> wrote:

> On Fri, Aug 22, 2014 at 03:01:30PM +0900, Masahiro Yamada wrote:
> 
> > Tom, 
> > 
> > 
> > I noticed this patch's gone to RFC.
> > 
> > Did you decide to drop python2.5 from support?
> > 
> > If so, I will use "except ... as ..." and "with ... as ..."
> > statements in my other patches.
> 
> So, I'm not 100% sure just yet how to handle this.  I'm biased about
> supporting python2.6 since that's what my big compute resources are
> pinned to (until Ubuntu 10.04 LTS is no longer supported).  And I'm
> making them switch to buildman too.  It's also possible (and encouraged,
> relatively speaking, by the admins) to add required new software
> /over/there.  So how hard is it to keep what MAKEALL/buildman needs (so
> genboardscfg.py) and maybe even convert buildman to python2.5-or-later ?


Unfortunately, python 2.5 is missing some important statements
which are often used these days.

We can change "except ... as ..." to "except ... , ..." automatically,
but we have to convert "with ... as ..." by hand.

I am not happy (and I guess Simon neither)
about converting already working scripts.


OK.
Let's support only python 2.6 or lator (but not 3.x)
and see what will happen.

Perhaps someone may complain about it,
but I think we can excuse here because they are no-core utilities.

Anyway, I think python 2.5 is too old, so this is an acceptable limition.


Best Regards
Masahiro Yamada
diff mbox

Patch

diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py
index 734d90b..9e4892f 100755
--- a/tools/genboardscfg.py
+++ b/tools/genboardscfg.py
@@ -57,7 +57,7 @@  def get_terminal_columns():
         arg = struct.pack('hhhh', 0, 0, 0, 0)
         try:
             ret = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, arg)
-        except IOError as exception:
+        except IOError, exception:
             if exception.errno != errno.ENOTTY:
                 raise
             # If 'Inappropriate ioctl for device' error occurs,
@@ -473,7 +473,7 @@  def gen_boards_cfg(jobs):
         # We should remove incomplete boards.cfg
         try:
             os.remove(BOARD_FILE)
-        except OSError as exception:
+        except OSError, exception:
             # Ignore 'No such file or directory' error
             if exception.errno != errno.ENOENT:
                 raise