meta-virtualization/recipes-networking/openvswitch/files/python-make-remaining-scripts-use-usr-bin-env.patch
Mark Asselstine e86ae39489 openvswitch: switch to depending on python3
As far as I can tell openvswitch has been updated to work with python3
as well as with python(2). Switch to depend on python3 and use python3
for associated scripts. For the most part openvswitch will bind at
runtime to either py2 or py3 regardless of these changes, with these
changes we just do a better job of setting up the dependencies to
facilitate py3 bindings. The openvswitch autotests results are mostly
identical before and after this switch (failures move from python3 to
python(2) test cases as expected, with some exceptions see below).

When running the autotests/ptest with python(2) vs python3 we see a
slightly higher failure rate (334 failures vs. 284 failures). I do not
believe this higher fail rate reflects actual errors in the runtime,
rather the tests are not adapted to python3. At any rate like the rest
of openvswitch it is fairly straightforward to hack the logic for
autotests to be run using py2 as long as it is available in the image,
so these changes don't prevent falling back to py2 for autotests. This
should facilitate any debugging we need to do based on us switching to
favor py3.

Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
2017-06-21 14:25:14 -04:00

153 lines
4.8 KiB
Diff

From 04ad1c3d9f47cfdf4ad9b5d685e953ec094326ff Mon Sep 17 00:00:00 2001
From: Mark Asselstine <mark.asselstine@windriver.com>
Date: Fri, 13 Jan 2017 16:12:55 -0500
Subject: [PATCH] python: make remaining scripts use /usr/bin/env
Unfortunately there is no concept of a host python vs. target python
to facilitate cross compilation. There is only one PYTHON variable and
this is used during building and in the header of python scripts after
installation. The best approach for cross compilation is to thus to
ensure python is in the path and avoid passing a path as part of
PYTHON. To make this function smoothly all installed scripts should
make use of /usr/bin/env to increase the chances of finding python.
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
---
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/xml2nroff | 2 +-
ovn/utilities/ovn-docker-overlay-driver | 2 +-
ovn/utilities/ovn-docker-underlay-driver | 2 +-
ovsdb/ovsdb-doc | 2 +-
ovsdb/ovsdb-dot.in | 2 +-
ovsdb/ovsdb-idlc.in | 2 +-
utilities/bugtool/ovs-bugtool.in | 2 +-
12 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/build-aux/check-structs b/build-aux/check-structs
index f79f235..c7b8730 100755
--- a/build-aux/check-structs
+++ b/build-aux/check-structs
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python3
import os.path
import sys
diff --git a/build-aux/extract-ofp-actions b/build-aux/extract-ofp-actions
index 184447b..92ea18d 100755
--- a/build-aux/extract-ofp-actions
+++ b/build-aux/extract-ofp-actions
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python3
import sys
import os.path
diff --git a/build-aux/extract-ofp-errors b/build-aux/extract-ofp-errors
index 9642593..11e6de7 100755
--- a/build-aux/extract-ofp-errors
+++ b/build-aux/extract-ofp-errors
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python3
import sys
import os.path
diff --git a/build-aux/extract-ofp-fields b/build-aux/extract-ofp-fields
index 498b887..5d6bcec 100755
--- a/build-aux/extract-ofp-fields
+++ b/build-aux/extract-ofp-fields
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python3
import getopt
import sys
diff --git a/build-aux/extract-ofp-msgs b/build-aux/extract-ofp-msgs
index 1813638..e9e3c25 100755
--- a/build-aux/extract-ofp-msgs
+++ b/build-aux/extract-ofp-msgs
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python3
import sys
import os.path
diff --git a/build-aux/xml2nroff b/build-aux/xml2nroff
index bd4e879..9d81503 100755
--- a/build-aux/xml2nroff
+++ b/build-aux/xml2nroff
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python3
# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
#
diff --git a/ovn/utilities/ovn-docker-overlay-driver b/ovn/utilities/ovn-docker-overlay-driver
index 52de3db..c90f02b 100755
--- a/ovn/utilities/ovn-docker-overlay-driver
+++ b/ovn/utilities/ovn-docker-overlay-driver
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python3
# Copyright (C) 2015 Nicira, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/ovn/utilities/ovn-docker-underlay-driver b/ovn/utilities/ovn-docker-underlay-driver
index 2c9c4b6..89b804c 100755
--- a/ovn/utilities/ovn-docker-underlay-driver
+++ b/ovn/utilities/ovn-docker-underlay-driver
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python3
# Copyright (C) 2015 Nicira, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc
index 5cf26ee..f76f4bd 100755
--- a/ovsdb/ovsdb-doc
+++ b/ovsdb/ovsdb-doc
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python3
# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
#
diff --git a/ovsdb/ovsdb-dot.in b/ovsdb/ovsdb-dot.in
index 134ce22..893c408 100755
--- a/ovsdb/ovsdb-dot.in
+++ b/ovsdb/ovsdb-dot.in
@@ -1,4 +1,4 @@
-#! @PYTHON@
+#! /usr/bin/env @PYTHON@
from datetime import date
import ovs.db.error
diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
index 721ab50..bfbcf23 100755
--- a/ovsdb/ovsdb-idlc.in
+++ b/ovsdb/ovsdb-idlc.in
@@ -1,4 +1,4 @@
-#! @PYTHON@
+#! /usr/bin/env @PYTHON@
import getopt
import os
diff --git a/utilities/bugtool/ovs-bugtool.in b/utilities/bugtool/ovs-bugtool.in
index 963c50c..c84d7c2 100755
--- a/utilities/bugtool/ovs-bugtool.in
+++ b/utilities/bugtool/ovs-bugtool.in
@@ -1,4 +1,4 @@
-#! @PYTHON@
+#! /usr/bin/env @PYTHON@
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
--
2.7.4