2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 01:51:26 +00:00

12 Commits

Author SHA1 Message Date
Timothy Redaelli
0c4d144a98 Remove dependency on python3-six
Since Python 2 support was removed in 1ca0323e7c29 ("Require Python 3 and
remove support for Python 2."), python3-six is not needed anymore.

Moreover python3-six is not available on RHEL/CentOS7 without using EPEL
and so this patch is needed in order to release OVS 2.13 on RHEL7.

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-12-20 12:23:06 -08:00
Ilya Maximets
e6703555e5 Revert "Test the Python C JSON extension"
This reverts commit a7be68a4d77791bbe02c37f7ad8ae60b02e5679e
and a subsequent commit 4617d1f6bd24c543f533f6485b42ebca6b0a8371.
There are too many issues with these patches. It's better to revert
them for now and make a separate fixed versions later if needed.

List of issues (maybe not full):

1. 'make clean' removes entire 'python' directory.

2. Fully broken Travis-CI testsuite build:
    building 'ovs._json' extension
    creating build/temp.linux-x86_64-2.7
    error: could not create 'build/temp.linux-x86_64-2.7': \
           Permission denied
    https://travis-ci.org/openvswitch/ovs/jobs/440693765

3. Broken local testsuite build on Ubuntu 18.04:
    running build_ext
    building 'ovs._json' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/ovs
    <...>
    /usr/bin/ld: .libs/libopenvswitch.a(util.o): \
        relocation R_X86_64_TPOFF32 against `var.7749' can not be \
        used when making a shared object; recompile with -fPIC
    <...>
    collect2: error: ld returned 1 exit status

4. Fedora build failure because of 'setuptools' ('distutils')
   hard dependency on 'redhat-rpm-config' package:
    building 'ovs._json' extension
    <...>
    gcc: error: <...>/redhat-hardened-cc1: No such file or directory

5. Looks like 'setuptools' also could download and install
   unwanted python modules during package build.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-15 11:13:48 -07:00
Terry Wilson
a7be68a4d7 Test the Python C JSON extension
The C JSON parser was added quite a while ago, but unless you
configure with --enable-shared and have the Python 2/3 development
libraries installed, and the resulting python-ovs module installed,
'make check' won't actually test it.

This patch changes Python-based tests to run from the
$builddir/python directory and makes the tests configurable to use
both JSON backends. There are some unicode failures in the C JSON
extension that I left unfixed in this patch to make it easy to
show run the new tests on broken code. The next patch in this set
works around the issue.

Signed-off-by: Terry Wilson <twilson@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
2018-10-11 15:00:46 -07:00
xurong00037997
6c7050b59c Adapt to flake8-import-order
https://review.openstack.org/#/c/432906/
flake8-import-order adds 3 new flake8 warnings:
I100: Your import statements are in the wrong order.
I101: The names in your from import are in the wrong order.
I201: Missing newline between sections or imports.

Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-03-08 21:11:48 -08:00
Russell Bryant
28b4f69ba2 python: Update Python version checks.
Instead of checking the raw version, use the six.PY2 and six.PY3 helpers
to determine if Python 2 or Python 3 are in use.

In one case, the check was to determine if the Python version was >=
2.6.  We now only support >= 2.7, so this check would always be true.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Miguel Angel Ajo <majopela@redhat.com>
2016-04-15 16:52:50 -04:00
Russell Bryant
64eb96a9af tests: Deal with Python output differences.
This test checks the output based on Python's string representation of
an array of two unicode strings.  These strings have a "u" prefix in
Python 2, but not Python 3.  In Python 3, all strings are unicode.

Use sed on the output to strip the "u" from Python 2 output when
checking for the expected result.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
2016-02-22 15:17:23 -05:00
Russell Bryant
25f599fbd3 python: Drop unicode type.
Python 2 had str and unicode.  Python 3 only has str, which is always a
unicode string.  Drop use of unicode with the help of six.text_type
(unicode in py2 and str in py3) and six.string_types ([str, unicode] in
py2 and [str] in py3).

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
2016-02-02 16:40:49 -05:00
Russell Bryant
8ea171aba0 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@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
2016-01-12 11:47:33 -05:00
Russell Bryant
f3068bff92 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@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
2016-01-12 11:47:33 -05:00
Raju Subramanian
e0edde6fee Global replace of Nicira Networks.
Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc.

Feature #10593
Signed-off-by: Raju Subramanian <rsubramanian@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-02 17:08:02 -07:00
Ethan Jackson
26bb0f3129 python: Style cleanup.
This patch does minor style cleanups to the code in the python and
tests directory.  There's other code floating around that could use
similar treatment, but updating it is not convenient at the moment.
2011-09-24 16:32:54 -07:00
Ben Pfaff
991559357f Implement initial Python bindings for Open vSwitch database.
These initial bindings pass a few hundred of the corresponding tests
for C implementations of various bits of the Open vSwitch library API.
The poorest part of them is actually the Python IDL interface in
ovs.db.idl, which has not received enough attention yet.  It appears
to work, but it doesn't yet support writes (transactions) and it is
difficult to use.  I hope to improve it as it becomes clear what
semantics Python applications actually want from an IDL.
2010-08-25 14:55:48 -07:00