From c83c041084a58b410e2bc969829a1238d3777fbc Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 6 Mar 2013 12:04:12 +0100
Subject: [PATCH] Fix build/sphinx_ext.py with tuple defaults for op params

When an OpCode's parameter has a tuple as default value, this code
will break:

  buf.write("defaults to ``%s``" % default)

The patch fixes this and other potential cases by always passing a
tuple to '%'.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
---
 lib/build/sphinx_ext.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/build/sphinx_ext.py b/lib/build/sphinx_ext.py
index d72bc9777..8b6c98d82 100644
--- a/lib/build/sphinx_ext.py
+++ b/lib/build/sphinx_ext.py
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2011, 2012 Google Inc.
+# Copyright (C) 2011, 2012, 2013 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -160,15 +160,15 @@ def _BuildOpcodeParams(op_id, include, exclude, alias):
     has_test = not (test is None or test is ht.NoType)
 
     buf = StringIO()
-    buf.write("``%s``" % rapi_name)
+    buf.write("``%s``" % (rapi_name,))
     if has_default or has_test:
       buf.write(" (")
       if has_default:
-        buf.write("defaults to ``%s``" % default)
+        buf.write("defaults to ``%s``" % (default,))
         if has_test:
           buf.write(", ")
       if has_test:
-        buf.write("must be ``%s``" % test)
+        buf.write("must be ``%s``" % (test,))
       buf.write(")")
     yield buf.getvalue()
 
@@ -329,8 +329,8 @@ def BuildValuesDoc(values):
   """
   for name, doc in values:
     assert len(doc.splitlines()) == 1
-    yield "``%s``" % name
-    yield "  %s" % doc
+    yield "``%s``" % (name,)
+    yield "  %s" % (doc,)
 
 
 def _ManPageNodeClass(*args, **kwargs):
-- 
GitLab