From 978b0093eaf5d4f64b17d3053626cb82cd036af0 Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Wed, 31 May 2017 20:00:20 +0200 Subject: [PATCH] mkdb: use six for python2/3 compat Use iteritems for the compat lib. Fixes #783215 --- README | 2 ++ gtkdoc/mkdb.py | 15 ++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/README b/README index 4b20e7c..6c89237 100644 --- a/README +++ b/README @@ -28,6 +28,8 @@ Requirements Python 2.7, 3.x - the secondary scripts are written in Python http:///www.python.org +Python-six - for python 2,3 compatibility + For XML output (recommended): The DocBook XML DTD. diff --git a/gtkdoc/mkdb.py b/gtkdoc/mkdb.py index 94f69ef..382ee4c 100644 --- a/gtkdoc/mkdb.py +++ b/gtkdoc/mkdb.py @@ -24,6 +24,7 @@ Creates the DocBook files from the source comments. """ from __future__ import print_function +from six import iteritems from collections import OrderedDict import logging @@ -1435,7 +1436,7 @@ def OutputStruct(symbol, declaration): ''' % sid - for field_name, text in fields.iteritems(): + for field_name, text in iteritems(fields): param_annotations = '' desc += "%s\n" % text @@ -1577,7 +1578,7 @@ def OutputUnion(symbol, declaration): ''' % sid - for field_name, text in fields.iteritems(): + for field_name, text in iteritems(fields): param_annotations = '' desc += "%s\n" % text @@ -1939,7 +1940,7 @@ def OutputParamDescriptions(symbol_type, symbol, fields): missing_parameters = '' unused_parameters = '' - for param_name, param_desc in params.iteritems(): + for param_name, param_desc in iteritems(params): (param_desc, param_annotations) = ExpandAnnotation(symbol, param_desc) param_desc = ConvertMarkDown(symbol, param_desc) # trim @@ -3689,7 +3690,7 @@ def ScanSourceFile(ifile, ignore_files): # Convert special characters description = ConvertSGMLChars(symbol, description) - for (param_name, param_desc) in params.iteritems(): + for (param_name, param_desc) in iteritems(params): params[param_name] = ConvertSGMLChars(symbol, param_desc) # Handle Section docs @@ -3704,7 +3705,7 @@ def ScanSourceFile(ifile, ignore_files): ifile, line_number, "Section %s is not defined in the %s-sections.txt file." % (real_symbol, MODULE)) logging.info("SECTION DOCS found in source for : '%s'", real_symbol) - for param_name, param_desc in params.iteritems(): + for param_name, param_desc in iteritems(params): logging.info(" '" + param_name + "'") param_name = param_name.lower() key = None @@ -3737,7 +3738,7 @@ def ScanSourceFile(ifile, ignore_files): section_id = None logging.info("PROGRAM DOCS found in source for '%s'", real_symbol) - for param_name, param_desc in params.iteritems(): + for param_name, param_desc in iteritems(params): logging.info("PROGRAM key %s: '%s'", real_symbol, param_name) param_name = param_name.lower() key = None @@ -4119,7 +4120,7 @@ def CheckParamsDocumented(symbol, params): if len(params) > 0: logging.info("params: %s", str(params)) - for (param_name, param_desc) in params.iteritems(): + for (param_name, param_desc) in iteritems(params): # Output a warning if the parameter is empty and remember for stats. if param_name != "void" and not re.search(r'\S', param_desc): if symbol in AllIncompleteSymbols: -- 2.11.4.GIT