From e98e758b5f6b69ce7502212aaa0abb434f78f5c1 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Thu, 18 Aug 2022 22:36:46 +0200 Subject: [PATCH 1/2] Fix missing version bump --- CHANGELOG.md | 2 +- sample/nwProject.nwx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 036c0bc7..d305d045 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # novelWriter Changelog -## Version 1.6.2 [2022-08-18] +## Version 1.6.3 [2022-08-18] ### Release Notes diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index 5be5d7af..a10e032e 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,13 +1,13 @@ - + Sample Project Sample Project Jane Smith Jay Doh - 1302 + 1304 199 - 64999 + 65055 False From d4878525accd5e54c9559b02a57153df79bbe88b Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Thu, 18 Aug 2022 22:38:32 +0200 Subject: [PATCH 2/2] Improve the package build pipeline --- setup.py | 109 +++++++++++++++++++++++++++++++++++------- setup/make_release.sh | 7 +++ 2 files changed, 98 insertions(+), 18 deletions(-) diff --git a/setup.py b/setup.py index 44d5cb1f..fcd18531 100755 --- a/setup.py +++ b/setup.py @@ -223,23 +223,20 @@ def buildPdfManual(): buildFile = os.path.join("docs", "build", "latex", "manual.pdf") finalFile = os.path.join("novelwriter", "assets", "manual.pdf") + if os.path.isfile(finalFile): + # Make sure a new file is always generated + os.unlink(finalFile) + try: subprocess.call(["make", "clean"], cwd="docs") - stdOut, stdErr, exCode = sysCall(["make latexpdf"], cwd="docs") + exCode = subprocess.call(["make", "latexpdf"], cwd="docs") if exCode == 0: if os.path.isfile(finalFile): os.unlink(finalFile) - outLines = stdOut.splitlines() - for aLine in outLines: - if aLine.startswith("processing manual.tex..."): - break - print(aLine) - print("\n[LaTeX output truncated ...]\n") - print("\n".join(outLines[-6:])) print("") os.rename(buildFile, finalFile) else: - raise Exception(stdErr) + raise Exception(f"Build returned error code {exCode}") print("PDF manual build: OK") print("") @@ -254,6 +251,13 @@ def buildPdfManual(): print(" * Package latexmk") print(" * LaTeX build system") print("") + print(" On Debian/Ubuntu, install: python3-sphinx latexmk texlive texlive-latex-extra") + print("") + sys.exit(1) + + if not os.path.isfile(finalFile): + print("No output file was found!") + print("") sys.exit(1) return @@ -431,6 +435,63 @@ def buildSampleZip(): return +def cleanBuiltAssets(): + """Remove assets built by this script. + """ + print("") + print("Removing Built Assets") + print("=====================") + print("") + + sampleZip = os.path.join("novelwriter", "assets", "sample.zip") + if os.path.isfile(sampleZip): + print(f"Deleted: {sampleZip}") + os.unlink(sampleZip) + + pdfManual = os.path.join("novelwriter", "assets", "manual.pdf") + if os.path.isfile(pdfManual): + print(f"Deleted: {pdfManual}") + os.unlink(pdfManual) + + i18nAssets = os.path.join("novelwriter", "assets", "i18n") + for i18nItem in os.listdir(i18nAssets): + i18nPath = os.path.join(i18nAssets, i18nItem) + if os.path.isfile(i18nPath) and i18nPath.endswith(".qm"): + print(f"Deleted: {i18nPath}") + os.unlink(i18nPath) + + print("") + + return + + +def checkAssetsExist(): + """Check that the necessary compiled assets exist ahead of a build. + """ + hasSample = False + hasManual = False + hasQmData = False + + sampleZip = os.path.join("novelwriter", "assets", "sample.zip") + if os.path.isfile(sampleZip): + print(f"Found: {sampleZip}") + hasSample = True + + pdfManual = os.path.join("novelwriter", "assets", "manual.pdf") + if os.path.isfile(pdfManual): + print(f"Found: {pdfManual}") + hasManual = True + + i18nAssets = os.path.join("novelwriter", "assets", "i18n") + for i18nItem in os.listdir(i18nAssets): + i18nPath = os.path.join(i18nAssets, i18nItem) + if os.path.isfile(i18nPath) and i18nPath.endswith(".qm"): + print(f"Found: {i18nPath}") + hasQmData = True + + return hasSample and hasManual and hasQmData + + # =============================================================================================== # # Python Packaging # =============================================================================================== # @@ -506,12 +567,12 @@ def makeMinimalPackage(targetOS): targName = "" print("") - # Build Additional Assets + # Check Additional Assets # ======================= - buildQtI18n() - buildSampleZip() - buildPdfManual() + if not checkAssetsExist(): + print("ERROR: Missing build assets") + sys.exit(1) # Build Minimal Zip # ================= @@ -603,6 +664,7 @@ def makeDebianPackage(signKey=None, sourceBuild=False, distName="unstable", buil print("") print("Build Debian Package") print("====================") + print("On Debian/Ubuntu install: dh-python python3-all debhelper devscripts") print("") # Version Info @@ -636,12 +698,12 @@ def makeDebianPackage(signKey=None, sourceBuild=False, distName="unstable", buil os.mkdir(outDir) - # Build Additional Assets + # Check Additional Assets # ======================= - buildQtI18n() - buildSampleZip() - buildPdfManual() + if not checkAssetsExist(): + print("ERROR: Missing build assets") + sys.exit(1) # Copy novelWriter Source # ======================= @@ -788,7 +850,6 @@ def makeForLaunchpad(doSign=False, isFirst=False, isSnapshot=False): distLoop = [ ("18.04", "bionic"), ("20.04", "focal"), - ("21.10", "impish"), ("22.04", "jammy"), ] @@ -1057,6 +1118,13 @@ def makeWindowsEmbedded(sysArgs): print(str(exc)) sys.exit(1) + issName = os.path.join("dist", f"novelwriter-{packVersion}-win10-amd64-setup.exe") + newName = os.path.join("dist", f"novelwriter-{packVersion}-py{pyVers}-win10-amd64-setup.exe") + os.replace(issName, newName) + + print(f"Installer: {newName}") + print("") + return @@ -1567,6 +1635,7 @@ if __name__ == "__main__": " qtlupdate Update translation files for internationalisation.", " The files to be updated must be provided as arguments.", " qtlrelease Build the language files for internationalisation.", + " clean-assets Delete assets built by manual, sample and qtlrelease.", "", "Python Packaging:", "", @@ -1643,6 +1712,10 @@ if __name__ == "__main__": sys.argv.remove("sample") buildSampleZip() + if "clean-assets" in sys.argv: + sys.argv.remove("clean-assets") + cleanBuiltAssets() + # Python Packaging # ================ diff --git a/setup/make_release.sh b/setup/make_release.sh index be75b962..98b142e6 100755 --- a/setup/make_release.sh +++ b/setup/make_release.sh @@ -6,6 +6,13 @@ if [ ! -f setup.py ]; then exit 1 fi +echo "" +echo " Building Dependencies" +echo "================================================================================" +echo "" +python3 setup.py clean-assets +python3 setup.py qtlrelease manual sample + echo "" echo " Building Minimal Packages" echo "================================================================================"