From 35814517ad9da0edad3905269ea41facfb120f3c Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Thu, 1 Sep 2011 08:30:48 +0000 Subject: Python 2.6 compatibility for the generator git-svn-id: https://svn.kapsi.fi/jpa/nanopb@973 e3a754e5-d11d-0410-8d38-ebb782a927b9 --- generator/nanopb_generator.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py index 67c422d9..22331f0d 100644 --- a/generator/nanopb_generator.py +++ b/generator/nanopb_generator.py @@ -327,15 +327,15 @@ def toposort2(data): for k, v in data.items(): v.discard(k) # Ignore self dependencies extra_items_in_deps = reduce(set.union, data.values()) - set(data.keys()) - data.update({item:set() for item in extra_items_in_deps}) + data.update(dict([(item, set()) for item in extra_items_in_deps])) while True: ordered = set(item for item,dep in data.items() if not dep) if not ordered: break for item in sorted(ordered): yield item - data = {item: (dep - ordered) for item,dep in data.items() - if item not in ordered} + data = dict([(item, (dep - ordered)) for item,dep in data.items() + if item not in ordered]) assert not data, "A cyclic dependency exists amongst %r" % data def sort_dependencies(messages): @@ -426,4 +426,4 @@ if __name__ == '__main__': for part in generate_source(headerbasename, enums, messages): source.write(part) - \ No newline at end of file + -- cgit 1.2.3-korg