[ovs-dev] [PATCH v3] Require Python 3 and remove support for Python 2.

Numan Siddique nusiddiq at redhat.com
Wed Sep 25 19:48:41 UTC 2019


On Thu, Sep 26, 2019, 12:12 AM Ben Pfaff <blp at ovn.org> wrote:

> Numan, please (re-)review this when you have time.
>

Sure. I will do it tomorrow

Thanks
Numan


> On Fri, Sep 20, 2019 at 08:44:48AM -0700, Ben Pfaff wrote:
> > 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.
> > ---
> > v1->v2: Bug fixes.
> > v2->v3: Update RPM spec file for Fedora packaging to delete the
> >   Python 2 packaging and to move ovstest into the Python 3
> >   packaging.  This is going to break compatibility with older
> >   Fedora and RHEL releases that don't have Python 3.  I do not
> >   know whether this is important, and I don't know how to really
> >   avoid it if it is.  Comments requested.
> >
> >  .cirrus.yml                                   |   3 +-
> >  .travis/osx-prepare.sh                        |   4 +-
> >  Documentation/intro/install/fedora.rst        |   4 +-
> >  Documentation/intro/install/general.rst       |   8 +-
> >  Documentation/intro/install/netbsd.rst        |  10 +-
> >  Documentation/intro/install/rhel.rst          |   2 +-
> >  Documentation/intro/install/windows.rst       |   4 +-
> >  Documentation/intro/install/xenserver.rst     |   4 +-
> >  Makefile.am                                   |  12 +-
> >  Vagrantfile                                   |  24 +-
> >  Vagrantfile-FreeBSD                           |   2 +-
> >  appveyor.yml                                  |   2 +-
> >  build-aux/check-structs                       |   2 +-
> >  build-aux/extract-ofp-actions                 |   2 +-
> >  build-aux/extract-ofp-errors                  |   2 +-
> >  build-aux/extract-ofp-fields                  |   2 +-
> >  build-aux/extract-ofp-msgs                    |   2 +-
> >  build-aux/sodepends.py                        |   2 +-
> >  build-aux/soexpand.py                         |   2 +-
> >  build-aux/text2c                              |   2 +-
> >  build-aux/xml2nroff                           |   2 +-
> >  configure.ac                                  |   3 +-
> >  debian/.gitignore                             |   1 +
> >  debian/automake.mk                            |   4 +-
> >  debian/control                                |  35 +-
> >  debian/openvswitch-test.install               |   2 +-
> >  debian/python-openvswitch.install             |   1 -
> >  ...nvswitch.dirs => python3-openvswitch.dirs} |   0
> >  debian/python3-openvswitch.install            |   1 +
> >  debian/rules                                  |   2 +-
> >  include/openflow/automake.mk                  |   2 -
> >  ipsec/ovs-monitor-ipsec.in                    |   2 +-
> >  m4/openvswitch.m4                             | 101 +---
> >  manpages.mk                                   |   6 -
> >  ovn/automake.mk                               |   8 +-
> >  ovsdb/ovsdb-dot.in                            |   2 +-
> >  ovsdb/ovsdb-idlc.in                           |   2 +-
> >  python/automake.mk                            |   9 +-
> >  rhel/openvswitch-fedora.spec.in               |  45 +-
> >  tests/atlocal.in                              |  42 +-
> >  tests/automake.mk                             |   2 +-
> >  tests/check-structs.at                        |   3 +-
> >  tests/checkpatch.at                           |  17 +-
> >  tests/daemon-py.at                            | 453 ++++++++----------
> >  tests/flowgen.py                              |   2 +-
> >  tests/interface-reconfigure.at                |   2 +-
> >  tests/json.at                                 |  57 +--
> >  tests/jsonrpc-py.at                           |  67 +--
> >  tests/library.at                              |  42 +-
> >  tests/ofproto-dpif.at                         |  10 +-
> >  tests/ofproto.at                              |   4 +-
> >  tests/ovs-macros.at                           |   2 +-
> >  tests/ovs-xapi-sync.at                        |   3 +-
> >  tests/ovsdb-data.at                           |   9 +-
> >  tests/ovsdb-idl.at                            | 188 ++------
> >  tests/ovsdb-macros.at                         |  52 +-
> >  tests/ovsdb-monitor.at                        |  20 +-
> >  tests/reconnect.at                            |  13 +-
> >  tests/system-common-macros.at                 |   2 +-
> >  tests/system-kmod-macros.at                   |   3 +-
> >  tests/system-traffic.at                       |  16 +-
> >  tests/system-userspace-macros.at              |   4 +-
> >  tests/unixctl-py.at                           | 208 ++++----
> >  tests/vlog.at                                 | 219 ++++-----
> >  utilities/automake.mk                         |   5 +-
> >  utilities/bugtool/automake.mk                 |   2 -
> >  utilities/bugtool/ovs-bugtool.in              |   2 +-
> >  utilities/checkpatch.py                       |   2 +-
> >  utilities/ovs-check-dead-ifs.in               |   2 +-
> >  utilities/ovs-dpctl-top.in                    |   2 +-
> >  utilities/ovs-l3ping.in                       |   2 +-
> >  utilities/ovs-parse-backtrace.in              |   2 +-
> >  utilities/ovs-pcap.in                         |   2 +-
> >  utilities/ovs-tcpdump.in                      |   2 +-
> >  utilities/ovs-tcpundump.in                    |   2 +-
> >  utilities/ovs-test.in                         |   2 +-
> >  utilities/ovs-vlan-test.in                    |   2 +-
> >  vswitchd/automake.mk                          |   4 +-
> >  vtep/automake.mk                              |   4 +-
> >  vtep/ovs-vtep.in                              |   2 +-
> >  80 files changed, 651 insertions(+), 1151 deletions(-)
> >  delete mode 100644 debian/python-openvswitch.install
> >  rename debian/{python-openvswitch.dirs => python3-openvswitch.dirs}
> (100%)
> >  create mode 100644 debian/python3-openvswitch.install
> >
> > diff --git a/.cirrus.yml b/.cirrus.yml
> > index eb6af0a719c8..bae5a089b248 100644
> > --- a/.cirrus.yml
> > +++ b/.cirrus.yml
> > @@ -9,8 +9,7 @@ freebsd_build_task:
> >
> >    env:
> >      DEPENDENCIES: automake libtool gmake gcc wget openssl
> > -                  python py27-six py27-sphinx py27-openssl
> > -                  python3 py36-six py36-openssl
> > +                  python3 py36-six py36-openssl p36-sphinx
> >      matrix:
> >        COMPILER: gcc
> >        COMPILER: clang
> > diff --git a/.travis/osx-prepare.sh b/.travis/osx-prepare.sh
> > index 58ccb67cddbd..78d5bb579217 100755
> > --- a/.travis/osx-prepare.sh
> > +++ b/.travis/osx-prepare.sh
> > @@ -1,4 +1,4 @@
> >  #!/bin/bash
> >  set -ev
> > -pip2 install --user six
> > -pip2 install --user --upgrade docutils
> > +pip3 install --user six
> > +pip3 install --user --upgrade docutils
> > diff --git a/Documentation/intro/install/fedora.rst
> b/Documentation/intro/install/fedora.rst
> > index f11d05a01041..6fe1fb5b2468 100644
> > --- a/Documentation/intro/install/fedora.rst
> > +++ b/Documentation/intro/install/fedora.rst
> > @@ -102,7 +102,7 @@ in which `./configure` was executed:
> >
> >      $ make rpm-fedora
> >
> > -This will create the RPMs `openvswitch`, `python-openvswitch`,
> > +This will create the RPMs `openvswitch`, `python3-openvswitch`,
> >  `openvswitch-test`, `openvswitch-devel` and `openvswitch-debuginfo`.
> >
> >  To enable DPDK support in the openvswitch package, the ``--with dpdk``
> option
> > @@ -151,7 +151,7 @@ Refer to the :doc:`/faq/index` for more information
> about the various Open
> >  vSwitch datapath options.
> >
> >  In most cases only the `openvswitch` RPM will need to be installed. The
> > -`python-openvswitch`, `openvswitch-test`, `openvswitch-devel`, and
> > +`python3-openvswitch`, `openvswitch-test`, `openvswitch-devel`, and
> >  `openvswitch-debuginfo` RPMs are optional unless required for a specific
> >  purpose.
> >
> > diff --git a/Documentation/intro/install/general.rst
> b/Documentation/intro/install/general.rst
> > index b03d70f6fa6e..e62501be7fc1 100644
> > --- a/Documentation/intro/install/general.rst
> > +++ b/Documentation/intro/install/general.rst
> > @@ -90,8 +90,8 @@ need the following software:
> >    If libcap-ng is installed, then Open vSwitch will automatically build
> with
> >    support for it.
> >
> > -- Python 2.7. You must also have the Python ``six`` library version
> 1.4.0
> > -  or later.
> > +- Python 3.4 or later. You must also have the Python ``six`` library
> > +  version 1.4.0 or later.
> >
> >  - Unbound library, from http://www.unbound.net, is optional but
> recommended if
> >    you want to enable ovs-vswitchd and other utilities to use DNS names
> when
> > @@ -203,8 +203,8 @@ simply install and run Open vSwitch you require the
> following software:
> >    from iproute2 (part of all major distributions and available at
> >    https://wiki.linuxfoundation.org/networking/iproute2).
> >
> > -- Python 2.7. You must also have the Python six library version 1.4.0
> > -  or later.
> > +- Python 3.4 or later. You must also have the Python six library
> > +  version 1.4.0 or later.
> >
> >  On Linux you should ensure that ``/dev/urandom`` exists. To support TAP
> >  devices, you must also ensure that ``/dev/net/tun`` exists.
> > diff --git a/Documentation/intro/install/netbsd.rst
> b/Documentation/intro/install/netbsd.rst
> > index 7eb7f0cebbaf..4f60dad869b6 100644
> > --- a/Documentation/intro/install/netbsd.rst
> > +++ b/Documentation/intro/install/netbsd.rst
> > @@ -31,20 +31,18 @@ you need at least the following packages.
> >  - automake
> >  - libtool-base
> >  - gmake
> > -- python27
> > -- py27-six
> > -- py27-xml
> > +- python37
> > +- py37-six
> >
> >  Some components have additional requirements. Refer to :doc:`general`
> for more
> >  information.
> >
> > -Assuming you are running NetBSD/amd64 6.1.2, you can download and
> install
> > +Assuming you are running NetBSD/amd64 7.0.2, you can download and
> install
> >  pre-built binary packages as the following::
> >
> >      $ PKG_PATH=
> http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/7.0.2/All/
> >      $ export PKG_PATH
> > -    $ pkg_add automake libtool-base gmake python27 py27-six py27-xml \
> > -        pkg_alternatives
> > +    $ pkg_add automake libtool-base gmake python37 py37-six
> pkg_alternatives
> >
> >  .. note::
> >    You might get some warnings about minor version mismatch. These can
> be safely
> > diff --git a/Documentation/intro/install/rhel.rst
> b/Documentation/intro/install/rhel.rst
> > index 0e5ca2743ef5..17b3bc26f11d 100644
> > --- a/Documentation/intro/install/rhel.rst
> > +++ b/Documentation/intro/install/rhel.rst
> > @@ -92,7 +92,7 @@ Once that is completed, remove the file
> ``/tmp/ovs.spec``.
> >  If python3-sphinx package is not available in your version of RHEL, you
> can
> >  install it via pip with 'pip install sphinx'.
> >
> > -Open vSwitch requires python 2.7 or newer which is not available in
> older
> > +Open vSwitch requires python 3.4 or newer which is not available in
> older
> >  distributions. In the case of RHEL 6.x and its derivatives, one option
> is
> >  to install python34 and python34-six from `EPEL`_.
> >
> > diff --git a/Documentation/intro/install/windows.rst
> b/Documentation/intro/install/windows.rst
> > index f696d2c9b621..019e83e64425 100644
> > --- a/Documentation/intro/install/windows.rst
> > +++ b/Documentation/intro/install/windows.rst
> > @@ -56,9 +56,9 @@ The following explains the steps in some detail.
> >
> >        'C:/MinGW /mingw'.
> >
> > -- Python
> > +- Python 3.4 or later.
> >
> > -  Install the latest Python 2.x from python.org and verify that its
> path is
> > +  Install the latest Python 3.x from python.org and verify that its
> path is
> >    part of Windows' PATH environment variable.
> >    We require that you have Python six and pypiwin32 libraries installed.
> >    The libraries can be installed via pip command:
> > diff --git a/Documentation/intro/install/xenserver.rst
> b/Documentation/intro/install/xenserver.rst
> > index c0f5e3156697..366e11ac27ad 100644
> > --- a/Documentation/intro/install/xenserver.rst
> > +++ b/Documentation/intro/install/xenserver.rst
> > @@ -30,8 +30,8 @@ XenServer host.  If you want to install Open vSwitch
> on a generic Linux or BSD
> >  host, refer to :doc:`general` instead.
> >
> >  Open vSwitch should work with XenServer 5.6.100 and later.  However,
> Open
> > -vSwitch requires Python 2.7 or later, so using Open vSwitch with
> XenServer 6.5
> > -or earlier requires installing Python 2.7.
> > +vSwitch requires Python 3.4 or later, so using Open vSwitch with
> XenServer 6.5
> > +or earlier requires installing Python 3.x.
> >
> >  Building
> >  --------
> > diff --git a/Makefile.am b/Makefile.am
> > index ff1f94b4841f..6030cdb495d6 100644
> > --- a/Makefile.am
> > +++ b/Makefile.am
> > @@ -60,7 +60,7 @@ endif
> >  # foo/__init__.pyc will cause Python to ignore foo.py.
> >  run_python = \
> >       PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
> > -     PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
> > +     PYTHONDONTWRITEBYTECODE=yes $(PYTHON3)
> >
> >  ALL_LOCAL =
> >  BUILT_SOURCES =
> > @@ -147,13 +147,13 @@ ro_shell = printf '\043 Generated automatically --
> do not modify!    -*- buffer-
> >
> >  SUFFIXES += .in
> >  .in:
> > -     $(AM_V_GEN)PYTHONPATH=$$PYTHONPATH$(psep)$(srcdir)/python
> $(PYTHON) $(srcdir)/build-aux/soexpand.py -I$(srcdir) < $< | \
> > -       $(PYTHON) $(srcdir)/build-aux/dpdkstrip.py $(DPDKSTRIP_FLAGS) | \
> > +     $(AM_V_GEN)PYTHONPATH=$$PYTHONPATH$(psep)$(srcdir)/python
> $(PYTHON3) $(srcdir)/build-aux/soexpand.py -I$(srcdir) < $< | \
> > +       $(PYTHON3) $(srcdir)/build-aux/dpdkstrip.py $(DPDKSTRIP_FLAGS) |
> \
> >         sed \
> >           -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
> >           -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
> >           -e 's,[@]DBDIR[@],$(DBDIR),g' \
> > -         -e 's,[@]PYTHON[@],$(PYTHON),g' \
> > +         -e 's,[@]PYTHON3[@],$(PYTHON3),g' \
> >           -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
> >           -e 's,[@]VERSION[@],$(VERSION),g' \
> >           -e 's,[@]localstatedir[@],$(localstatedir),g' \
> > @@ -177,7 +177,7 @@ SUFFIXES += .xml
> >         PKIDIR='$(PKIDIR)' \
> >         LOGDIR='$(LOGDIR)' \
> >         DBDIR='$(DBDIR)' \
> > -       PYTHON='$(PYTHON)' \
> > +       PYTHON3='$(PYTHON3)' \
> >         RUNDIR='$(RUNDIR)' \
> >         VERSION='$(VERSION)' \
> >         localstatedir='$(localstatedir)' \
> > @@ -414,7 +414,7 @@ CLEANFILES += flake8-check
> >
> >  include $(srcdir)/manpages.mk
> >  $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.py
> python/build/soutil.py
> > -     @PYTHONPATH=$$PYTHONPATH$(psep)$(srcdir)/python $(PYTHON)
> $(srcdir)/build-aux/sodepends.py -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
> > +     @PYTHONPATH=$$PYTHONPATH$(psep)$(srcdir)/python $(PYTHON3)
> $(srcdir)/build-aux/sodepends.py -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
> >       @if cmp -s $(@F).tmp $@; then \
> >         touch $@; \
> >         rm -f $(@F).tmp; \
> > diff --git a/Vagrantfile b/Vagrantfile
> > index fbd772a1bec5..236e3a7bdcb7 100644
> > --- a/Vagrantfile
> > +++ b/Vagrantfile
> > @@ -8,12 +8,14 @@ Vagrant.require_version ">=1.7.0"
> >  $bootstrap_fedora = <<SCRIPT
> >  dnf -y update
> >  dnf -y install autoconf automake openssl-devel libtool \
> > -               python-devel python3-devel \
> > -               python-twisted python-zope-interface \
> > +               python3-devel \
> > +               python3-twisted python3-zope-interface \
> >                 desktop-file-utils groff graphviz rpmdevtools nc curl \
> > -               wget python-six pyftpdlib checkpolicy
> selinux-policy-devel \
> > -               libcap-ng-devel kernel-devel-`uname -r` ethtool
> python-tftpy \
> > +               wget python3-six python3-pyftpdlib checkpolicy \
> > +               selinux-policy-devel \
> > +               libcap-ng-devel kernel-devel-`uname -r` ethtool
> python3-pip \
> >                 lftp
> > +pip-3 install tftpy             # Not yet available for Python3 via dnf.
> >  echo "search extra update built-in" >/etc/depmod.d/search_path.conf
> >  SCRIPT
> >
> > @@ -24,21 +26,23 @@ aptitude -y install -R \
> >                  build-essential dpkg-dev lintian devscripts fakeroot \
> >                  debhelper dh-autoreconf uuid-runtime \
> >                  autoconf automake libtool \
> > -                python-all python-twisted-core python-twisted-conch \
> > +                python3-all python3-twisted-core python3-twisted-conch \
> >                  xdg-utils groff graphviz netcat curl \
> > -                wget python-six ethtool \
> > -                libcap-ng-dev libssl-dev python-dev openssl \
> > -                python-pyftpdlib python-flake8 python-tftpy \
> > +                wget python3-six ethtool \
> > +                libcap-ng-dev libssl-dev python3-dev openssl \
> > +                python3-pyftpdlib python3-flake8 \
> >                  linux-headers-`uname -r` \
> >                  lftp
> > +pip-3 install tftpy             # Not yet available for Python3 via apt.
> >  SCRIPT
> >
> >  $bootstrap_centos = <<SCRIPT
> >  yum -y update
> >  yum -y install autoconf automake openssl-devel libtool \
> > -               python-twisted-core python-zope-interface \
> > +               python3-twisted-core python3-zope-interface \
> >                 desktop-file-utils groff graphviz rpmdevtools nc curl \
> > -               wget python-six pyftpdlib checkpolicy
> selinux-policy-devel \
> > +               wget python3-six python3-pyftpdlib checkpolicy \
> > +               selinux-policy-devel \
> >                 libcap-ng-devel kernel-devel-`uname -r` ethtool
> net-tools \
> >                 lftp
> >  SCRIPT
> > diff --git a/Vagrantfile-FreeBSD b/Vagrantfile-FreeBSD
> > index 52599eefaebe..d978faa1c2fe 100644
> > --- a/Vagrantfile-FreeBSD
> > +++ b/Vagrantfile-FreeBSD
> > @@ -12,7 +12,7 @@ Vagrant.require_version ">=1.7.0"
> >  $bootstrap_freebsd = <<SCRIPT
> >  sed  -e 's/\#DEFAULT_ALWAYS_YES = false/DEFAULT_ALWAYS_YES = true/g' -e
> 's/\#ASSUME_ALWAYS_YES = false/ASSUME_ALWAYS_YES = true/g'
> /usr/local/etc/pkg.conf > /tmp/pkg.conf
> >  mv -f /tmp/pkg.conf /usr/local/etc/pkg.conf
> > -pkg install automake libtool wget python py27-six gmake lftp
> > +pkg install automake libtool wget py37 py37-six gmake lftp
> >  SCRIPT
> >
> >  $configure_ovs = <<SCRIPT
> > diff --git a/appveyor.yml b/appveyor.yml
> > index 2e5c37a37adc..b301227445d0 100644
> > --- a/appveyor.yml
> > +++ b/appveyor.yml
> > @@ -33,7 +33,7 @@ init:
> >
> >      cd C:\openvswitch
> >
> > -    python -m pip install six pypiwin32 --disable-pip-version-check
> > +    python3 -m pip install six pypiwin32 --disable-pip-version-check
> >
> >  build_script:
> >  - '"C:\Program Files (x86)\Microsoft Visual Studio
> 12.0\Common7\Tools\VsDevCmd"'
> > diff --git a/build-aux/check-structs b/build-aux/check-structs
> > index 37ffa06b3ab3..2c088b446943 100755
> > --- a/build-aux/check-structs
> > +++ b/build-aux/check-structs
> > @@ -1,4 +1,4 @@
> > -#! /usr/bin/python
> > +#! /usr/bin/python3
> >
> >  import os.path
> >  import sys
> > diff --git a/build-aux/extract-ofp-actions
> b/build-aux/extract-ofp-actions
> > index 64de0f31f4a0..2d1dbe70973f 100755
> > --- a/build-aux/extract-ofp-actions
> > +++ b/build-aux/extract-ofp-actions
> > @@ -1,4 +1,4 @@
> > -#! /usr/bin/python
> > +#! /usr/bin/python3
> >
> >  import getopt
> >  import sys
> > diff --git a/build-aux/extract-ofp-errors b/build-aux/extract-ofp-errors
> > index 03f40ea3e4c2..2c3fbfc881b1 100755
> > --- a/build-aux/extract-ofp-errors
> > +++ b/build-aux/extract-ofp-errors
> > @@ -1,4 +1,4 @@
> > -#! /usr/bin/python
> > +#! /usr/bin/python3
> >
> >  import sys
> >  import os.path
> > diff --git a/build-aux/extract-ofp-fields b/build-aux/extract-ofp-fields
> > index 7a4e8e170171..8766995d9ab1 100755
> > --- a/build-aux/extract-ofp-fields
> > +++ b/build-aux/extract-ofp-fields
> > @@ -1,4 +1,4 @@
> > -#! /usr/bin/python
> > +#! /usr/bin/python3
> >
> >  import getopt
> >  import sys
> > diff --git a/build-aux/extract-ofp-msgs b/build-aux/extract-ofp-msgs
> > index 3d50724aebd3..6b3295cf64c2 100755
> > --- a/build-aux/extract-ofp-msgs
> > +++ b/build-aux/extract-ofp-msgs
> > @@ -1,4 +1,4 @@
> > -#! /usr/bin/python
> > +#! /usr/bin/python3
> >
> >  import sys
> >  import os.path
> > diff --git a/build-aux/sodepends.py b/build-aux/sodepends.py
> > index 90cfaa0f7fb4..45812bcbd700 100755
> > --- a/build-aux/sodepends.py
> > +++ b/build-aux/sodepends.py
> > @@ -1,4 +1,4 @@
> > -#! /usr/bin/env python
> > +#! /usr/bin/env python3
> >
> >  # Copyright (c) 2008, 2011, 2017 Nicira, Inc.
> >  #
> > diff --git a/build-aux/soexpand.py b/build-aux/soexpand.py
> > index 53ca640739fe..00adcf47a356 100755
> > --- a/build-aux/soexpand.py
> > +++ b/build-aux/soexpand.py
> > @@ -1,4 +1,4 @@
> > -#! /usr/bin/env python
> > +#! /usr/bin/env python3
> >
> >  # Copyright (c) 2008, 2017 Nicira, Inc.
> >  #
> > diff --git a/build-aux/text2c b/build-aux/text2c
> > index cb1f256f1775..dca58648b90c 100755
> > --- a/build-aux/text2c
> > +++ b/build-aux/text2c
> > @@ -1,4 +1,4 @@
> > -#! /usr/bin/python
> > +#! /usr/bin/python3
> >
> >  import re
> >  import sys
> > diff --git a/build-aux/xml2nroff b/build-aux/xml2nroff
> > index bd4e87928e4f..ee5553f4564e 100755
> > --- a/build-aux/xml2nroff
> > +++ b/build-aux/xml2nroff
> > @@ -1,4 +1,4 @@
> > -#! /usr/bin/python
> > +#! /usr/bin/python3
> >
> >  # Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
> >  #
> > diff --git a/configure.ac b/configure.ac
> > index 1d45c4fdd153..afd1e83450eb 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -92,9 +92,8 @@ OVS_CHECK_NETLINK
> >  OVS_CHECK_OPENSSL
> >  OVS_CHECK_LIBCAPNG
> >  OVS_CHECK_LOGDIR
> > -OVS_CHECK_PYTHON2
> >  OVS_CHECK_PYTHON3
> > -OVS_CHECK_PYTHON
> > +OVS_CHECK_SIX
> >  OVS_CHECK_FLAKE8
> >  OVS_CHECK_SPHINX
> >  OVS_CHECK_DOT
> > diff --git a/debian/.gitignore b/debian/.gitignore
> > index 441a8ffb702d..d02526b21fa7 100644
> > --- a/debian/.gitignore
> > +++ b/debian/.gitignore
> > @@ -23,4 +23,5 @@
> >  /openvswitch-testcontroller
> >  /openvswitch-vtep
> >  /python-openvswitch
> > +/python3-openvswitch
> >  /tmp
> > diff --git a/debian/automake.mk b/debian/automake.mk
> > index 03a1d68c2635..37b1a243390c 100644
> > --- a/debian/automake.mk
> > +++ b/debian/automake.mk
> > @@ -52,8 +52,8 @@ EXTRA_DIST += \
> >       debian/openvswitch-vtep.init \
> >       debian/openvswitch-vtep.install \
> >       debian/openvswitch-vtep.manpages \
> > -     debian/python-openvswitch.dirs \
> > -     debian/python-openvswitch.install \
> > +     debian/python3-openvswitch.dirs \
> > +     debian/python3-openvswitch.install \
> >       debian/rules \
> >       debian/rules.modules \
> >       debian/ifupdown.sh \
> > diff --git a/debian/control b/debian/control
> > index 2ad35f2cea6f..ad4b187860f3 100644
> > --- a/debian/control
> > +++ b/debian/control
> > @@ -13,10 +13,10 @@ Build-Depends: graphviz,
> >                 libtool,
> >                 openssl,
> >                 procps,
> > -               python-all (>= 2.7),
> > -               python-twisted-conch,
> > -               python-zopeinterface,
> > -               python-six,
> > +               python3-all,
> > +               python3-twisted-conch,
> > +               python3-zopeinterface,
> > +               python3-six,
> >                 libunbound-dev
> >  Standards-Version: 3.9.3
> >  Homepage: http://openvswitch.org/
> > @@ -41,7 +41,7 @@ Description: Open vSwitch datapath module source -
> module-assistant version
> >
> >  Package: openvswitch-datapath-dkms
> >  Architecture: all
> > -Depends: dkms (>= 1.95), libc6-dev, libelf-dev, make, ${misc:Depends},
> ${python:Depends}
> > +Depends: dkms (>= 1.95), libc6-dev, libelf-dev, make, ${misc:Depends},
> ${python3:Depends}
> >  Description: Open vSwitch datapath module source - DKMS version
> >   Open vSwitch is a production quality, multilayer, software-based,
> >   Ethernet virtual switch. It is designed to enable massive network
> > @@ -58,8 +58,8 @@ Description: Open vSwitch datapath module source -
> DKMS version
> >  Package: openvswitch-common
> >  Architecture: linux-any
> >  Multi-Arch: foreign
> > -Depends: python (>= 2.7),
> > -         python-six,
> > +Depends: python3,
> > +         python3-six,
> >           libopenvswitch (= ${binary:Version}),
> >           ${misc:Depends},
> >           ${shlibs:Depends}
> > @@ -102,10 +102,9 @@ Depends: kmod | module-init-tools,
> >           netbase,
> >           openvswitch-common (= ${binary:Version}),
> >           procps,
> > -         python-argparse,
> >           uuid-runtime,
> >           ${misc:Depends},
> > -         ${python:Depends},
> > +         ${python3:Depends},
> >           ${shlibs:Depends}
> >  Description: Open vSwitch switch implementations
> >   Open vSwitch is a production quality, multilayer, software-based,
> > @@ -171,10 +170,10 @@ Description: Debug symbols for Open vSwitch
> packages
> >   packages.  Install it to debug one of them or to examine a core dump
> >   produced by one of them.
> >
> > -Package: python-openvswitch
> > +Package: python3-openvswitch
> >  Architecture: all
> >  Section: python
> > -Depends: ${misc:Depends}, ${python:Depends}, python-six
> > +Depends: ${misc:Depends}, ${python3:Depends}, python3-six
> >  Description: Python bindings for Open vSwitch
> >   Open vSwitch is a production quality, multilayer, software-based,
> >   Ethernet virtual switch. It is designed to enable massive network
> > @@ -188,10 +187,10 @@ Description: Python bindings for Open vSwitch
> >
> >  Package: openvswitch-test
> >  Architecture: all
> > -Depends: python (>= 2.7) | python-argparse,
> > -         python-twisted-web,
> > +Depends: python3,
> > +         python3-twisted-web,
> >           ${misc:Depends},
> > -         ${python:Depends}
> > +         ${python3:Depends}
> >  Description: Open vSwitch test package
> >   Open vSwitch is a production quality, multilayer, software-based,
> >   Ethernet virtual switch. It is designed to enable massive network
> > @@ -208,8 +207,8 @@ Package: openvswitch-vtep
> >  Architecture: linux-any
> >  Depends: openvswitch-common (>= ${binary:Version}),
> >           openvswitch-switch (>= ${binary:Version}),
> > -         python,
> > -         python-openvswitch (>= ${source:Version}),
> > +         python3,
> > +         python3-openvswitch (>= ${source:Version}),
> >           ${misc:Depends},
> >           ${shlibs:Depends}
> >  Description: Open vSwitch VTEP utilities
> > @@ -250,8 +249,8 @@ Architecture: linux-any
> >  Depends: iproute2,
> >           openvswitch-common (= ${binary:Version}),
> >           openvswitch-switch (= ${binary:Version}),
> > -         python,
> > -         python-openvswitch (= ${source:Version}),
> > +         python3,
> > +         python3-openvswitch (= ${source:Version}),
> >           strongswan,
> >           ${misc:Depends},
> >           ${shlibs:Depends}
> > diff --git a/debian/openvswitch-test.install
> b/debian/openvswitch-test.install
> > index 8a01a51259b7..cb371c906d94 100644
> > --- a/debian/openvswitch-test.install
> > +++ b/debian/openvswitch-test.install
> > @@ -1,3 +1,3 @@
> >  usr/bin/ovs-l3ping
> >  usr/bin/ovs-test
> > -usr/share/openvswitch/python/ovstest usr/lib/python2.7/dist-packages/
> > +usr/share/openvswitch/python/ovstest usr/lib/python3.7/dist-packages/
> > diff --git a/debian/python-openvswitch.install
> b/debian/python-openvswitch.install
> > deleted file mode 100644
> > index 0472d413f627..000000000000
> > --- a/debian/python-openvswitch.install
> > +++ /dev/null
> > @@ -1 +0,0 @@
> > -usr/share/openvswitch/python/ovs usr/lib/python2.7/dist-packages/
> > diff --git a/debian/python-openvswitch.dirs
> b/debian/python3-openvswitch.dirs
> > similarity index 100%
> > rename from debian/python-openvswitch.dirs
> > rename to debian/python3-openvswitch.dirs
> > diff --git a/debian/python3-openvswitch.install
> b/debian/python3-openvswitch.install
> > new file mode 100644
> > index 000000000000..7ba956e3be63
> > --- /dev/null
> > +++ b/debian/python3-openvswitch.install
> > @@ -0,0 +1 @@
> > +usr/share/openvswitch/python/ovs usr/lib/python3.7/dist-packages/
> > diff --git a/debian/rules b/debian/rules
> > index 77f3a19841e5..4dc05c39ba6c 100755
> > --- a/debian/rules
> > +++ b/debian/rules
> > @@ -22,7 +22,7 @@ PARALLEL =
> >  endif
> >
> >  %:
> > -     dh $@ --with autoreconf,python2 --parallel
> > +     dh $@ --with autoreconf,python3 --parallel
> >
> >  # use --as-needed only if supported by dh-autoreconf (to simplify
> backporting)
> >  DH_AS_NEEDED=$(shell dpkg --compare-versions $$(dpkg --status
> dh-autoreconf | grep Version | cut -d' ' -f2) ge 6 && echo --as-needed)
> > diff --git a/include/openflow/automake.mk b/include/openflow/automake.mk
> > index 18cc649899f8..a1d75756c9d7 100644
> > --- a/include/openflow/automake.mk
> > +++ b/include/openflow/automake.mk
> > @@ -12,7 +12,6 @@ openflowinclude_HEADERS = \
> >       include/openflow/openflow-common.h \
> >       include/openflow/openflow.h
> >
> > -if HAVE_PYTHON
> >  SUFFIXES += .h .hstamp
> >
> >  .h.hstamp:
> > @@ -23,7 +22,6 @@ HSTAMP_FILES = $(openflowinclude_HEADERS:.h=.hstamp)
> >  CLEANFILES += $(HSTAMP_FILES)
> >  ALL_LOCAL += $(HSTAMP_FILES)
> >  $(HSTAMP_FILES): build-aux/check-structs $(openflowinclude_HEADERS)
> > -endif
> >
> >  EXTRA_DIST += build-aux/check-structs
> >
> > diff --git a/ipsec/ovs-monitor-ipsec.in b/ipsec/ovs-monitor-ipsec.in
> > index 4710be039ac7..37e370324562 100755
> > --- a/ipsec/ovs-monitor-ipsec.in
> > +++ b/ipsec/ovs-monitor-ipsec.in
> > @@ -1,4 +1,4 @@
> > -#! @PYTHON@
> > +#! @PYTHON3@
> >  # Copyright (c) 2017 Nicira, Inc.
> >  #
> >  # Licensed under the Apache License, Version 2.0 (the "License");
> > diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
> > index 4379d16b4203..78d70fb4e17e 100644
> > --- a/m4/openvswitch.m4
> > +++ b/m4/openvswitch.m4
> > @@ -354,57 +354,16 @@ dnl Checks for valgrind/valgrind.h.
> >  AC_DEFUN([OVS_CHECK_VALGRIND],
> >    [AC_CHECK_HEADERS([valgrind/valgrind.h])])
> >
> > -dnl Checks for Python 2.x, x >= 7.
> > -AC_DEFUN([OVS_CHECK_PYTHON2],
> > -  [AC_CACHE_CHECK(
> > -     [for Python 2.x for x >= 7],
> > -     [ovs_cv_python2],
> > -     [if test -n "$PYTHON2"; then
> > -        ovs_cv_python2=$PYTHON2
> > -      else
> > -        ovs_cv_python2=no
> > -        for binary in python2 python2.7 python; do
> > -          ovs_save_IFS=$IFS; IFS=$PATH_SEPARATOR
> > -          for dir in $PATH; do
> > -            IFS=$ovs_save_IFS
> > -            test -z "$dir" && dir=.
> > -            if test -x "$dir"/"$binary" && "$dir"/"$binary" -c 'import
> sys
> > -if sys.hexversion >= 0x02070000 and sys.hexversion < 0x03000000:
> > -    sys.exit(0)
> > -else:
> > -    sys.exit(1)'; then
> > -              ovs_cv_python2=$dir/$binary
> > -              break 2
> > -            fi
> > -          done
> > -        done
> > -        if test "$ovs_cv_python2" != no && test -x "$ovs_cv_python2";
> then
> > -          if ! "$ovs_cv_python2" -c 'import six ; six.moves.range'
> >&AS_MESSAGE_LOG_FD 2>&1; then
> > -            ovs_cv_python2=no
> > -            AC_MSG_WARN([Missing Python six library or version too
> old.])
> > -          fi
> > -        fi
> > -      fi])
> > -   AC_SUBST([HAVE_PYTHON2])
> > -   AM_MISSING_PROG([PYTHON2], [python2])
> > -   if test "$ovs_cv_python2" != no; then
> > -     PYTHON2=$ovs_cv_python2
> > -     HAVE_PYTHON2=yes
> > -   else
> > -     HAVE_PYTHON2=no
> > -   fi
> > -   AM_CONDITIONAL([HAVE_PYTHON2], [test "$HAVE_PYTHON2" = yes])])
> > -
> > -dnl Checks for Python 3.x, x >= 4.
> > +dnl Checks for Python 3.4 or later.
> >  AC_DEFUN([OVS_CHECK_PYTHON3],
> >    [AC_CACHE_CHECK(
> > -     [for Python 3.x for x >= 4],
> > +     [for Python 3 (version 3.4 or later)],
> >       [ovs_cv_python3],
> >       [if test -n "$PYTHON3"; then
> >          ovs_cv_python3=$PYTHON3
> >        else
> >          ovs_cv_python3=no
> > -        for binary in python3 python3.4; do
> > +        for binary in python3 python3.4 python3.5 python3.6 python3.7;
> do
> >            ovs_save_IFS=$IFS; IFS=$PATH_SEPARATOR
> >            for dir in $PATH; do
> >              IFS=$ovs_save_IFS
> > @@ -419,46 +378,24 @@ else:
> >              fi
> >            done
> >          done
> > -        if test "$ovs_cv_python3" != no; then
> > -          if test -x "$ovs_cv_python3" && ! "$ovs_cv_python3" -c
> 'import six' >/dev/null 2>&1; then
> > -            ovs_cv_python3=no
> > -            AC_MSG_WARN([Missing Python six library.])
> > -          fi
> > -        fi
> >        fi])
> > -   AC_SUBST([HAVE_PYTHON3])
> > -   AM_MISSING_PROG([PYTHON3], [python3])
> > -   if test "$ovs_cv_python3" != no; then
> > -     PYTHON3=$ovs_cv_python3
> > -     HAVE_PYTHON3=yes
> > -   else
> > -     HAVE_PYTHON3=no
> > +   if test "$ovs_cv_python3" = no; then
> > +     AC_MSG_ERROR([Python 3.4 or later is required but not found in
> $PATH, please install it or set $PYTHON3 to point to it])
> >     fi
> > -   AM_CONDITIONAL([HAVE_PYTHON3], [test "$HAVE_PYTHON3" = yes])])
> > -
> > -dnl Checks if you have any compatible Python version installed.
> > -dnl Python 2.7+ has the preference to 3.4+
> > -AC_DEFUN([OVS_CHECK_PYTHON],
> > -  [AC_CACHE_CHECK(
> > -     [for Python 2 or 3],
> > -     [ovs_cv_python],
> > -     [if test -n "$PYTHON"; then
> > -        ovs_cv_python=$PYTHON
> > +   AC_ARG_VAR([PYTHON3])
> > +   PYTHON3=$ovs_cv_python3])
> > +
> > +dnl Checks for python six library.
> > +AC_DEFUN([OVS_CHECK_SIX],
> > +  [AC_REQUIRE([OVS_CHECK_PYTHON3])
> > +   AC_CACHE_CHECK(
> > +     [where Python six library is available],
> > +     [ovs_cv_six],
> > +     [if $PYTHON3 -c 'import six' >/dev/null 2>&1; then
> > +        ovs_cv_six=yes
> >        else
> > -        ovs_cv_python=no
> > -        if test "$ovs_cv_python2" != no; then
> > -          ovs_cv_python=$ovs_cv_python2
> > -        elif test "$ovs_cv_python3" != no; then
> > -          ovs_cv_python=$ovs_cv_python3
> > -        else
> > -          AC_MSG_ERROR([Missing Python.])
> > -        fi
> > -      fi])
> > -    AC_SUBST([PYTHON])
> > -    PYTHON=$ovs_cv_python
> > -    AC_SUBST([HAVE_PYTHON])
> > -    HAVE_PYTHON=yes
> > -    AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])])
> > +        AC_MSG_ERROR([Missing Python six library.])
> > +      fi])])
> >
> >  dnl Checks for flake8.
> >  AC_DEFUN([OVS_CHECK_FLAKE8],
> > @@ -477,7 +414,7 @@ AC_DEFUN([OVS_CHECK_SPHINX],
> >    [AC_CHECK_PROGS(
> >       [SPHINXBUILD], [sphinx-build-3 sphinx-build-2 sphinx-build],
> [none])
> >     AC_ARG_VAR([SPHINXBUILD])
> > -   AM_CONDITIONAL([HAVE_SPHINX], [test "$ac_cv_prog_SPHINXBUILD" !=
> none])])
> > +   AM_CONDITIONAL([HAVE_SPHINX], [test "$SPHINXBUILD" != none])])
> >
> >  dnl Checks for dot.
> >  AC_DEFUN([OVS_CHECK_DOT],
> > diff --git a/manpages.mk b/manpages.mk
> > index a66d109e347f..b43deaef1ae5 100644
> > --- a/manpages.mk
> > +++ b/manpages.mk
> > @@ -116,12 +116,6 @@ lib/vlog-syn.man:
> >  lib/vlog.man:
> >  ovsdb/ovsdb-schemas.man:
> >
> > -utilities/bugtool/ovs-bugtool.8: \
> > -     utilities/bugtool/ovs-bugtool.8.in \
> > -     lib/ovs.tmac
> > -utilities/bugtool/ovs-bugtool.8.in:
> > -lib/ovs.tmac:
> > -
> >  utilities/ovs-appctl.8: \
> >       utilities/ovs-appctl.8.in \
> >       lib/common.man \
> > diff --git a/ovn/automake.mk b/ovn/automake.mk
> > index afaf0688c0da..df92f25d8439 100644
> > --- a/ovn/automake.mk
> > +++ b/ovn/automake.mk
> > @@ -6,18 +6,16 @@ pkgdata_DATA += ovn/ovn-sb.ovsschema
> >  #
> >  # If "python" or "dot" is not available, then we do not add graphical
> diagram
> >  # to the documentation.
> > -if HAVE_PYTHON
> >  if HAVE_DOT
> >  ovn/ovn-sb.gv: ovsdb/ovsdb-dot.in ovn/ovn-sb.ovsschema
> >       $(AM_V_GEN)$(OVSDB_DOT) --no-arrows $(srcdir)/ovn/ovn-sb.ovsschema
> > $@
> >  ovn/ovn-sb.pic: ovn/ovn-sb.gv ovsdb/dot2pic
> > -     $(AM_V_GEN)(dot -T plain < ovn/ovn-sb.gv | $(PYTHON)
> $(srcdir)/ovsdb/dot2pic -f 3) > $@.tmp && \
> > +     $(AM_V_GEN)(dot -T plain < ovn/ovn-sb.gv | $(PYTHON3)
> $(srcdir)/ovsdb/dot2pic -f 3) > $@.tmp && \
> >       mv $@.tmp $@
> >  OVN_SB_PIC = ovn/ovn-sb.pic
> >  OVN_SB_DOT_DIAGRAM_ARG = --er-diagram=$(OVN_SB_PIC)
> >  CLEANFILES += ovn/ovn-sb.gv ovn/ovn-sb.pic
> >  endif
> > -endif
> >
> >  # OVN southbound schema documentation
> >  EXTRA_DIST += ovn/ovn-sb.xml
> > @@ -40,18 +38,16 @@ pkgdata_DATA += ovn/ovn-nb.ovsschema
> >  #
> >  # If "python" or "dot" is not available, then we do not add graphical
> diagram
> >  # to the documentation.
> > -if HAVE_PYTHON
> >  if HAVE_DOT
> >  ovn/ovn-nb.gv: ovsdb/ovsdb-dot.in ovn/ovn-nb.ovsschema
> >       $(AM_V_GEN)$(OVSDB_DOT) --no-arrows $(srcdir)/ovn/ovn-nb.ovsschema
> > $@
> >  ovn/ovn-nb.pic: ovn/ovn-nb.gv ovsdb/dot2pic
> > -     $(AM_V_GEN)(dot -T plain < ovn/ovn-nb.gv | $(PYTHON)
> $(srcdir)/ovsdb/dot2pic -f 3) > $@.tmp && \
> > +     $(AM_V_GEN)(dot -T plain < ovn/ovn-nb.gv | $(PYTHON3)
> $(srcdir)/ovsdb/dot2pic -f 3) > $@.tmp && \
> >       mv $@.tmp $@
> >  OVN_NB_PIC = ovn/ovn-nb.pic
> >  OVN_NB_DOT_DIAGRAM_ARG = --er-diagram=$(OVN_NB_PIC)
> >  CLEANFILES += ovn/ovn-nb.gv ovn/ovn-nb.pic
> >  endif
> > -endif
> >
> >  # OVN northbound schema documentation
> >  EXTRA_DIST += ovn/ovn-nb.xml
> > diff --git a/ovsdb/ovsdb-dot.in b/ovsdb/ovsdb-dot.in
> > index 8eea6172455d..41b986c0ac7f 100755
> > --- a/ovsdb/ovsdb-dot.in
> > +++ b/ovsdb/ovsdb-dot.in
> > @@ -1,4 +1,4 @@
> > -#! @PYTHON@
> > +#! @PYTHON3@
> >
> >  from datetime import date
> >  import ovs.db.error
> > diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
> > index 40fef39edff7..238aaee3189c 100755
> > --- a/ovsdb/ovsdb-idlc.in
> > +++ b/ovsdb/ovsdb-idlc.in
> > @@ -1,4 +1,4 @@
> > -#! @PYTHON@
> > +#! @PYTHON3@
> >
> >  from __future__ import print_function
> >  import getopt
> > diff --git a/python/automake.mk b/python/automake.mk
> > index 5a1e1da8a79a..2f08c7701484 100644
> > --- a/python/automake.mk
> > +++ b/python/automake.mk
> > @@ -69,7 +69,6 @@ FLAKE8_PYFILES += \
> >       python/build/nroff.py \
> >       python/ovs/dirs.py.template
> >
> > -if HAVE_PYTHON
> >  nobase_pkgdata_DATA = $(ovs_pyfiles) $(ovstest_pyfiles)
> >  ovs-install-data-local:
> >       $(MKDIR_P) python/ovs
> > @@ -88,14 +87,10 @@ ovs-install-data-local:
> >       rm python/ovs/dirs.py.tmp
> >
> >  python-sdist: $(srcdir)/python/ovs/version.py $(ovs_pyfiles)
> python/ovs/dirs.py
> > -     (cd python/ && $(PYTHON) setup.py sdist)
> > +     (cd python/ && $(PYTHON3) setup.py sdist)
> >
> >  pypi-upload: $(srcdir)/python/ovs/version.py $(ovs_pyfiles)
> python/ovs/dirs.py
> > -     (cd python/ && $(PYTHON) setup.py sdist upload)
> > -else
> > -ovs-install-data-local:
> > -     @:
> > -endif
> > +     (cd python/ && $(PYTHON3) setup.py sdist upload)
> >  install-data-local: ovs-install-data-local
> >
> >  UNINSTALL_LOCAL += ovs-uninstall-local
> > diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/
> openvswitch-fedora.spec.in
> > index 614c5f9f08ea..fc113c9f1642 100644
> > --- a/rhel/openvswitch-fedora.spec.in
> > +++ b/rhel/openvswitch-fedora.spec.in
> > @@ -45,17 +45,6 @@
> >  %define _rundir /run
> >  %endif
> >
> > -# define the python package prefix based on distribution version so
> that we can
> > -# simultaneously support RHEL-based and later Fedora versions in this
> spec file.
> > -%if 0%{?fedora} >= 25
> > -%define _py2 python2
> > -%endif
> > -
> > -%if 0%{?rhel} || 0%{?fedora} < 25
> > -%define _py2 python
> > -%endif
> > -
> > -
> >  Name: openvswitch
> >  Summary: Open vSwitch
> >  Group: System Environment/Daemons
> > @@ -72,7 +61,6 @@ Source:
> http://openvswitch.org/releases/%{name}-%{version}.tar.gz
> >  BuildRequires: gcc gcc-c++
> >  BuildRequires: autoconf automake libtool
> >  BuildRequires: systemd-units openssl openssl-devel
> > -BuildRequires: %{_py2}-devel
> >  %if 0%{?fedora} > 22 || %{with build_python3}
> >  BuildRequires: python3-devel
> >  %endif
> > @@ -81,7 +69,6 @@ BuildRequires: groff graphviz
> >  BuildRequires: checkpolicy, selinux-policy-devel
> >  BuildRequires: /usr/bin/sphinx-build-3
> >  # make check dependencies
> > -BuildRequires: %{_py2}-twisted%{?rhel:-core} %{_py2}-zope-interface
> %{_py2}-six
> >  BuildRequires: procps-ng
> >  %if %{with libcapng}
> >  BuildRequires: libcap-ng libcap-ng-devel
> > @@ -122,16 +109,6 @@ Requires: selinux-policy-targeted
> >  %description selinux-policy
> >  Tailored Open vSwitch SELinux policy
> >
> > -%package -n %{_py2}-openvswitch
> > -Summary: Open vSwitch python2 bindings
> > -License: ASL 2.0
> > -BuildArch: noarch
> > -Requires: %{_py2}
> > -Requires: %{_py2}-six
> > -%{?python_provide:%python_provide python2-openvswitch =
> %{version}-%{release}}
> > -%description -n %{_py2}-openvswitch
> > -Python bindings for the Open vSwitch database
> > -
> >  %if 0%{?fedora} > 22 || %{with build_python3}
> >  %package -n python3-openvswitch
> >  Summary: Open vSwitch python3 bindings
> > @@ -149,8 +126,6 @@ Python bindings for the Open vSwitch database
> >  Summary: Open vSwitch testing utilities
> >  License: ASL 2.0
> >  BuildArch: noarch
> > -Requires: %{_py2}-openvswitch = %{version}-%{release}
> > -Requires: %{_py2} %{_py2}-netifaces %{_py2}-twisted
> >
> >  %description test
> >  Utilities that are useful to diagnose performance and connectivity
> > @@ -179,7 +154,7 @@ service.
> >  %package ipsec
> >  Summary: Open vSwitch IPsec tunneling support
> >  License: ASL 2.0
> > -Requires: openvswitch %{_py2}-openvswitch libreswan
> > +Requires: openvswitch python3-openvswitch libreswan
> >
> >  %description ipsec
> >  This package provides IPsec tunneling support for OVS tunnels.
> > @@ -201,12 +176,7 @@ This package provides IPsec tunneling support for
> OVS tunnels.
> >          --disable-static \
> >          --enable-shared \
> >          --with-pkidir=%{_sharedstatedir}/openvswitch/pki \
> > -%if 0%{?fedora} > 22 || %{with build_python3}
> > -        PYTHON3=%{__python3} \
> > -        PYTHON=%{__python2}
> > -%else
> > -        PYTHON=%{__python}
> > -%endif
> > +        PYTHON3=%{__python3}
> >
> >  build-aux/dpdkstrip.py \
> >  %if %{with dpdk}
> > @@ -274,13 +244,9 @@ install -p -m 0755
> rhel/etc_sysconfig_network-scripts_ifdown-ovs \
> >  install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifup-ovs \
> >
> $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
> >
> > -install -d -m 0755 $RPM_BUILD_ROOT%{python2_sitelib}
> > -cp -a $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/* \
> > -   $RPM_BUILD_ROOT%{python2_sitelib}
> > -
> >  %if 0%{?fedora} > 22 || %{with build_python3}
> >  install -d -m 0755 $RPM_BUILD_ROOT%{python3_sitelib}
> > -cp -a $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/ovs \
> > +cp -a $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/* \
> >     $RPM_BUILD_ROOT%{python3_sitelib}
> >  %endif
> >
> > @@ -435,9 +401,6 @@ fi
> >  %defattr(-,root,root)
> >  %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp
> >
> > -%files -n %{_py2}-openvswitch
> > -%{python2_sitelib}/ovs
> > -
> >  %if 0%{?fedora} > 22 || %{with build_python3}
> >  %files -n python3-openvswitch
> >  %{python3_sitelib}/ovs
> > @@ -456,7 +419,7 @@ fi
> >  %{_mandir}/man1/ovs-pcap.1*
> >  %{_mandir}/man8/ovs-tcpdump.8*
> >  %{_mandir}/man1/ovs-tcpundump.1*
> > -%{python2_sitelib}/ovstest
> > +%{python3_sitelib}/ovstest
> >
> >  %files devel
> >  %{_libdir}/lib*.so
> > diff --git a/tests/atlocal.in b/tests/atlocal.in
> > index 556f8681cf12..1dc7cd5d087a 100644
> > --- a/tests/atlocal.in
> > +++ b/tests/atlocal.in
> > @@ -1,28 +1,14 @@
> >  # -*- shell-script -*-
> >  HAVE_OPENSSL='@HAVE_OPENSSL@'
> >  OPENSSL_SUPPORTS_SNI='@OPENSSL_SUPPORTS_SNI@'
> > -HAVE_PYTHON='@HAVE_PYTHON@'
> > -HAVE_PYTHON2='@HAVE_PYTHON2@'
> > -HAVE_PYTHON3='@HAVE_PYTHON3@'
> >  HAVE_UNBOUND='@HAVE_UNBOUND@'
> >  EGREP='@EGREP@'
> > +PYTHON3='@PYTHON3@'
> >
> > -if test x"$PYTHON" = x; then
> > -    PYTHON='@PYTHON@'
> > -fi
> > -
> > -if test x"$PYTHON2" = x; then
> > -    PYTHON2='@PYTHON2@'
> > -fi
> > -
> > -if test x"$PYTHON3" = x; then
> > -    PYTHON3='@PYTHON3@'
> > -
> > -    # PYTHONCOERCECLOCALE=0 disables the Unicode compatibility warning
> on
> > -    # stderr that breaks almost any Python3 test (PEP 0538)
> > -    PYTHONCOERCECLOCALE=0
> > -    export PYTHONCOERCECLOCALE
> > -fi
> > +# PYTHONCOERCECLOCALE=0 disables the Unicode compatibility warning on
> > +# stderr that breaks almost any Python3 test (PEP 0538)
> > +PYTHONCOERCECLOCALE=0
> > +export PYTHONCOERCECLOCALE
> >
> >  PYTHONPATH=$abs_top_srcdir/python:$abs_top_builddir/tests:$PYTHONPATH
> >  export PYTHONPATH
> > @@ -63,7 +49,7 @@ Linux)
> >      # in particular the patch attached there, which was applied to
> glibc CVS as
> >      # "Restore locking in free_check." between 1.11 and 1.11.1.
> >      vswitchd=$abs_top_builddir/vswitchd/ovs-vswitchd
> > -    glibc=`ldd $vswitchd | sed -n 's/^       libc\.[^ ]* => \([^ ]*\)
> .*/\1/p'`
> > +    glibc=`ldd $vswitchd | sed -n 's/^  libc\.[^ ]* => \([^ ]*\)
> .*/\1/p'`
> >      glibc_version=`$glibc | sed -n '1s/.*version
> \([0-9]\{1,\}\.[0-9]\{1,\}\).*/\1/p'`
> >      case $glibc_version in
> >          2.[0-9] | 2.1[01]) mcheck=disabled ;;
> > @@ -116,7 +102,7 @@ FreeBSD|NetBSD)
> >      ;;
> >  esac
> >
> > -if test x"$PYTHON3" != x && test "$IS_WIN32" = yes; then
> > +if test "$IS_WIN32" = yes; then
> >      # enables legacy windows unicode printing needed for Python3
> compatibility
> >      # with the Python2 tests
> >      PYTHONLEGACYWINDOWSFSENCODING=true
> > @@ -126,7 +112,7 @@ if test x"$PYTHON3" != x && test "$IS_WIN32" = yes;
> then
> >  fi
> >
> >  # Check whether to run IPv6 tests.
> > -$PYTHON -c '
> > +$PYTHON3 -c '
> >  import errno
> >  import socket
> >  import sys
> > @@ -140,7 +126,7 @@ except socket.error as e:
> >  case $? in
> >      0) HAVE_IPV6=yes ;;
> >      2) HAVE_IPV6=no ;;
> > -    *) echo "$0: unexpected error probing $PYTHON for IPv6 support" >&2
> ;;
> > +    *) echo "$0: unexpected error probing $PYTHON3 for IPv6 support"
> >&2 ;;
> >  esac
> >
> >  # Look for a python L7 library 'LIB' in the system. If it is found,
> defines
> > @@ -149,13 +135,9 @@ find_l7_lib()
> >  {
> >      set +x
> >      var=HAVE_`echo "$1" | tr '[a-z]' '[A-Z]'`
> > -    if test "$HAVE_PYTHON" = "yes"; then
> > -        result=$($PYTHON $abs_top_srcdir/tests/test-l7.py --help | grep
> "$1")
> > -        if test "x${result}" != x; then
> > -            eval ${var}="yes"
> > -        else
> > -            eval ${var}="no"
> > -        fi
> > +    result=$($PYTHON3 $abs_top_srcdir/tests/test-l7.py --help | grep
> "$1")
> > +    if test "x${result}" != x; then
> > +        eval ${var}="yes"
> >      else
> >          eval ${var}="no"
> >      fi
> > diff --git a/tests/automake.mk b/tests/automake.mk
> > index 0b4f29486bc7..0442334ecb78 100644
> > --- a/tests/automake.mk
> > +++ b/tests/automake.mk
> > @@ -199,7 +199,7 @@ check-local:
> >  COVERAGE = coverage
> >  COVERAGE_FILE='$(abs_srcdir)/.coverage'
> >  check-pycov: all clean-pycov
> > -     PYTHONDONTWRITEBYTECODE=yes COVERAGE_FILE=$(COVERAGE_FILE)
> PYTHON='$(COVERAGE) run -p' $(SHELL) '$(TESTSUITE)' -C tests
> AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
> > +     PYTHONDONTWRITEBYTECODE=yes COVERAGE_FILE=$(COVERAGE_FILE)
> PYTHON3='$(COVERAGE) run -p' $(SHELL) '$(TESTSUITE)' -C tests
> AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
> >       @cd $(srcdir) && $(COVERAGE) combine &&
> COVERAGE_FILE=$(COVERAGE_FILE) $(COVERAGE) annotate
> >       @echo
> >       @echo
> '----------------------------------------------------------------------'
> > diff --git a/tests/check-structs.at b/tests/check-structs.at
> > index 4163c30d6dbe..15ca536112e6 100644
> > --- a/tests/check-structs.at
> > +++ b/tests/check-structs.at
> > @@ -3,10 +3,9 @@ AT_BANNER([struct alignment checker unit tests])
> >  m4_define([check_structs], [$top_srcdir/build-aux/check-structs])
> >  m4_define([RUN_STRUCT_CHECKER],
> >    [AT_KEYWORDS([check-structs])
> > -   AT_SKIP_IF([test $HAVE_PYTHON = no])
> >     AT_DATA([test.h], [$1
> >  ])
> > -   AT_CHECK_UNQUOTED([$PYTHON check_structs test.h], [$2], [$3], [$4])])
> > +   AT_CHECK_UNQUOTED([$PYTHON3 check_structs test.h], [$2], [$3],
> [$4])])
> >
> >  AT_SETUP([check struct tail padding])
> >  RUN_STRUCT_CHECKER(
> > diff --git a/tests/checkpatch.at b/tests/checkpatch.at
> > index fe21acdf2d22..6c7394772270 100755
> > --- a/tests/checkpatch.at
> > +++ b/tests/checkpatch.at
> > @@ -3,10 +3,9 @@ AT_BANNER([checkpatch])
> >  OVS_START_SHELL_HELPERS
> >  # try_checkpatch PATCH [ERRORS]
> >  #
> > -# Runs checkpatch under Python 2 and Python 3, if installed, on the
> given
> > -# PATCH, expecting the specified set of ERRORS (and warnings).
> > +# Runs checkpatch, if installed, on the given PATCH, expecting the
> > +# specified set of ERRORS (and warnings).
> >  try_checkpatch() {
> > -    AT_SKIP_IF([test $HAVE_PYTHON2 = no && test $HAVE_PYTHON3 = no])
> >      # Take the patch to test from $1.  Remove an initial four-space
> indent
> >      # from it and, if it is just headers with no body, add a null body.
> >      echo "$1" | sed 's/^    //' > test.patch
> > @@ -22,18 +21,12 @@ try_checkpatch() {
> >          : > expout
> >      fi
> >
> > -    try_checkpatch__ "$HAVE_PYTHON2" "$PYTHON2"
> > -    try_checkpatch__ "$HAVE_PYTHON3" "$PYTHON3"
> > -}
> > -try_checkpatch__() {
> > -    if test $1 = no; then
> > -        :
> > -    elif test -s expout; then
> > -        AT_CHECK([$2 $top_srcdir/utilities/checkpatch.py -q test.patch],
> > +    if test -s expout; then
> > +        AT_CHECK([$PYTHON3 $top_srcdir/utilities/checkpatch.py -q
> test.patch],
> >                   [1], [stdout])
> >          AT_CHECK([sed '/^Lines checked:/,$d' stdout], [0], [expout])
> >      else
> > -        AT_CHECK([$2 $top_srcdir/utilities/checkpatch.py -q test.patch])
> > +        AT_CHECK([$PYTHON3 $top_srcdir/utilities/checkpatch.py -q
> test.patch])
> >      fi
> >  }
> >  OVS_END_SHELL_HELPERS
> > diff --git a/tests/daemon-py.at b/tests/daemon-py.at
> > index 6adea3c85dfc..883e45a5ac21 100644
> > --- a/tests/daemon-py.at
> > +++ b/tests/daemon-py.at
> > @@ -1,252 +1,205 @@
> > -AT_BANNER([daemon unit tests - Python])
> > -
> > -m4_define([DAEMON_PYN],
> > -  [AT_SETUP([daemon - $1])
> > -   AT_SKIP_IF([test $2 = no])
> > -   # Skip this test for Windows, echo $! gives shell pid instead of
> parent process
> > -   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> > -   AT_KEYWORDS([python daemon])
> > -
> > -   on_exit 'kill $(cat *.pid)'
> > -   pidfile=test-daemon.py.pid
> > -
> > -   # Start the daemon and wait for the pidfile to get created
> > -   # and that its contents are the correct pid.
> > -   AT_CHECK([$3 $srcdir/test-daemon.py --pidfile & echo $!], [0],
> [stdout])
> > -   pid=$(cat stdout)
> > -
> > -   OVS_WAIT_UNTIL([test -s $pidfile], [kill $pid])
> > -   AT_CHECK([test $pid = $(cat $pidfile)])
> > -   AT_CHECK([kill -0 $pid])
> > -
> > -   # Kill the daemon and make sure that the pidfile gets deleted.
> > -   kill $pid
> > -   OVS_WAIT_WHILE([kill -0 $pid])
> > -   AT_CHECK([test ! -e $pidfile])
> > -   AT_CLEANUP])
> > -
> > -DAEMON_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
> > -DAEMON_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
> > -
> > -m4_define([DAEMON_MONITOR_PYN],
> > -  [AT_SETUP([daemon --monitor - $1])
> > -   AT_SKIP_IF([test $2 = no])
> > -
> > -   # Skip this test for Windows, echo $! gives shell pid instead of
> parent process
> > -   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> > -
> > -   on_exit 'kill $(cat *.pid)'
> > -   pidfile=test-daemon.py.pid
> > -
> > -   # Start the daemon and wait for the pidfile to get created.
> > -   AT_CHECK([$3 $srcdir/test-daemon.py --pidfile --monitor & echo $!],
> [0], [stdout])
> > -   monitor=$(cat stdout)
> > -   OVS_WAIT_UNTIL([test -s $pidfile])
> > -   child=$(cat $pidfile)
> > -
> > -   # Check that the pidfile names a running process,
> > -   # and that the parent process of that process is our child process.
> > -   check_ancestors $child $monitor
> > -
> > -   # Kill the daemon process, making it look like a segfault,
> > -   # and wait for a new child process to get spawned.
> > -   AT_CHECK([kill -SEGV $child])
> > -   OVS_WAIT_WHILE([kill -0 $child])
> > -   OVS_WAIT_UNTIL([test -s $pidfile && test $(cat $pidfile) != $child])
> > -   child2=$(cat $pidfile)
> > -
> > -   # Check that the pidfile names a running process,
> > -   # and that the parent process of that process is our child process.
> > -   check_ancestors $child2 $monitor
> > -
> > -   # Kill the daemon process with SIGTERM, and wait for the daemon
> > -   # and the monitor processes to go away and the pidfile to get
> deleted.
> > -   AT_CHECK([kill $child2])
> > -   OVS_WAIT_WHILE([kill -0 $monitor || kill -0 $child2 || test -e
> $pidfile])
> > -   AT_CLEANUP])
> > -
> > -DAEMON_MONITOR_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
> > -DAEMON_MONITOR_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
> > -
> > -m4_define([DAEMON_MONITOR_RESTART_PYN],
> > -  [AT_SETUP([daemon --monitor restart exit code - $1])
> > -   AT_SKIP_IF([test $2 = no])
> > -   # Skip this test for Windows, echo $! gives shell pid instead of
> parent process
> > -   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> > -
> > -   on_exit 'kill $(cat *.pid)'
> > -   pidfile=test-daemon.py.pid
> > -
> > -   # Start the daemon and wait for the pidfile to get created.
> > -   AT_CHECK([$3 $srcdir/test-daemon.py --pidfile --monitor & echo $!],
> [0], [stdout])
> > -   monitor=$(cat stdout)
> > -   OVS_WAIT_UNTIL([test -s $pidfile])
> > -   child=$(cat $pidfile)
> > -
> > -   # Check that the pidfile names a running process,
> > -   # and that the parent process of that process is our child process.
> > -   check_ancestors $child $monitor
> > -
> > -   # HUP the daemon process causing it to throw an exception,
> > -   # and wait for a new child process to get spawned.
> > -   AT_CHECK([kill -HUP $child])
> > -   OVS_WAIT_WHILE([kill -0 $child])
> > -   OVS_WAIT_UNTIL([test -s $pidfile && test $child != $(cat $pidfile)])
> > -   child2=$(cat $pidfile)
> > -
> > -   # Check that the pidfile names a running process,
> > -   # and that the parent process of that process is our child process.
> > -   check_ancestors $child2 $monitor
> > -
> > -   # Kill the daemon process with SIGTERM, and wait for the daemon
> > -   # and the monitor processes to go away and the pidfile to get
> deleted.
> > -   AT_CHECK([kill $child2])
> > -   OVS_WAIT_WHILE([kill -0 $monitor || kill -0 $child2 || test -e
> $pidfile])
> > -   AT_CLEANUP])
> > -
> > -DAEMON_MONITOR_RESTART_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
> > -DAEMON_MONITOR_RESTART_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
> > -
> > -m4_define([DAEMON_DETACH_PYN],
> > -  [AT_SETUP([daemon --detach - $1])
> > -   AT_SKIP_IF([test $2 = no])
> > -
> > -   # Skip this test for Windows, the pid file not removed if the daemon
> is killed
> > -   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> > -
> > -   on_exit 'kill $(cat *.pid)'
> > -   pidfile=test-daemon.py.pid
> > -
> > -   # Start the daemon and make sure that the pidfile exists immediately.
> > -   # We don't wait for the pidfile to get created because the daemon is
> > -   # supposed to do so before the parent exits.
> > -   AT_CHECK([$3 $srcdir/test-daemon.py --pidfile --detach --no-chdir],
> [0])
> > -   AT_CHECK([test -s $pidfile])
> > -   pid=$(cat $pidfile)
> > -   check_ancestors $pid 1
> > -
> > -   # Kill the daemon and make sure that the pidfile gets deleted.
> > -   AT_CHECK([kill $pid])
> > -   OVS_WAIT_WHILE([kill -0 $pid])
> > -   AT_CHECK([test ! -e $pidfile])
> > -   AT_CLEANUP])
> > -
> > -DAEMON_DETACH_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
> > -DAEMON_DETACH_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
> > -
> > -m4_define([DAEMON_DETACH_MONITOR_PYN],
> > -  [AT_SETUP([daemon --detach --monitor - $1])
> > -   AT_SKIP_IF([test $2 = no])
> > -
> > -   # Skip this test for Windows, uses Linux specific kill signal
> > -   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> > -
> > -   on_exit 'kill $(cat *.pid)'
> > -   pidfile=test-daemon.py.pid
> > -
> > -   # Start the daemon and make sure that the pidfile exists immediately.
> > -   # We don't wait for the pidfile to get created because the daemon is
> > -   # supposed to do so before the parent exits.
> > -   AT_CHECK([$3 $srcdir/test-daemon.py --pidfile --detach --no-chdir
> --monitor], [0])
> > -   AT_CHECK([test -s $pidfile])
> > -   child=$(cat $pidfile)
> > -   AT_CHECK([parent_pid $child], [0], [stdout])
> > -   monitor=$(cat stdout)
> > -
> > -   # Check that the pidfile names a running process,
> > -   # and that the parent process of that process is a running process,
> > -   # and that the parent process of that process is init.
> > -   check_ancestors $child $monitor 1
> > -
> > -   # Kill the daemon process, making it look like a segfault,
> > -   # and wait for a new daemon process to get spawned.
> > -   AT_CHECK([kill -SEGV $child])
> > -   OVS_WAIT_WHILE([kill -0 $child])
> > -   OVS_WAIT_UNTIL([test -s $pidfile && test $(cat $pidfile) != $child])
> > -   child2=$(cat $pidfile)
> > -
> > -   # Check that the pidfile names a running process,
> > -   # and that the parent process of that process is our child process.
> > -   check_ancestors $child2 $monitor 1
> > -
> > -   # Kill the daemon process with SIGTERM, and wait for the daemon
> > -   # and the monitor processes to go away and the pidfile to get
> deleted.
> > -   AT_CHECK([kill $child2])
> > -   OVS_WAIT_WHILE([kill -0 $child2 || kill -0 $monitor || test -e
> $pidfile])
> > -   AT_CLEANUP])
> > -
> > -DAEMON_DETACH_MONITOR_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
> > -DAEMON_DETACH_MONITOR_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
> > -
> > -m4_define([DAEMON_DETACH_ERRORS_PYN],
> > -  [AT_SETUP([daemon --detach startup errors - $1])
> > -   AT_SKIP_IF([test $2 = no])
> > -   AT_CHECK([$3 $srcdir/test-daemon.py --pidfile --detach --no-chdir
> --bail], [1], [], [stderr])
> > -   AT_CHECK([grep 'test-daemon.py: exiting after daemonize_start() as
> requested' stderr],
> > -     [0], [ignore])
> > -   AT_CHECK([test ! -s test-daemon.py.pid])
> > -   AT_CLEANUP])
> > -
> > -DAEMON_DETACH_ERRORS_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
> > -DAEMON_DETACH_ERRORS_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
> > -
> > -m4_define([DAEMON_DETACH_MONITOR_ERRORS_PYN],
> > -  [AT_SETUP([daemon --detach --monitor startup errors - $1])
> > -   AT_SKIP_IF([test $2 = no])
> > -   AT_CAPTURE_FILE([pid])
> > -   AT_CHECK([$3 $srcdir/test-daemon.py --pidfile --detach --no-chdir
> --monitor --bail], [1], [], [stderr])
> > -   AT_CHECK([grep 'test-daemon.py: exiting after daemonize_start() as
> requested' stderr],
> > -     [0], [ignore])
> > -   AT_CHECK([test ! -s test-daemon.py.pid])
> > -   AT_CLEANUP])
> > -
> > -DAEMON_DETACH_MONITOR_ERRORS_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
> > -DAEMON_DETACH_MONITOR_ERRORS_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
> > -
> > -m4_define([DAEMON_DETACH_CLOSES_FDS_PYN],
> > -  [AT_SETUP([daemon --detach closes standard fds - $1])
> > -   AT_SKIP_IF([test $2 = no])
> > -
> > -   # Skip this test for Windows, uses Linux specific kill signal
> > -   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> > -
> > -   AT_CHECK([(yes 2>stderr; echo $? > status) | $3
> $srcdir/test-daemon.py --pidfile --detach --no-chdir])
> > -   AT_CHECK([kill $(cat test-daemon.py.pid)])
> > -   AT_CHECK([test -s status])
> > -   if grep '[[bB]]roken pipe' stderr >/dev/null 2>&1; then
> > -     # Something in the environment caused SIGPIPE to be ignored, but
> > -     # 'yes' at least told us that it got EPIPE.  Good enough; we know
> > -     # that stdout was closed.
> > -     :
> > -   else
> > -     # Otherwise make sure that 'yes' died from SIGPIPE.
> > -     AT_CHECK([kill -l `cat status`], [0], [PIPE
> > +AT_BANNER([daemon unit tests - Python3])
> > +
> > +AT_SETUP([daemon - Python3])
> > +# Skip this test for Windows, echo $! gives shell pid instead of parent
> process
> > +AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> > +AT_KEYWORDS([python daemon])
> > +
> > +on_exit 'kill $(cat *.pid)'
> > +pidfile=test-daemon.py.pid
> > +
> > +# Start the daemon and wait for the pidfile to get created
> > +# and that its contents are the correct pid.
> > +AT_CHECK([$PYTHON3 $srcdir/test-daemon.py --pidfile & echo $!], [0],
> [stdout])
> > +pid=$(cat stdout)
> > +
> > +OVS_WAIT_UNTIL([test -s $pidfile], [kill $pid])
> > +AT_CHECK([test $pid = $(cat $pidfile)])
> > +AT_CHECK([kill -0 $pid])
> > +
> > +# Kill the daemon and make sure that the pidfile gets deleted.
> > +kill $pid
> > +OVS_WAIT_WHILE([kill -0 $pid])
> > +AT_CHECK([test ! -e $pidfile])
> > +AT_CLEANUP
> > +
> > +AT_SETUP([daemon --monitor - Python3])
> > +# Skip this test for Windows, echo $! gives shell pid instead of parent
> process
> > +AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> > +
> > +on_exit 'kill $(cat *.pid)'
> > +pidfile=test-daemon.py.pid
> > +
> > +# Start the daemon and wait for the pidfile to get created.
> > +AT_CHECK([$PYTHON3 $srcdir/test-daemon.py --pidfile --monitor & echo
> $!], [0], [stdout])
> > +monitor=$(cat stdout)
> > +OVS_WAIT_UNTIL([test -s $pidfile])
> > +child=$(cat $pidfile)
> > +
> > +# Check that the pidfile names a running process,
> > +# and that the parent process of that process is our child process.
> > +check_ancestors $child $monitor
> > +
> > +# Kill the daemon process, making it look like a segfault,
> > +# and wait for a new child process to get spawned.
> > +AT_CHECK([kill -SEGV $child])
> > +OVS_WAIT_WHILE([kill -0 $child])
> > +OVS_WAIT_UNTIL([test -s $pidfile && test $(cat $pidfile) != $child])
> > +child2=$(cat $pidfile)
> > +
> > +# Check that the pidfile names a running process,
> > +# and that the parent process of that process is our child process.
> > +check_ancestors $child2 $monitor
> > +
> > +# Kill the daemon process with SIGTERM, and wait for the daemon
> > +# and the monitor processes to go away and the pidfile to get deleted.
> > +AT_CHECK([kill $child2])
> > +OVS_WAIT_WHILE([kill -0 $monitor || kill -0 $child2 || test -e
> $pidfile])
> > +AT_CLEANUP
> > +
> > +AT_SETUP([daemon --monitor restart exit code - Python3])
> > +# Skip this test for Windows, echo $! gives shell pid instead of parent
> process
> > +AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> > +
> > +on_exit 'kill $(cat *.pid)'
> > +pidfile=test-daemon.py.pid
> > +
> > +# Start the daemon and wait for the pidfile to get created.
> > +AT_CHECK([$PYTHON3 $srcdir/test-daemon.py --pidfile --monitor & echo
> $!], [0], [stdout])
> > +monitor=$(cat stdout)
> > +OVS_WAIT_UNTIL([test -s $pidfile])
> > +child=$(cat $pidfile)
> > +
> > +# Check that the pidfile names a running process,
> > +# and that the parent process of that process is our child process.
> > +check_ancestors $child $monitor
> > +
> > +# HUP the daemon process causing it to throw an exception,
> > +# and wait for a new child process to get spawned.
> > +AT_CHECK([kill -HUP $child])
> > +OVS_WAIT_WHILE([kill -0 $child])
> > +OVS_WAIT_UNTIL([test -s $pidfile && test $child != $(cat $pidfile)])
> > +child2=$(cat $pidfile)
> > +
> > +# Check that the pidfile names a running process,
> > +# and that the parent process of that process is our child process.
> > +check_an


More information about the dev mailing list