summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2015-05-18 19:46:13 +0200
committerGuido Günther <agx@sigxcpu.org>2015-05-20 19:03:04 +0200
commit06e8ea4702a3b054f4cc5a05dea9f9133a29c8d5 (patch)
tree41f33b2f1e4c78ca19788ce81539d10a68a61613
parent25448b07b1d838781e6ff8016f48eac873f5644d (diff)
downloadlibvirt-python-06e8ea4702a3b054f4cc5a05dea9f9133a29c8d5.tar.gz
Sort tuples on both items
In order to achieve reproducible builds[0] we want the items within enums always generated in the same order so sort on both items in the tuple. [0] https://wiki.debian.org/ReproducibleBuilds/About
-rwxr-xr-xgenerator.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/generator.py b/generator.py
index 861f166..676243c 100755
--- a/generator.py
+++ b/generator.py
@@ -1852,7 +1852,7 @@ def buildWrappers(module):
value = int(value)
except ValueError:
value = float('inf')
- return value
+ return value, data[0]
# Resolve only one level of reference
def resolveEnum(enum, data):
@@ -1990,7 +1990,7 @@ def qemuBuildWrappers(module):
for type,enum in sorted(qemu_enums.items()):
fd.write("# %s\n" % type)
items = list(enum.items())
- items.sort(key=lambda i: int(i[1]))
+ items.sort(key=lambda i: (int(i[1]), i[0]))
for name,value in items:
fd.write("%s = %s\n" % (name,value))
fd.write("\n")
@@ -2103,7 +2103,7 @@ def lxcBuildWrappers(module):
for type,enum in sorted(lxc_enums.items()):
fd.write("# %s\n" % type)
items = list(enum.items())
- items.sort(key=lambda i: int(i[1]))
+ items.sort(key=lambda i: (int(i[1]), i[0]))
for name,value in items:
fd.write("%s = %s\n" % (name,value))
fd.write("\n")