[ovs-git] [openvswitch/ovs] 3ab76c: python: Start fixing some Python 3 issues.

GitHub noreply at github.com
Tue Jan 12 16:47:59 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: 3ab76c56d88bcdb5d3993ed8c793312a754b7315
      https://github.com/openvswitch/ovs/commit/3ab76c56d88bcdb5d3993ed8c793312a754b7315
  Author: Terry Wilson <twilson at redhat.com>
  Date:   2016-01-12 (Tue, 12 Jan 2016)

  Changed paths:
    M python/ovs/daemon.py
    M python/ovs/db/idl.py
    M python/ovs/fatal_signal.py
    M python/ovs/json.py
    M python/ovs/ovsuuid.py
    M python/ovs/poller.py
    M python/ovs/socket_util.py
    M python/ovs/stream.py
    M python/setup.py

  Log Message:
  -----------
  python: Start fixing some Python 3 issues.

This patch fixes just the Python 3 problems found by running:

  python3 setup.py install

There are still many other issues to be fixed, but this is a start.

Signed-off-by: Terry Wilson <twilson at redhat.com>
[russell at ovn.org resolved conflicts with current master]
Signed-off-by: Russell Bryant <russell at ovn.org>
Acked-by: Ben Pfaff <blp at ovn.org>


  Commit: 66d61c90a79db159cc43e3f17c57d83d9a99453f
      https://github.com/openvswitch/ovs/commit/66d61c90a79db159cc43e3f17c57d83d9a99453f
  Author: Russell Bryant <russell at ovn.org>
  Date:   2016-01-12 (Tue, 12 Jan 2016)

  Changed paths:
    M python/ovstest/udp.py

  Log Message:
  -----------
  python: Stop use of tuple parameter unpacking

Python 3 removed support for tuple parameter unpacking.

https://www.python.org/dev/peps/pep-3113/

Instead of:

    def foo((a, b)):
  print(a)
  print(b)

you should do:

    def foo(a_b):
  a, b = a_b
  print(a)
  print(b)

but in both uses here, the values were never used so the fix is even
simpler.

Signed-off-by: Russell Bryant <russell at ovn.org>
Acked-by: Ben Pfaff <blp at ovn.org>


  Commit: f3068bff92dc4fb76ee4aab149990f2492bcbc24
      https://github.com/openvswitch/ovs/commit/f3068bff92dc4fb76ee4aab149990f2492bcbc24
  Author: Russell Bryant <russell at ovn.org>
  Date:   2016-01-12 (Tue, 12 Jan 2016)

  Changed paths:
    M Makefile.am
    M debian/ovs-monitor-ipsec
    M ofproto/ipfix-gen-entities
    M tests/test-json.py
    M tests/test-ovsdb.py
    M utilities/ovs-pcap.in
    M xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync

  Log Message:
  -----------
  python: Fix exception handler compatibility.

Python 3 dropped exception handlers of the deprecated form:

  except Exception, e:

You must use the newer syntax of:

  except Exception as e:

This patch also enables a flake8 warning for this.

  H231 Python 3.x incompatible 'except x,y:' construct

Signed-off-by: Russell Bryant <russell at ovn.org>
Acked-by: Ben Pfaff <blp at ovn.org>


  Commit: 8ea171aba044bf605c31313330ccabfc4fc5846c
      https://github.com/openvswitch/ovs/commit/8ea171aba044bf605c31313330ccabfc4fc5846c
  Author: Russell Bryant <russell at ovn.org>
  Date:   2016-01-12 (Tue, 12 Jan 2016)

  Changed paths:
    M Makefile.am
    M ofproto/ipfix-gen-entities
    M python/ovstest/rpcserver.py
    M python/ovstest/tests.py
    M tests/test-json.py
    M tests/test-jsonrpc.py
    M tests/test-ovsdb.py
    M tests/test-reconnect.py
    M utilities/ovs-pcap.in

  Log Message:
  -----------
  python: Fix print function compatibility.

The print statement from Python 2 is a function in Python 3.  Enable
print function support for Python 2 and convert print statements to
function calls.

Enable the H233 flake8 warning.  If the hacking plugin is installed,
this will generate warnings for print statement usage not compatible
with Python 3.

  H233 Python 3.x incompatible use of print operator

Signed-off-by: Russell Bryant <russell at ovn.org>
Acked-by: Ben Pfaff <blp at ovn.org>


Compare: https://github.com/openvswitch/ovs/compare/ab2a3154f09e...8ea171aba044


More information about the git mailing list