blob: 54905cd0a7854fe335595ce8eb739dceeb4bc7d0 [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001From 3a9fcf1c8f60c160c282c9755ee1c7f9f7e113c3 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 6/8] Python3 compatibility: math error compatibility
5
6Commit 3fa5aa4294377e0f35267936d0c5caea3e61db48 from
7https://github.com/openvswitch/ovs.git
8
9The way math is handled with typing is completely different in python3.
10
11% python2<<EOF
12x=10
13y=8
14print((x + (y - 1)) / y * y)
15EOF
1616
17
18python3<<EOF
19x=10
20y=8
21print((x + (y - 1)) / y * y)
22EOF
2317.0
24
25So we need to force an integer for the round function as follows and
26maintain compatibility with python2.
27
28python3<<EOF
29x=10
30y=8
31print(int((x + (y - 1)) / y) * y)
32EOF
3316
34
35Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
36Signed-off-by: Ben Pfaff <blp@ovn.org>
37---
38 build-aux/extract-ofp-actions | 2 +-
39 1 file changed, 1 insertion(+), 1 deletion(-)
40
41diff --git a/build-aux/extract-ofp-actions b/build-aux/extract-ofp-actions
42index c11297c..bd7131f 100755
43--- a/build-aux/extract-ofp-actions
44+++ b/build-aux/extract-ofp-actions
45@@ -35,7 +35,7 @@ line = ""
46 arg_structs = set()
47
48 def round_up(x, y):
49- return (x + (y - 1)) / y * y
50+ return int((x + (y - 1)) / y) * y
51
52 def open_file(fn):
53 global file_name
54--
552.5.0
56