Packaging Updates (#873)
* Make setup-generated script names lower case * Change how the manual.pdf file is handled
This commit is contained in:
committed by
GitHub
parent
a00d0820cc
commit
4b52f343c1
+2
-3
@@ -17,9 +17,8 @@ i18n/*.qph
|
|||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
/docs/build/
|
/docs/build/
|
||||||
/novelwriter/assets/help/html/
|
/novelwriter/assets/help/
|
||||||
/novelwriter/assets/help/manual.pdf
|
/novelwriter/assets/manual.pdf
|
||||||
/UserManual.pdf
|
|
||||||
*.qch
|
*.qch
|
||||||
*.qhc
|
*.qhc
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -75,7 +75,7 @@ will not be noticeable to you as a user, but you may notice that the exported do
|
|||||||
allow multiple consecutive spaces. Previously, two spaces, or more, would be concatenated into a
|
allow multiple consecutive spaces. Previously, two spaces, or more, would be concatenated into a
|
||||||
single space in the exported document.
|
single space in the exported document.
|
||||||
|
|
||||||
_These Release Notes also include the changes from 1.4 Beta 1._
|
_These Release Notes also include the changes from 1.5 Beta 1._
|
||||||
|
|
||||||
### Detailed Changelog
|
### Detailed Changelog
|
||||||
|
|
||||||
|
|||||||
@@ -302,6 +302,7 @@ class Config:
|
|||||||
# Internationalisation
|
# Internationalisation
|
||||||
self.nwLangPath = os.path.join(self.assetPath, "i18n")
|
self.nwLangPath = os.path.join(self.assetPath, "i18n")
|
||||||
|
|
||||||
|
logger.debug("Assets: %s", self.assetPath)
|
||||||
logger.verbose("App path: %s", self.appPath)
|
logger.verbose("App path: %s", self.appPath)
|
||||||
logger.verbose("Last path: %s", self.lastPath)
|
logger.verbose("Last path: %s", self.lastPath)
|
||||||
|
|
||||||
@@ -358,14 +359,10 @@ class Config:
|
|||||||
self.spellLanguage = "en"
|
self.spellLanguage = "en"
|
||||||
|
|
||||||
# Look for a PDF version of the manual
|
# Look for a PDF version of the manual
|
||||||
lookIn = [
|
pdfDocs = os.path.join(self.assetPath, "manual.pdf")
|
||||||
os.path.join(self.assetPath, "help", "manual.pdf"),
|
if os.path.isfile(pdfDocs):
|
||||||
os.path.join(self.appRoot, "UserManual.pdf"),
|
logger.debug("Found manual: %s", pdfDocs)
|
||||||
]
|
self.pdfDocs = pdfDocs
|
||||||
for pdfDocs in lookIn:
|
|
||||||
if os.path.isfile(pdfDocs):
|
|
||||||
self.pdfDocs = pdfDocs
|
|
||||||
break
|
|
||||||
|
|
||||||
logger.debug("Config initialisation complete")
|
logger.debug("Config initialisation complete")
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ name = novelWriter
|
|||||||
version = attr: novelwriter.__version__
|
version = attr: novelwriter.__version__
|
||||||
author = Veronica Berglyd Olsen
|
author = Veronica Berglyd Olsen
|
||||||
author_email = code@vkbo.net
|
author_email = code@vkbo.net
|
||||||
description = A markdown-like document editor for writing novels
|
description = A markdown-like text editor for planning and writing novels
|
||||||
url = https://novelwriter.io
|
url = https://novelwriter.io
|
||||||
long_description = file: setup/long_description.md
|
long_description = file: setup/long_description.md
|
||||||
long_description_content_type = text/markdown
|
long_description_content_type = text/markdown
|
||||||
@@ -41,9 +41,9 @@ exclude = docs, tests, sample
|
|||||||
|
|
||||||
[options.entry_points]
|
[options.entry_points]
|
||||||
console_script =
|
console_script =
|
||||||
novelWriter-cli = novelwriter:main
|
novelwriter-cli = novelwriter:main
|
||||||
gui_scripts =
|
gui_scripts =
|
||||||
novelWriter = novelwriter:main
|
novelwriter = novelwriter:main
|
||||||
|
|
||||||
[bdist_wheel]
|
[bdist_wheel]
|
||||||
universal = 0
|
universal = 0
|
||||||
|
|||||||
@@ -233,77 +233,41 @@ def buildQtDocs():
|
|||||||
# Html or PDF Documentation Builder (docs, docs_pdf)
|
# Html or PDF Documentation Builder (docs, docs_pdf)
|
||||||
##
|
##
|
||||||
|
|
||||||
def buildLocalDocs(bldFmt="HTML"):
|
def buildPdfManual():
|
||||||
"""This function will build the Sphinx HTML or PDF documentation.
|
"""This function will build the documentation as manual.pdf.
|
||||||
For HTML, the files are copied into the novelwriter/assets/help/html
|
|
||||||
directory and can be included in builds.
|
|
||||||
"""
|
"""
|
||||||
print("")
|
print("")
|
||||||
print("Building Documentation")
|
print("Building PDF Manual")
|
||||||
print("======================")
|
print("===================")
|
||||||
print("Format: %s" % bldFmt)
|
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
if bldFmt == "HTML":
|
buildFile = os.path.join("docs", "build", "latex", "manual.pdf")
|
||||||
buildDir = os.path.join("docs", "build", "html")
|
finalFile = os.path.join("novelwriter", "assets", "manual.pdf")
|
||||||
elif bldFmt == "PDF":
|
|
||||||
buildDir = os.path.join("docs", "build", "latex")
|
|
||||||
else:
|
|
||||||
print("Docs Build Error:")
|
|
||||||
return
|
|
||||||
|
|
||||||
buildFail = False
|
|
||||||
try:
|
try:
|
||||||
subprocess.call(["make", "-C", "docs", "clean"])
|
subprocess.call(["make", "-C", "docs", "clean"])
|
||||||
if bldFmt == "HTML":
|
_, stdErr, exCode = sysCall(["make -C docs latexpdf"])
|
||||||
subprocess.call(["make", "-C", "docs", "html"])
|
if exCode == 0:
|
||||||
elif bldFmt == "PDF":
|
if os.path.isfile(finalFile):
|
||||||
_, stdErr, exCode = sysCall(["make -C docs latexpdf"])
|
os.unlink(finalFile)
|
||||||
if exCode == 0:
|
os.rename(buildFile, finalFile)
|
||||||
print("Sphinx LaTeX PDF build OK")
|
else:
|
||||||
else:
|
raise Exception(stdErr)
|
||||||
raise Exception(stdErr)
|
|
||||||
|
print("PDF manual build: OK")
|
||||||
|
print("")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Docs Build Error:")
|
print("PDF manual build: FAILED")
|
||||||
|
print("")
|
||||||
print(str(e))
|
print(str(e))
|
||||||
buildFail = True
|
|
||||||
|
|
||||||
try:
|
|
||||||
helpDir = os.path.join("novelwriter", "assets", "help")
|
|
||||||
if not os.path.isdir(helpDir):
|
|
||||||
os.mkdir(helpDir)
|
|
||||||
|
|
||||||
if bldFmt == "HTML":
|
|
||||||
htmlDir = os.path.join(helpDir, "html")
|
|
||||||
if os.path.isdir(htmlDir):
|
|
||||||
shutil.rmtree(htmlDir)
|
|
||||||
shutil.copytree(buildDir, htmlDir)
|
|
||||||
elif bldFmt == "PDF":
|
|
||||||
os.rename(
|
|
||||||
os.path.join(buildDir, "manual.pdf"),
|
|
||||||
os.path.join(helpDir, "manual.pdf")
|
|
||||||
)
|
|
||||||
except Exception as e:
|
|
||||||
print("Docs Build Error:")
|
|
||||||
print(str(e))
|
|
||||||
buildFail = True
|
|
||||||
|
|
||||||
print("")
|
|
||||||
if buildFail:
|
|
||||||
print("Documentation build: FAILED")
|
|
||||||
print("")
|
print("")
|
||||||
print("Dependencies:")
|
print("Dependencies:")
|
||||||
print(" * pip install sphinx")
|
print(" * pip install sphinx")
|
||||||
if bldFmt == "HTML":
|
print(" * Package latexmk")
|
||||||
print(" * pip install sphinx-rtd-theme")
|
print(" * LaTeX build system")
|
||||||
elif bldFmt == "PDF":
|
print("")
|
||||||
print(" * Package latexmk")
|
|
||||||
print(" * LaTeX build system")
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
|
||||||
print("Documentation build: OK")
|
|
||||||
print("")
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -438,7 +402,7 @@ def makeMinimalPackage(targetOS):
|
|||||||
|
|
||||||
# Build docs
|
# Build docs
|
||||||
try:
|
try:
|
||||||
buildLocalDocs(bldFmt="PDF")
|
buildPdfManual()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Failed with error:")
|
print("Failed with error:")
|
||||||
print(str(e))
|
print(str(e))
|
||||||
@@ -477,18 +441,12 @@ def makeMinimalPackage(targetOS):
|
|||||||
if os.path.isfile(outFile):
|
if os.path.isfile(outFile):
|
||||||
os.unlink(outFile)
|
os.unlink(outFile)
|
||||||
|
|
||||||
# Add the manual also to the root
|
|
||||||
pdfDocs = os.path.join("novelwriter", "assets", "help", "manual.pdf")
|
|
||||||
if os.path.isfile(pdfDocs):
|
|
||||||
os.rename(pdfDocs, "UserManual.pdf")
|
|
||||||
|
|
||||||
rootFiles = [
|
rootFiles = [
|
||||||
"CHANGELOG.md",
|
"CHANGELOG.md",
|
||||||
"LICENSE.md",
|
"LICENSE.md",
|
||||||
"README.md",
|
"README.md",
|
||||||
"requirements.txt",
|
"requirements.txt",
|
||||||
"setup.py",
|
"setup.py",
|
||||||
"UserManual.pdf",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
with ZipFile(outFile, "w", compression=ZIP_DEFLATED, compresslevel=9) as zipObj:
|
with ZipFile(outFile, "w", compression=ZIP_DEFLATED, compresslevel=9) as zipObj:
|
||||||
@@ -527,6 +485,9 @@ def makeMinimalPackage(targetOS):
|
|||||||
print("Adding File: %s" % aFile)
|
print("Adding File: %s" % aFile)
|
||||||
zipObj.write(aFile)
|
zipObj.write(aFile)
|
||||||
|
|
||||||
|
zipObj.write(os.path.join("novelwriter", "assets", "manual.pdf"), "UserManual.pdf")
|
||||||
|
print("Adding File: UserManual.pdf")
|
||||||
|
|
||||||
print("")
|
print("")
|
||||||
print("Created File: %s" % outFile)
|
print("Created File: %s" % outFile)
|
||||||
|
|
||||||
@@ -1246,8 +1207,7 @@ if __name__ == "__main__":
|
|||||||
"",
|
"",
|
||||||
"Additional Builds:",
|
"Additional Builds:",
|
||||||
"",
|
"",
|
||||||
" htmldocs Build the help documentation as HTML.",
|
" manual Build the help documentation as PDF (requires LaTeX).",
|
||||||
" pdfdocs Build the help documentation as PDF (requires LaTeX).",
|
|
||||||
" qthelp Build the help documentation for use with the Qt Assistant.",
|
" qthelp Build the help documentation for use with the Qt Assistant.",
|
||||||
" qtlupdate Update the translation files for internationalisation.",
|
" qtlupdate Update the translation files for internationalisation.",
|
||||||
" qtlrelease Build the language files for internationalisation.",
|
" qtlrelease Build the language files for internationalisation.",
|
||||||
@@ -1314,13 +1274,9 @@ if __name__ == "__main__":
|
|||||||
# Additional Builds
|
# Additional Builds
|
||||||
# =================
|
# =================
|
||||||
|
|
||||||
if "htmldocs" in sys.argv:
|
if "manual" in sys.argv:
|
||||||
sys.argv.remove("htmldocs")
|
sys.argv.remove("manual")
|
||||||
buildLocalDocs(bldFmt="HTML")
|
buildPdfManual()
|
||||||
|
|
||||||
if "pdfdocs" in sys.argv:
|
|
||||||
sys.argv.remove("pdfdocs")
|
|
||||||
buildLocalDocs(bldFmt="PDF")
|
|
||||||
|
|
||||||
if "qthelp" in sys.argv:
|
if "qthelp" in sys.argv:
|
||||||
sys.argv.remove("qthelp")
|
sys.argv.remove("qthelp")
|
||||||
|
|||||||
Reference in New Issue
Block a user