diff mbox

[ovs-dev,2/2] ovs-dev.py: Update for python3.

Message ID 1463435819-20238-2-git-send-email-joe@ovn.org
State Accepted
Headers show

Commit Message

Joe Stringer May 16, 2016, 9:56 p.m. UTC
Adapt to python-2.6+, including support for 3.

Signed-off-by: Joe Stringer <joe@ovn.org>
---
 utilities/ovs-dev.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Russell Bryant July 28, 2016, 6:02 p.m. UTC | #1
On Mon, May 16, 2016 at 5:56 PM, Joe Stringer <joe@ovn.org> wrote:

> Adapt to python-2.6+, including support for 3.
>
> Signed-off-by: Joe Stringer <joe@ovn.org>
>

Acked-by: Russell Bryant <russell@ovn.org>
Joe Stringer July 28, 2016, 6:11 p.m. UTC | #2
On 28 July 2016 at 11:02, Russell Bryant <russell@ovn.org> wrote:
>
>
> On Mon, May 16, 2016 at 5:56 PM, Joe Stringer <joe@ovn.org> wrote:
>>
>> Adapt to python-2.6+, including support for 3.
>>
>> Signed-off-by: Joe Stringer <joe@ovn.org>
>
>
> Acked-by: Russell Bryant <russell@ovn.org>

Thanks for the review, it looks like this has already been pushed but
it's good to see it was in good shape ;)

If you are currently having some issue with ovs-dev.py and python3 on
a recent master then maybe this patch didn't cover that, so I suggest
you follow up with another patch to fix it.
Russell Bryant July 28, 2016, 7:22 p.m. UTC | #3
On Thu, Jul 28, 2016 at 2:11 PM, Joe Stringer <joe@ovn.org> wrote:

> On 28 July 2016 at 11:02, Russell Bryant <russell@ovn.org> wrote:
> >
> >
> > On Mon, May 16, 2016 at 5:56 PM, Joe Stringer <joe@ovn.org> wrote:
> >>
> >> Adapt to python-2.6+, including support for 3.
> >>
> >> Signed-off-by: Joe Stringer <joe@ovn.org>
> >
> >
> > Acked-by: Russell Bryant <russell@ovn.org>
>
> Thanks for the review, it looks like this has already been pushed but
> it's good to see it was in good shape ;)
>
> If you are currently having some issue with ovs-dev.py and python3 on
> a recent master then maybe this patch didn't cover that, so I suggest
> you follow up with another patch to fix it.
>

Ha, sorry.  I don't actually use this.

It looked like a new unreviewed patch in my email client.  I had done a
search for "2.6" looking for a mail talking about OVS 2.6 plans and then
didn't clear the search.  The commit message talks about Python 2.6.  I
wasn't paying any attention to dates and the mail caught my eye as an easy
quick review.

Oops.  :-)
diff mbox

Patch

diff --git a/utilities/ovs-dev.py b/utilities/ovs-dev.py
index 0ba4280a8ddf..40cd43e14730 100755
--- a/utilities/ovs-dev.py
+++ b/utilities/ovs-dev.py
@@ -54,7 +54,7 @@  def _sh(*args, **kwargs):
 
 
 def uname():
-    return _sh("uname", "-r", capture=True)[0].strip()
+    return _sh("uname", "-r", capture=True)[0].decode().strip()
 
 
 def sudo():
@@ -296,13 +296,13 @@  def modinst():
     sudo()
     try:
         _sh("rmmod", "openvswitch")
-    except subprocess.CalledProcessError, e:
+    except subprocess.CalledProcessError as e:
         pass  # Module isn't loaded
 
     try:
         _sh("rm -f /lib/modules/%s/extra/openvswitch.ko" % uname())
         _sh("rm -f /lib/modules/%s/extra/vport-*.ko" % uname())
-    except subprocess.CalledProcessError, e:
+    except subprocess.CalledProcessError as e:
         pass  # Module isn't installed
 
     conf()
@@ -409,7 +409,7 @@  def main():
     parser.add_option_group(group)
 
     group = optparse.OptionGroup(parser, "Optimization Flags")
-    for i in ["s", "g"] + range(4) + ["fast"]:
+    for i in ["s", "g"] + list(range(4)) + ["fast"]:
         group.add_option("--O%s" % str(i), dest="optimize",
                          action="store_const", const=i,
                          help="compile with -O%s" % str(i))