[PATCH] doc: Various fixes to makedocbook for python3.8
Ken Brown
kbrown@cornell.edu
Sun Aug 23 15:23:24 GMT 2020
On 8/22/2020 2:45 PM, Jon Turney wrote:
> ---
> newlib/doc/makedocbook.py | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/newlib/doc/makedocbook.py b/newlib/doc/makedocbook.py
> index 92d0f279d..3fab26f1a 100755
> --- a/newlib/doc/makedocbook.py
> +++ b/newlib/doc/makedocbook.py
> @@ -199,6 +199,8 @@ def function(c, l):
> namelist = map(lambda v: re.sub('^and ', '', v.strip(), 1), namelist)
> # strip off << >> surrounding name
> namelist = map(lambda v: v.strip().lstrip('<').rstrip('>'), namelist)
> + # instantiate list to make it subscriptable
> + namelist = list(namelist)
>
> if verbose:
> print(namelist, file=sys.stderr)
> @@ -262,7 +264,7 @@ def index(c, l):
> primary.text = l
>
> # to validate, it seems we need to maintain refentry elements in a certain order
> - refentry[:] = sorted(refentry, key = lambda x: x.tag)
> + refentry[:] = sorted(refentry, key = lambda x: x.tag if isinstance(x.tag, str) else '')
>
> # adds another alternate refname
> refnamediv = refentry.find('refnamediv')
> @@ -807,7 +809,7 @@ def main(file):
> perform(processed)
>
> # output the XML tree
> - s = lxml.etree.tostring(rootelement, pretty_print=True)
> + s = lxml.etree.tostring(rootelement, pretty_print=True, encoding='unicode')
>
> if not s:
> print('No output produced (perhaps the input has no makedoc markup?)', file=sys.stderr)
> @@ -826,7 +828,7 @@ def main(file):
>
> if __name__ == '__main__' :
> options = OptionParser()
> - options.add_option('-v', '--verbose', action='count', dest = 'verbose')
> + options.add_option('-v', '--verbose', action='count', dest = 'verbose', default = 0)
> options.add_option('-c', '--cache', action='store_true', dest = 'cache', help="just ensure PLY cache is up to date")
> (opts, args) = options.parse_args()
>
>
Would it make sense to also change the shebang line so that makedocbook.py uses
python3? Currently the build of Cygwin on Fedora uses python3, but the build of
Cygwin on Cygwin uses python2. This is of no great importance, but a recent IRC
discussion shows that it can be confusing.
Ken
More information about the Newlib
mailing list