From 08723978e2e05e7be3055e50369423163fdba2b7 Mon Sep 17 00:00:00 2001 From: Lucian Teodorescu Date: Mon, 25 Jul 2016 17:08:25 +0300 Subject: [PATCH] doxygen: maintain order of lines in doxyfile The order of the lines in a doxyfile are important. This patch uses an ordered dictionary to keep the keys of the doxyfile in the same order. This is particularly important for doxyfiles that contain @INCLUDE lines. In such cases, if the dictionary is not ordered, the @INCLUDE line can end up in the middle of the generated doxyfile and thus override all entries that were seen before it. --- waflib/extras/doxygen.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/waflib/extras/doxygen.py b/waflib/extras/doxygen.py index 28f56e9c..423d8455 100644 --- a/waflib/extras/doxygen.py +++ b/waflib/extras/doxygen.py @@ -27,6 +27,7 @@ When using this tool, the wscript will look like: """ import os, os.path, re +from collections import OrderedDict from waflib import Task, Utils, Node from waflib.TaskGen import feature @@ -40,7 +41,13 @@ inc m mm py f90c cc cxx cpp c++ java ii ixx ipp i++ inl h hh hxx re_rl = re.compile('\\\\\r*\n', re.MULTILINE) re_nl = re.compile('\r*\n', re.M) def parse_doxy(txt): - tbl = {} + ''' + Parses a doxygen file. + Returns an ordered dictionary. We cannot return a default dictionary, as the + order in which the entries are reported does matter, especially for the + '@INCLUDE' lines. + ''' + tbl = OrderedDict() txt = re_rl.sub('', txt) lines = re_nl.split(txt) for x in lines: