summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@npb.mail.kapsi.fi>2011-09-01 08:30:48 +0000
committerPetteri Aimonen <jpa@npb.mail.kapsi.fi>2011-09-01 08:30:48 +0000
commit35814517ad9da0edad3905269ea41facfb120f3c (patch)
tree68cef3a399b9a8348a4758dddd73a1fdecdfc2da
parent16040007143f30904813986778b1b3e1d687e40e (diff)
Python 2.6 compatibility for the generator
git-svn-id: https://svn.kapsi.fi/jpa/nanopb@973 e3a754e5-d11d-0410-8d38-ebb782a927b9
-rw-r--r--generator/nanopb_generator.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
index 67c422d..22331f0 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
+