File 0001-ovsdb-Use-items-instead-of-iteritems-for-Python3.patch of Package openvswitch
From 6915bc7e414fc8d8bd4890d7126f5c055b5b1e29 Mon Sep 17 00:00:00 2001
From: Markos Chandras <mchandras@suse.de>
Date: Wed, 27 Dec 2017 18:27:10 +0000
Subject: [PATCH branch-2.8 1/4] ovsdb: Use items() instead of iteritems() for
Python3
Python3 removed the iteritems() iterator and replaced it with items()
which should also work in Python2. This fixes the following build
problem on Python3:
Traceback (most recent call last):
File "./ovsdb/ovsdb-idlc.in", line 1436, in <module>
func(*args[1:])
File "./ovsdb/ovsdb-idlc.in", line 314, in printCIDLHeader
for columnName, column in sorted(table.columns.iteritems()):
AttributeError: 'dict' object has no attribute 'iteritems'
Signed-off-by: Markos Chandras <mchandras@suse.de>
---
ovsdb/ovsdb-dot.in | 4 ++--
ovsdb/ovsdb-idlc.in | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/ovsdb/ovsdb-dot.in b/ovsdb/ovsdb-dot.in
index 134ce2269..f7b7ab0db 100755
--- a/ovsdb/ovsdb-dot.in
+++ b/ovsdb/ovsdb-dot.in
@@ -46,14 +46,14 @@ def schemaToDot(schemaFile, arrows):
print "\tnode [shape=box];"
if not arrows:
print "\tedge [dir=none, arrowhead=none, arrowtail=none];"
- for tableName, table in schema.tables.iteritems():
+ for tableName, table in schema.tables.items():
options = {}
if table.is_root:
options['style'] = 'bold'
print "\t%s [%s];" % (
tableName,
', '.join(['%s=%s' % (k,v) for k,v in options.items()]))
- for columnName, column in table.columns.iteritems():
+ for columnName, column in table.columns.items():
if column.type.value:
printEdge(tableName, column.type, column.type.key, "%s key" % columnName)
printEdge(tableName, column.type, column.type.value, "%s value" % columnName)
diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
index f065ef1c6..7e1c36d1f 100755
--- a/ovsdb/ovsdb-idlc.in
+++ b/ovsdb/ovsdb-idlc.in
@@ -281,7 +281,7 @@ bool %(s)s_is_updated(const struct %(s)s *, enum %(s)s_column_id);
# Table indexes.
print("struct %(s)s * %(s)s_index_init_row(struct ovsdb_idl *, const struct ovsdb_idl_table_class *);" % {'s': structName})
print
- for columnName, column in sorted(table.columns.iteritems()):
+ for columnName, column in sorted(table.columns.items()):
print('void %(s)s_index_set_%(c)s(const struct %(s)s *,' % {'s': structName, 'c': columnName})
if column.type.is_smap():
args = ['const struct smap *']
@@ -1030,7 +1030,7 @@ void
struct %(s)s *
%(s)s_index_init_row(struct ovsdb_idl *idl, const struct ovsdb_idl_table_class *class)
{""" % {'s': structName, 't': tableName})
- #for columnName, column in sorted(table.columns.iteritems()):
+ #for columnName, column in sorted(table.columns.items()):
# if column.type.is_smap():
# print " smap_init(&row->%s);" % columnName
print(" return (struct %(s)s *) ovsdb_idl_index_init_row(idl, class);" % {'s': structName, 't': tableName})
@@ -1097,7 +1097,7 @@ struct %(s)s *
return %(s)s_cast(ovsdb_idl_index_data(CONST_CAST(struct ovsdb_idl_index_cursor *, cursor)));
}""" % { 's' : structName })
# Indexes Set functions
- for columnName, column in sorted(table.columns.iteritems()):
+ for columnName, column in sorted(table.columns.items()):
type = column.type
comment, members = cMembers(prefix, tableName, columnName,
--
2.16.2