[libxcb,5/7] c_client.py: make the man page output deterministic

Submitted by Ran Benita on Feb. 23, 2014, 8:55 p.m.

Details

Message ID 1393188921-19614-6-git-send-email-ran234@gmail.com
State Accepted
Headers show

Not browsing as part of any series.

Commit Message

Ran Benita Feb. 23, 2014, 8:55 p.m.
Some parts of the man pages (SEE ALSO and ERRORS) are generated by
iterating a Python dict. But the iteration order in a dict is random,
so each build the output is ordered differently. Avoid that by iterating
in sorted order.

Signed-off-by: Ran Benita <ran234@gmail.com>
---
 src/c_client.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/c_client.py b/src/c_client.py
index 47b37b7..8e42203 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -2690,7 +2690,7 @@  def _man_request(self, name, cookie_type, void, aux):
                 (cookie_type, self.c_reply_name, base_func_name, section))
     f.write('.SH ERRORS\n')
     if hasattr(self, "doc") and self.doc:
-        for errtype, errtext in self.doc.errors.items():
+        for errtype, errtext in sorted(self.doc.errors.items()):
             f.write('.IP \\fI%s\\fP 1i\n' % (_t(('xcb', errtype, 'error'))))
             errtext = re.sub(r'`([^`]+)`', r'\\fI\1\\fP', errtext)
             f.write('%s\n' % (errtext))
@@ -2708,7 +2708,7 @@  def _man_request(self, name, cookie_type, void, aux):
         see = ['.BR %s (%s)' % ('xcb-requests', section)]
         if self.doc.example:
             see.append('.BR %s (%s)' % ('xcb-examples', section))
-        for seename, seetype in self.doc.see.items():
+        for seename, seetype in sorted(self.doc.see.items()):
             if seetype == 'program':
                 see.append('.BR %s (1)' % seename)
             elif seetype == 'event':
@@ -2838,7 +2838,7 @@  def _man_event(self, name):
         see = ['.BR %s (%s)' % ('xcb_generic_event_t', section)]
         if self.doc.example:
             see.append('.BR %s (%s)' % ('xcb-examples', section))
-        for seename, seetype in self.doc.see.items():
+        for seename, seetype in sorted(self.doc.see.items()):
             if seetype == 'program':
                 see.append('.BR %s (1)' % seename)
             elif seetype == 'event':