2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-28 12:58:00 +00:00

20 Commits

Author SHA1 Message Date
Ben Pfaff
1ca0323e7c Require Python 3 and remove support for Python 2.
Python 2 reaches end-of-life on January 1, 2020, which is only
a few months away.  This means that OVS needs to stop depending
on in the next release that should occur roughly that same time.
Therefore, this commit removes all support for Python 2.  It
also makes Python 3 a mandatory build dependency.

Some of the interesting consequences:

- HAVE_PYTHON, HAVE_PYTHON2, and HAVE_PYTHON3 conditionals have
  been removed, since we now know that Python3 is available.

- $PYTHON and $PYTHON2 are removed, and $PYTHON3 is always
  available.

- Many tests for Python 2 support have been removed, and the ones
  that depended on Python 3 now run unconditionally.  This allowed
  several macros in the testsuite to be removed, making the code
  clearer.  This does make some of the changes to the testsuite
  files large due to indentation level changes.

- #! lines for Python now use /usr/bin/python3 instead of
  /usr/bin/python.

- Packaging depends on Python 3 packages.

Acked-by: Numan Siddique <nusiddiq@redhat.com>
Tested-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-09-27 09:23:50 -07:00
Ben Pfaff
9a403b0760 tests: Always use --no-chdir with --detach.
With --detach but not --no-chdir, core files and Address Sanitizer logs
don't go into the testsuite directory but end up dropped because it tries
to write them in the root directory.

Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-11-19 08:47:53 -08:00
Timothy Redaelli
9ec533122f Permit to build OVS with only Python3 installed
This commit renames HAVE_PYTHON to HAVE_PYTHON2 and PYTHON to PYTHON2
and adds HAVE_PYTHON and PYTHON with a different semantics:
- If PYTHON environment variable is set, use it as PYTHON
- If a python2 interpreter is available, PYTHON became the python2 interpreter
- If a python3 interpreter is available, PYTHON became the python3 interpreter

PYTHON is only used to run the python scripts needed by the build system

NOTE:
Since currently most of the utilities and bugtool doesn't support Python3,
they're installed only if python2 is available. This will be fixed in later
commits.

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-07-24 16:02:48 -07:00
Paul Boca
07170206b4 python tests: Fixed unixctl python tests for Windows
For bogus pid file path, use a windows-like file path.

Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
2016-08-03 08:40:16 -07:00
Russell Bryant
0f9bd013cc unixctl-py.at: Run tests for Python 2 and 3.
Update these Python tests to run with both Python 2 and 3.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
2016-02-22 15:17:57 -05: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
Ben Pfaff
063801288e vlog: Add vlog/close command.
Requested-by: P R Dinesh
Requested-at: https://github.com/openvswitch/ovs/pull/94
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
2016-02-10 13:36:04 -08:00
Ben Pfaff
53eb8cb830 tests: Replace ON_EXIT m4 macro by on_exit() shell function.
A shell function doesn't need quoted and unquoted variants and it
integrates naturally with other shell code.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
2015-09-09 10:28:20 -07:00
Ben Pfaff
6132b241ef tests: Automatically initialize OVS_*DIR vars when tests begin.
A lot of tests need to initialize the OVS_RUNDIR, OVS_LOGDIR, etc.
variables to point to the directory in which the tests run.  Until now,
each of them has had to do this individually, which is redundant.  This
commit starts to do this automatically.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
2015-09-09 10:24:24 -07:00
Alex Wang
91a11f5b19 ovs-appctl: Rename 'help' to 'list-commands'.
Having 'ovs-appctl help' and 'ovs-appctl --help' print different
output is confusing.  This commit renames the 'help' to 'list-commands'.
Also, future patches will add the 'list-commands' to other ovs-*
commands, and the output will be used by bash command-line completion
script.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2014-10-28 18:35:23 -07:00
Ben Pfaff
0b7140bbc5 tests: New m4 macro ON_EXIT to add a cleanup action.
Several of the tests start daemons and then need to make sure that the
daemons get killed when the test completes, even if it completes in the
middle due to an early failure.  Until now, they have been using manual
shell "trap" calls to do this.  This works well enough for simple cases,
but sometimes multiple macros start daemons in a single test, and then
each "trap" has to be carefully written to kill off the daemons for the
previously invoked macros.

This commit introduces a new macro ON_EXIT whose use is composable: each
call appends a new action to the ones already specified.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-08-20 12:28:05 -07:00
Ben Pfaff
f973f2af2f Make the location of the database separately configurable.
The default is unchanged, /etc/openvswitch/conf.db.

This makes it possible to transition each Open vSwitch packaging from
/etc/openvswitch/conf.db to /var/lib/openvswitch/conf.db independently.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-08-01 10:55:57 -07:00
Ben Pfaff
f26ddb5b5f python: Implement "vlog/set", "vlog/list" unixctl commands in Python vlog.
This doesn't implement control over log patterns, though.

The change to vlog.man in this commit doesn't have any practical effect
because OVS doesn't come with any Python daemons that have their own
manpages.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-22 10:17:06 -07:00
Ben Pfaff
8ba37945d6 python: Implement "vlog/reopen" unixctl command in Python vlog.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-22 10:17:05 -07:00
Ben Pfaff
37d034580a Use pwd in place of $PWD, treewide.
The Autoconf manual says:

     Posix 1003.1-2001 requires that `cd' and `pwd' must update the
     `PWD' environment variable to point to the logical name of the
     current directory, but traditional shells do not support this.
     This can cause confusion if one shell instance maintains `PWD' but
     a subsidiary and different shell does not know about `PWD' and
     executes `cd'; in this case `PWD' points to the wrong directory.
     Use ``pwd`' rather than `$PWD'.

so this commit replaces all uses of $PWD by `pwd`.

Reported-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-03-13 09:34:55 -07:00
Ethan Jackson
c9a2d670eb python: Make build number format consistent with C.
The C code displays the build number as the empty string when 0,
and as +build<num> otherwise.  This commit updates version.py to be
consistent and tests that it is in the unit tests.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-03-07 16:50:16 -08:00
Ethan Jackson
f4ec6ff479 unixctl: Timeout unit tests instead of hanging.
We've seen some unixctl tests hang indefinitely which makes them
difficult to debug.  ovs-appctl and appctl.py calls to timeout
instead.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-03-07 12:50:15 -08:00
Ethan Jackson
87cf07675b unixctl: Re-enable unit tests.
The transient failure in the unixctl unit tests likely still
exists, but we've added additional instrumentation to our build
tools to help us debug it.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-03-06 17:35:51 -08:00
Ethan Jackson
cc81cc4513 unixctl: Skip Python unixctl tests.
The Python unixctl tests introduced a transient build failure that
can't be debugged until more information is collected.  Skipping
these tests for now until it's possible to debug them.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-03-02 19:05:29 -08:00
Ethan Jackson
0a68ffd234 python: Port unixctl to Python.
Many of the currently implemented Python daemons, and likely many
daemons to be implemented in the future, could benefit from unixctl
support even if only to implement "exit" and "version" commands.
This patch implements unixctl in Python.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-03-02 13:30:32 -08:00