From b5153b5f8a5a14f342f4493847a667d72e1a8def Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 29 Aug 2018 18:43:57 +0300 Subject: [PATCH] Procedure of help generation is modified --- doc/gui/build_index.py | 33 +++++++++++++++++------- src/PythonAddons/doc/PythonAddons.rst | 3 --- src/PythonAddons/doc/addons_Features.rst | 10 +++++++ 3 files changed, 33 insertions(+), 13 deletions(-) delete mode 100644 src/PythonAddons/doc/PythonAddons.rst create mode 100644 src/PythonAddons/doc/addons_Features.rst diff --git a/doc/gui/build_index.py b/doc/gui/build_index.py index 343634f6a..155db3582 100755 --- a/doc/gui/build_index.py +++ b/doc/gui/build_index.py @@ -34,6 +34,16 @@ aSrcPath = aSourcesDir + os.sep + "../../src" aConfigPath = aSrcPath + os.sep + "Config/plugins.xml.in" +def findDir(theConfFile): + """Find a name of a directory where the given config file exists""" + aSrcList = os.listdir(aSrcPath) + for aDir in aSrcList: + aPath = aSrcPath + os.sep + aDir + aConfPath = aPath + os.sep + theConfFile + if os.path.isdir(aPath) and (os.path.exists(aConfPath) or os.path.exists(aConfPath + ".in")): + return aDir + return None + ## Find accessible plugins from plugins.xml configuration file aPluginList = [] aDomObj = parse(aConfigPath) @@ -42,16 +52,19 @@ for plugin in aPluginsList: aLibName = plugin.getAttribute("library") if not aLibName: aLibName = plugin.getAttribute("script") + aConfigFile = plugin.getAttribute("configuration") - if aLibName: - aPluginDocDir = aSrcPath + os.sep + aLibName + os.sep + "doc" - aDocDist = aBuildDir + os.sep + aLibName - if os.path.exists(aPluginDocDir): - ## Copy all files to a building directory - if os.path.exists(aDocDist): - shutil.rmtree(aDocDist) - shutil.copytree(aPluginDocDir, aDocDist) - aPluginList.append(aLibName) + if aLibName and aConfigFile: + aLibDir = findDir(aConfigFile) + if not aLibDir is None: + aPluginDocDir = aSrcPath + os.sep + aLibDir + os.sep + "doc" + if os.path.exists(aPluginDocDir): + ## Copy all files to a building directory + aDocDist = aBuildDir + os.sep + aLibName + if os.path.exists(aDocDist): + shutil.rmtree(aDocDist) + shutil.copytree(aPluginDocDir, aDocDist) + aPluginList.append(aLibName) ## Modify index.rst file accordingly aIndexFile = open(aSourcesDir + os.sep + "index.rst.in", 'r') @@ -65,4 +78,4 @@ for aLibName in aPluginList: aNewIndex = open(aBuildDir + os.sep + "index.rst", 'w') aNewIndex.writelines(aIndexLines) -aNewIndex.close() \ No newline at end of file +aNewIndex.close() diff --git a/src/PythonAddons/doc/PythonAddons.rst b/src/PythonAddons/doc/PythonAddons.rst deleted file mode 100644 index 3480bd54e..000000000 --- a/src/PythonAddons/doc/PythonAddons.rst +++ /dev/null @@ -1,3 +0,0 @@ - -Python addons -============= \ No newline at end of file diff --git a/src/PythonAddons/doc/addons_Features.rst b/src/PythonAddons/doc/addons_Features.rst new file mode 100644 index 000000000..2b9edc059 --- /dev/null +++ b/src/PythonAddons/doc/addons_Features.rst @@ -0,0 +1,10 @@ + +Python addons +============= + +.. toctree:: + :titlesonly: + :maxdepth: 1 + + boxFeature.rst + rectangleFeature.rst -- 2.39.2