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
|
||||
/docs/build/
|
||||
/novelwriter/assets/help/html/
|
||||
/novelwriter/assets/help/manual.pdf
|
||||
/UserManual.pdf
|
||||
/novelwriter/assets/help/
|
||||
/novelwriter/assets/manual.pdf
|
||||
*.qch
|
||||
*.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
|
||||
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
|
||||
|
||||
|
||||
@@ -302,6 +302,7 @@ class Config:
|
||||
# Internationalisation
|
||||
self.nwLangPath = os.path.join(self.assetPath, "i18n")
|
||||
|
||||
logger.debug("Assets: %s", self.assetPath)
|
||||
logger.verbose("App path: %s", self.appPath)
|
||||
logger.verbose("Last path: %s", self.lastPath)
|
||||
|
||||
@@ -358,14 +359,10 @@ class Config:
|
||||
self.spellLanguage = "en"
|
||||
|
||||
# Look for a PDF version of the manual
|
||||
lookIn = [
|
||||
os.path.join(self.assetPath, "help", "manual.pdf"),
|
||||
os.path.join(self.appRoot, "UserManual.pdf"),
|
||||
]
|
||||
for pdfDocs in lookIn:
|
||||
if os.path.isfile(pdfDocs):
|
||||
self.pdfDocs = pdfDocs
|
||||
break
|
||||
pdfDocs = os.path.join(self.assetPath, "manual.pdf")
|
||||
if os.path.isfile(pdfDocs):
|
||||
logger.debug("Found manual: %s", pdfDocs)
|
||||
self.pdfDocs = pdfDocs
|
||||
|
||||
logger.debug("Config initialisation complete")
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ name = novelWriter
|
||||
version = attr: novelwriter.__version__
|
||||
author = Veronica Berglyd Olsen
|
||||
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
|
||||
long_description = file: setup/long_description.md
|
||||
long_description_content_type = text/markdown
|
||||
@@ -41,9 +41,9 @@ exclude = docs, tests, sample
|
||||
|
||||
[options.entry_points]
|
||||
console_script =
|
||||
novelWriter-cli = novelwriter:main
|
||||
novelwriter-cli = novelwriter:main
|
||||
gui_scripts =
|
||||
novelWriter = novelwriter:main
|
||||
novelwriter = novelwriter:main
|
||||
|
||||
[bdist_wheel]
|
||||
universal = 0
|
||||
|
||||
@@ -233,77 +233,41 @@ def buildQtDocs():
|
||||
# Html or PDF Documentation Builder (docs, docs_pdf)
|
||||
##
|
||||
|
||||
def buildLocalDocs(bldFmt="HTML"):
|
||||
"""This function will build the Sphinx HTML or PDF documentation.
|
||||
For HTML, the files are copied into the novelwriter/assets/help/html
|
||||
directory and can be included in builds.
|
||||
def buildPdfManual():
|
||||
"""This function will build the documentation as manual.pdf.
|
||||
"""
|
||||
print("")
|
||||
print("Building Documentation")
|
||||
print("======================")
|
||||
print("Format: %s" % bldFmt)
|
||||
print("Building PDF Manual")
|
||||
print("===================")
|
||||
print("")
|
||||
|
||||
if bldFmt == "HTML":
|
||||
buildDir = os.path.join("docs", "build", "html")
|
||||
elif bldFmt == "PDF":
|
||||
buildDir = os.path.join("docs", "build", "latex")
|
||||
else:
|
||||
print("Docs Build Error:")
|
||||
return
|
||||
buildFile = os.path.join("docs", "build", "latex", "manual.pdf")
|
||||
finalFile = os.path.join("novelwriter", "assets", "manual.pdf")
|
||||
|
||||
buildFail = False
|
||||
try:
|
||||
subprocess.call(["make", "-C", "docs", "clean"])
|
||||
if bldFmt == "HTML":
|
||||
subprocess.call(["make", "-C", "docs", "html"])
|
||||
elif bldFmt == "PDF":
|
||||
_, stdErr, exCode = sysCall(["make -C docs latexpdf"])
|
||||
if exCode == 0:
|
||||
print("Sphinx LaTeX PDF build OK")
|
||||
else:
|
||||
raise Exception(stdErr)
|
||||
_, stdErr, exCode = sysCall(["make -C docs latexpdf"])
|
||||
if exCode == 0:
|
||||
if os.path.isfile(finalFile):
|
||||
os.unlink(finalFile)
|
||||
os.rename(buildFile, finalFile)
|
||||
else:
|
||||
raise Exception(stdErr)
|
||||
|
||||
print("PDF manual build: OK")
|
||||
print("")
|
||||
|
||||
except Exception as e:
|
||||
print("Docs Build Error:")
|
||||
print("PDF manual build: FAILED")
|
||||
print("")
|
||||
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("Dependencies:")
|
||||
print(" * pip install sphinx")
|
||||
if bldFmt == "HTML":
|
||||
print(" * pip install sphinx-rtd-theme")
|
||||
elif bldFmt == "PDF":
|
||||
print(" * Package latexmk")
|
||||
print(" * LaTeX build system")
|
||||
print(" * Package latexmk")
|
||||
print(" * LaTeX build system")
|
||||
print("")
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("Documentation build: OK")
|
||||
print("")
|
||||
|
||||
return
|
||||
|
||||
@@ -438,7 +402,7 @@ def makeMinimalPackage(targetOS):
|
||||
|
||||
# Build docs
|
||||
try:
|
||||
buildLocalDocs(bldFmt="PDF")
|
||||
buildPdfManual()
|
||||
except Exception as e:
|
||||
print("Failed with error:")
|
||||
print(str(e))
|
||||
@@ -477,18 +441,12 @@ def makeMinimalPackage(targetOS):
|
||||
if os.path.isfile(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 = [
|
||||
"CHANGELOG.md",
|
||||
"LICENSE.md",
|
||||
"README.md",
|
||||
"requirements.txt",
|
||||
"setup.py",
|
||||
"UserManual.pdf",
|
||||
]
|
||||
|
||||
with ZipFile(outFile, "w", compression=ZIP_DEFLATED, compresslevel=9) as zipObj:
|
||||
@@ -527,6 +485,9 @@ def makeMinimalPackage(targetOS):
|
||||
print("Adding File: %s" % aFile)
|
||||
zipObj.write(aFile)
|
||||
|
||||
zipObj.write(os.path.join("novelwriter", "assets", "manual.pdf"), "UserManual.pdf")
|
||||
print("Adding File: UserManual.pdf")
|
||||
|
||||
print("")
|
||||
print("Created File: %s" % outFile)
|
||||
|
||||
@@ -1246,8 +1207,7 @@ if __name__ == "__main__":
|
||||
"",
|
||||
"Additional Builds:",
|
||||
"",
|
||||
" htmldocs Build the help documentation as HTML.",
|
||||
" pdfdocs Build the help documentation as PDF (requires LaTeX).",
|
||||
" manual Build the help documentation as PDF (requires LaTeX).",
|
||||
" 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.",
|
||||
@@ -1314,13 +1274,9 @@ if __name__ == "__main__":
|
||||
# Additional Builds
|
||||
# =================
|
||||
|
||||
if "htmldocs" in sys.argv:
|
||||
sys.argv.remove("htmldocs")
|
||||
buildLocalDocs(bldFmt="HTML")
|
||||
|
||||
if "pdfdocs" in sys.argv:
|
||||
sys.argv.remove("pdfdocs")
|
||||
buildLocalDocs(bldFmt="PDF")
|
||||
if "manual" in sys.argv:
|
||||
sys.argv.remove("manual")
|
||||
buildPdfManual()
|
||||
|
||||
if "qthelp" in sys.argv:
|
||||
sys.argv.remove("qthelp")
|
||||
|
||||
Reference in New Issue
Block a user