From bb01d0e5aed2ff927626c07269ff84d188e8dd4d Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sun, 14 Sep 2025 18:37:23 +0200 Subject: [PATCH 1/3] Fix debian build --- ...E-Apache-2.0.txt => LICENSE-Apache-2.0.txt | 0 pkgutils.py | 3 +-- pyproject.toml | 5 +---- utils/build_debian.py | 15 +++++++------- utils/common.py | 20 +++++++++++-------- 5 files changed, 22 insertions(+), 21 deletions(-) rename setup/LICENSE-Apache-2.0.txt => LICENSE-Apache-2.0.txt (100%) diff --git a/setup/LICENSE-Apache-2.0.txt b/LICENSE-Apache-2.0.txt similarity index 100% rename from setup/LICENSE-Apache-2.0.txt rename to LICENSE-Apache-2.0.txt diff --git a/pkgutils.py b/pkgutils.py index fd9ecf67..f71ea2f2 100755 --- a/pkgutils.py +++ b/pkgutils.py @@ -267,8 +267,7 @@ if __name__ == "__main__": cmdBuildUbuntu = parsers.add_parser( "build-ubuntu", help=( "Build a .deb package for Debian and Ubuntu. " - "Add --sign to sign package. " - "Add --first to set build number to 0." + "Add --sign to sign package." ) ) cmdBuildUbuntu.add_argument("--sign", action="store_true", help="Sign the package.") diff --git a/pyproject.toml b/pyproject.toml index 3610e012..9e4cf021 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,10 +10,7 @@ authors = [ description = "A plain text editor for planning and writing novels" readme = {file = "setup/description_pypi.md", content-type = "text/markdown"} license = "GPL-3.0-or-later AND Apache-2.0 AND CC-BY-4.0" -license-files = [ - "LICENSE.md", - "setup/LICENSE-Apache-2.0.txt", -] +license-files = ["LICENSE.md", "LICENSE-Apache-2.0.txt"] classifiers = [ "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.10", diff --git a/utils/build_debian.py b/utils/build_debian.py index e555ff95..a8cf9a05 100644 --- a/utils/build_debian.py +++ b/utils/build_debian.py @@ -36,7 +36,7 @@ SIGN_KEY = "D6A9F6B8F227CF7C6F6D1EE84DBBE4B734B0BD08" def makeDebianPackage( signKey: str | None = None, sourceBuild: bool = False, distName: str = "unstable", - buildName: str = "", forLaunchpad: bool = False + buildName: str = "", forLaunchpad: bool = False, oldLicense: bool = False, ) -> str: """Build a Debian package.""" print("") @@ -96,7 +96,7 @@ def makeDebianPackage( print("Copying or generating additional files ...") print("") - copyPackageFiles(outDir, setupPy=True) + copyPackageFiles(outDir, oldLicense=oldLicense) # Copy/Write Debian Files # ======================= @@ -181,14 +181,14 @@ def launchpad(args: argparse.Namespace) -> None: bldNum = "0" distLoop = [ - ("24.04", "noble"), - ("25.04", "plucky"), - ("25.10", "questing"), + ("24.04", "noble", True), + ("25.04", "plucky", True), + ("25.10", "questing", False), ] print("Building Ubuntu packages for:") print("") - for distNum, codeName in distLoop: + for distNum, codeName, _ in distLoop: print(f" * Ubuntu {distNum} {codeName.title()}") print("") @@ -198,7 +198,7 @@ def launchpad(args: argparse.Namespace) -> None: print("") dputCmd = [] - for distNum, codeName in distLoop: + for distNum, codeName, oldLicense in distLoop: buildName = f"ubuntu{distNum}.{bldNum}" dCmd = makeDebianPackage( signKey=signKey, @@ -206,6 +206,7 @@ def launchpad(args: argparse.Namespace) -> None: distName=codeName, buildName=buildName, forLaunchpad=True, + oldLicense=oldLicense, ) dputCmd.append(dCmd) diff --git a/utils/common.py b/utils/common.py index 1784ed01..95dcac28 100644 --- a/utils/common.py +++ b/utils/common.py @@ -91,27 +91,31 @@ def copySourceCode(dst: Path) -> None: return -def copyPackageFiles(dst: Path, setupPy: bool = False) -> None: +def copyPackageFiles(dst: Path, oldLicense: bool = False) -> None: """Copy files needed for packaging.""" - copyFiles = ["LICENSE.md", "CREDITS.md", "pyproject.toml"] + copyFiles = ["LICENSE.md", "LICENSE-Apache-2.0.txt", "CREDITS.md", "pyproject.toml"] for copyFile in copyFiles: shutil.copyfile(copyFile, dst / copyFile) print("Copied:", copyFile, flush=True) writeFile(dst / "MANIFEST.in", ( "include LICENSE.md\n" + "include LICENSE-Apache-2.0.txt\n" "include CREDITS.md\n" "recursive-include novelwriter/assets *\n" )) - if setupPy: - writeFile(dst / "setup.py", ( - "import setuptools\n" - "setuptools.setup()\n" - )) - text = readFile(ROOT_DIR / "pyproject.toml") text = text.replace("setup/description_pypi.md", "data/description_short.txt") + if oldLicense: + new = [] + for line in text.splitlines(): + if line.startswith("license = "): + line = 'license = {text = "GPL-3.0-or-later AND Apache-2.0 AND CC-BY-4.0"}' + if line.startswith("license-files = "): + continue + new.append(line) + text = "\n".join(new) writeFile(dst / "pyproject.toml", text) return From a37482aaad009ff95e4b91f48f91bde50c188203 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sun, 14 Sep 2025 18:54:42 +0200 Subject: [PATCH 2/3] Pin windows build to 2022 image --- .github/workflows/build_win.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_win.yml b/.github/workflows/build_win.yml index b9e96e9d..bee832c7 100644 --- a/.github/workflows/build_win.yml +++ b/.github/workflows/build_win.yml @@ -8,7 +8,7 @@ jobs: buildWin64: needs: buildAssets - runs-on: windows-latest + runs-on: windows-2022 steps: - name: Python Setup uses: actions/setup-python@v5 From f019a3cd0c42cef017ae5099effee5e68040c9b4 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sun, 14 Sep 2025 19:24:32 +0200 Subject: [PATCH 3/3] Move the Apache license file back to setup --- pyproject.toml | 2 +- LICENSE-Apache-2.0.txt => setup/LICENSE-Apache-2.0.txt | 0 utils/common.py | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) rename LICENSE-Apache-2.0.txt => setup/LICENSE-Apache-2.0.txt (100%) diff --git a/pyproject.toml b/pyproject.toml index 9e4cf021..15736ca4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ authors = [ description = "A plain text editor for planning and writing novels" readme = {file = "setup/description_pypi.md", content-type = "text/markdown"} license = "GPL-3.0-or-later AND Apache-2.0 AND CC-BY-4.0" -license-files = ["LICENSE.md", "LICENSE-Apache-2.0.txt"] +license-files = ["LICENSE.md", "setup/LICENSE-Apache-2.0.txt"] classifiers = [ "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.10", diff --git a/LICENSE-Apache-2.0.txt b/setup/LICENSE-Apache-2.0.txt similarity index 100% rename from LICENSE-Apache-2.0.txt rename to setup/LICENSE-Apache-2.0.txt diff --git a/utils/common.py b/utils/common.py index 95dcac28..09d937b1 100644 --- a/utils/common.py +++ b/utils/common.py @@ -93,14 +93,14 @@ def copySourceCode(dst: Path) -> None: def copyPackageFiles(dst: Path, oldLicense: bool = False) -> None: """Copy files needed for packaging.""" - copyFiles = ["LICENSE.md", "LICENSE-Apache-2.0.txt", "CREDITS.md", "pyproject.toml"] + copyFiles = ["LICENSE.md", "setup/LICENSE-Apache-2.0.txt", "CREDITS.md", "pyproject.toml"] for copyFile in copyFiles: shutil.copyfile(copyFile, dst / copyFile) print("Copied:", copyFile, flush=True) writeFile(dst / "MANIFEST.in", ( "include LICENSE.md\n" - "include LICENSE-Apache-2.0.txt\n" + "include setup/LICENSE-Apache-2.0.txt\n" "include CREDITS.md\n" "recursive-include novelwriter/assets *\n" ))