summaryrefslogtreecommitdiff
path: root/giscanner/girwriter.py
diff options
context:
space:
mode:
Diffstat (limited to 'giscanner/girwriter.py')
-rw-r--r--giscanner/girwriter.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
index 0df87ed4..e73dcaca 100644
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -82,17 +82,12 @@ class GIRWriter(XMLWriter):
# We define a custom sorting function here because
# we want aliases to be first. They're a bit
# special because the typelib compiler expands them.
- def nscmp(a, b):
- if isinstance(a, ast.Alias):
- if isinstance(b, ast.Alias):
- return cmp(a.name, b.name)
- else:
- return -1
- elif isinstance(b, ast.Alias):
- return 1
+ def nscmp(val):
+ if isinstance(val, ast.Alias):
+ return 0, val
else:
- return cmp(a, b)
- for node in sorted(namespace.values(), cmp=nscmp):
+ return 1, val
+ for node in sorted(namespace.values(), key=nscmp):
self._write_node(node)
def _write_node(self, node):