From patchwork Thu Sep 26 15:20:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1168019 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46fMfc2tJ9z9sNf for ; Fri, 27 Sep 2019 03:41:11 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 0A813D7D; Thu, 26 Sep 2019 17:41:10 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 52A35408 for ; Thu, 26 Sep 2019 17:41:08 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id C5D9B108 for ; Thu, 26 Sep 2019 17:40:57 +0000 (UTC) X-Originating-IP: 66.170.99.95 Received: from localhost.localdomain (unknown [66.170.99.95]) (Authenticated sender: blp@ovn.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 790EC1BF203; Thu, 26 Sep 2019 17:40:54 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 26 Sep 2019 08:20:25 -0700 Message-Id: <20190926152024.29212-1-blp@ovn.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, URI_NOVOWEL,WEIRD_QUOTING autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH v4] Require Python 3 and remove support for Python 2. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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 Tested-by: Numan Siddique --- 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. v3->v4: Rebase. .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 | 99 +--- manpages.mk | 6 - 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 +- 79 files changed, 648 insertions(+), 1144 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 = <