summaryrefslogtreecommitdiffstats
path: root/recipes-networking/openvswitch/openvswitch-git/0007-Python3-compatibility-unicode-to-str.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-networking/openvswitch/openvswitch-git/0007-Python3-compatibility-unicode-to-str.patch')
-rw-r--r--recipes-networking/openvswitch/openvswitch-git/0007-Python3-compatibility-unicode-to-str.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/recipes-networking/openvswitch/openvswitch-git/0007-Python3-compatibility-unicode-to-str.patch b/recipes-networking/openvswitch/openvswitch-git/0007-Python3-compatibility-unicode-to-str.patch
new file mode 100644
index 00000000..faa32b73
--- /dev/null
+++ b/recipes-networking/openvswitch/openvswitch-git/0007-Python3-compatibility-unicode-to-str.patch
@@ -0,0 +1,51 @@
1From 2fe58f87b00d0ec24d6997930d0bcdb130c84396 Mon Sep 17 00:00:00 2001
2From: Jason Wessel <jason.wessel@windriver.com>
3Date: Thu, 29 Jun 2017 20:33:23 -0700
4Subject: [PATCH 7/8] Python3 compatibility: unicode to str
5
6Commit 7430959d4ad17db89b8387c3aef58c8b230cad10 from
7https://github.com/openvswitch/ovs.git
8
9When transitioning from python2 to python3 the following type class
10changes occured:
11
12python2 -> python3
13unicode -> str
14str -> bytes
15
16That means we have to check the python version and do the right type
17check python3 will throw an error when it tries to use the unicode
18type because it doesn't exist.
19
20Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
21Signed-off-by: Ben Pfaff <blp@ovn.org>
22---
23 ovsdb/ovsdb-doc | 12 +++++++++---
24 1 file changed, 9 insertions(+), 3 deletions(-)
25
26diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc
27index 918e88a..406c293 100755
28--- a/ovsdb/ovsdb-doc
29+++ b/ovsdb/ovsdb-doc
30@@ -65,9 +65,15 @@ def columnGroupToNroff(table, groupXml, documented_columns):
31 if node.hasAttribute('type'):
32 type_string = node.attributes['type'].nodeValue
33 type_json = ovs.json.from_string(str(type_string))
34- if type(type_json) in (str, unicode):
35- raise error.Error("%s %s:%s has invalid 'type': %s"
36- % (table.name, name, key, type_json))
37+ # py2 -> py3 means str -> bytes and unicode -> str
38+ try:
39+ if type(type_json) in (str, unicode):
40+ raise error.Error("%s %s:%s has invalid 'type': %s"
41+ % (table.name, name, key, type_json))
42+ except:
43+ if type(type_json) in (bytes, str):
44+ raise error.Error("%s %s:%s has invalid 'type': %s"
45+ % (table.name, name, key, type_json))
46 type_ = ovs.db.types.BaseType.from_json(type_json)
47 else:
48 type_ = column.type.value
49--
502.5.0
51