Include HTML docs in minimal installs (#856)

* Link to stable docs for stable release, otherwise latest docs
* Add build command to setup for making HTML docs
* Change the documentation menu entry to open either online or local HTML
* Update docs build instructions in docs
This commit is contained in:
Veronica Berglyd Olsen
2021-08-18 00:13:28 +02:00
committed by GitHub
parent a9368904e5
commit eee0f5e4c9
7 changed files with 111 additions and 102 deletions
+63
View File
@@ -221,6 +221,56 @@ def buildQtDocs():
return
##
# Html Documentation Builder (docs)
##
def buildHtmlDocs():
"""This function will build the Sphinx HTML documentation. The files
are then copied into the nw/assets/help/html directory and can be
included in builds.
"""
buildDir = os.path.join("docs", "build", "html")
helpDir = os.path.join("nw", "assets", "help", "html")
print("")
print("Building Documentation")
print("======================")
print("")
buildFail = False
try:
subprocess.call(["make", "-C", "docs", "clean"])
subprocess.call(["make", "-C", "docs", "html"])
except Exception as e:
print("Docs Build Error:")
print(str(e))
buildFail = True
try:
if os.path.isdir(helpDir):
shutil.rmtree(helpDir)
shutil.copytree(buildDir, helpDir)
except Exception as e:
print("Docs Build Error:")
print(str(e))
buildFail = True
print("")
if buildFail:
print("Documentation build: FAILED")
print("")
print("Dependencies:")
print(" * pip install sphinx")
print(" * pip install sphinx-rtd-theme")
sys.exit(1)
else:
print("Documentation build: OK")
print("")
return
##
# Qt Linguist QM Builder (qtlrelease)
##
@@ -349,6 +399,14 @@ def makeMinimalPackage(targetOS):
print(str(e))
sys.exit(1)
# Build docs
try:
buildHtmlDocs()
except Exception as e:
print("Failed with error:")
print(str(e))
sys.exit(1)
# Make translation files
try:
buildQtI18n()
@@ -1137,6 +1195,7 @@ if __name__ == "__main__":
"",
"Additional Builds:",
"",
" docs Build the help documentation as HTML."
" qthelp Build the help documentation for use with the Qt Assistant.",
" qtlupdate Update the translation files for internationalisation.",
" qtlrelease Build the language files for internationalisation.",
@@ -1203,6 +1262,10 @@ if __name__ == "__main__":
# Additional Builds
# =================
if "docs" in sys.argv:
sys.argv.remove("docs")
buildHtmlDocs()
if "qthelp" in sys.argv:
sys.argv.remove("qthelp")
buildQtDocs()