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