meta-virtualization/recipes-networking/openvswitch/openvswitch-git/0005-Python3-compatibility-fix-integer-problems.patch
Mark Asselstine f0f0453984 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>
2017-07-13 10:54:49 -04:00

52 lines
1.7 KiB
Diff

From bc29f98f0137fa1083a4cacf832d52f740d150a8 Mon Sep 17 00:00:00 2001
From: Jason Wessel <jason.wessel@windriver.com>
Date: Thu, 29 Jun 2017 20:33:23 -0700
Subject: [PATCH 5/8] Python3 compatibility: fix integer problems
Commit fa145f1a53943243f94a32ce98525db8494b0052 from
https://github.com/openvswitch/ovs.git
In python3 maxint is not defined, but maxsize is defined in both
python2 and python3.
The put_text() will not automatically use a value which came in as
float due to a pior math function and python3 will throw an exception.
The simple answer is to convert it with int() and move on.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
---
ovsdb/ovsdb-idlc.in | 2 +-
python/build/nroff.py | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
index 615548f..7cbcbf5 100755
--- a/ovsdb/ovsdb-idlc.in
+++ b/ovsdb/ovsdb-idlc.in
@@ -358,7 +358,7 @@ static void
print(" %s" % type.value.initCDefault(valueVar, type.n_min == 0))
print(" }")
else:
- if type.n_max != sys.maxint:
+ if type.n_max != sys.maxsize:
print(" size_t n = MIN(%d, datum->n);" % type.n_max)
nMax = "n"
else:
diff --git a/python/build/nroff.py b/python/build/nroff.py
index c23837f..401f699 100644
--- a/python/build/nroff.py
+++ b/python/build/nroff.py
@@ -148,6 +148,8 @@ def fatal(msg):
def put_text(text, x, y, s):
+ x = int(x)
+ y = int(y)
extend = x + len(s) - len(text[y])
if extend > 0:
text[y] += ' ' * extend
--
2.5.0