diff options
author | Mark Asselstine <mark.asselstine@windriver.com> | 2017-07-12 17:02:42 -0400 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2017-07-13 10:54:49 -0400 |
commit | f0f0453984192fd1b250785d2088a84733065c28 (patch) | |
tree | aaffa0ce19816af43f5a1ced614bf9b6c255c5e8 /recipes-networking/openvswitch/openvswitch-git/0007-Python3-compatibility-unicode-to-str.patch | |
parent | 165ffabe8933d2e44074d67921ea465eab4d90cb (diff) | |
download | meta-virtualization-f0f0453984192fd1b250785d2088a84733065c28.tar.gz |
openvswitch: backport py3 fixups
While attempting to get ovs to be built and run with py3 (completely
free of py2) host contamination was found (builds on hosts without
python-six installed would fail). It was also determined that pyc
files were still being generated with py2 and not py3. This resulted
in more work being done to achieve the desired results. This work was
sent upstream and subsequently merged. Unfortunately this didn't make
v2.7.1 and may not be available until the next major release, so here
we backport these commits and adjust the recipe to get a clean py3
only build.
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
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 | 51 |
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 @@ | |||
1 | From 2fe58f87b00d0ec24d6997930d0bcdb130c84396 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 7/8] 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 | ovsdb/ovsdb-doc | 12 +++++++++--- | ||
24 | 1 file changed, 9 insertions(+), 3 deletions(-) | ||
25 | |||
26 | diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc | ||
27 | index 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 | -- | ||
50 | 2.5.0 | ||
51 | |||