summaryrefslogtreecommitdiffstats
path: root/tools/product_debug.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/product_debug.py')
-rwxr-xr-xtools/product_debug.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/product_debug.py b/tools/product_debug.py
index ff2657c..891587f 100755
--- a/tools/product_debug.py
+++ b/tools/product_debug.py
@@ -14,10 +14,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import print_function
+
import os
import re
import sys
+
+def iteritems(obj):
+ if hasattr('iteritems'):
+ return obj.iteritems()
+ return obj.items()
+
+
def break_lines(key, val):
# these don't get split
if key in ("PRODUCT_MODEL"):
@@ -42,7 +51,7 @@ def parse_variables(lines):
def render_variables(variables):
variables = dict(variables)
del variables["FILE"]
- variables = list(variables.iteritems())
+ variables = list(variables.items())
variables.sort(lambda a, b: cmp(a[0], b[0]))
return ("<table id='variables'>"
+ "\n".join([ "<tr><th>%(key)s</th><td>%(val)s</td></tr>" % { "key": key, "val": val }
@@ -104,7 +113,7 @@ def main(argv):
"variables": render_variables(variables),
"original": render_original(variables, original),
})
- print """<html>
+ print("""<html>
<head>
@@ -153,7 +162,7 @@ def main(argv):
%(variables)s
</body>
</html>
-""" % values
+""" % values)
if __name__ == "__main__":
main(sys.argv)