From 2113964bc3c4cb9291465757e243adfe775d4389 Mon Sep 17 00:00:00 2001 From: dynobo Date: Thu, 30 Nov 2023 20:48:29 +0100 Subject: [PATCH 1/4] build: add retry to brew install --- bundle/platforms/macos_briefcase.py | 3 +++ bundle/platforms/utils.py | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bundle/platforms/macos_briefcase.py b/bundle/platforms/macos_briefcase.py index 20511624e..1b62ca3c0 100644 --- a/bundle/platforms/macos_briefcase.py +++ b/bundle/platforms/macos_briefcase.py @@ -4,6 +4,8 @@ import shutil from pathlib import Path +from retry import retry + from platforms.utils import BuilderBase @@ -82,6 +84,7 @@ def bundle_tesseract(self) -> None: ) shutil.copy(tesseract_source, tesseract_target) + @retry(tries=5, delay=1, backoff=2) def install_system_deps(self) -> None: self.run(cmd="brew install tesseract") self.run(cmd="brew install dylibbundler") diff --git a/bundle/platforms/utils.py b/bundle/platforms/utils.py index c4da8b377..e4b73d2d4 100644 --- a/bundle/platforms/utils.py +++ b/bundle/platforms/utils.py @@ -15,8 +15,6 @@ import toml from retry import retry -# TODO: Add retries to all downloads - class BuilderBase(ABC): """Create a prebuilt package.""" From 73af851253ea23fc778826044d24bafb875ea2e4 Mon Sep 17 00:00:00 2001 From: dynobo Date: Thu, 30 Nov 2023 21:04:52 +0100 Subject: [PATCH 2/4] build: add hatch script for building --- .github/workflows/python.yaml | 4 ++-- pyproject.toml | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python.yaml b/.github/workflows/python.yaml index f3f04e05b..07dbcd7d2 100644 --- a/.github/workflows/python.yaml +++ b/.github/workflows/python.yaml @@ -117,7 +117,7 @@ jobs: # Build test packages - name: Test build briefcase package shell: bash -l {0} - run: hatch run python bundle/build.py --framework=briefcase --dev + run: hatch run bundle --dev - name: Print briefcase log in case of error if: failure() shell: bash -l {0} @@ -176,7 +176,7 @@ jobs: python-version: "3.10" - name: Build package briefcase shell: bash -l {0} - run: hatch run python bundle/build.py --framework=briefcase + run: hatch run bundle - name: Draft release if: github.repository == 'dynobo/normcap' uses: ncipollo/release-action@v1 diff --git a/pyproject.toml b/pyproject.toml index f91aee63f..a85c0d607 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -94,6 +94,7 @@ locales-compile = "python bundle/l10n.py" locales-update = "python bundle/l10n.py --update-all" create-locale = "python bundle/l10n.py --create-new" version = "tbump {args:current-version}" +bundle = ["locales-compile", "python bundle/build.py --framework=briefcase {args}"] [[tool.hatch.envs.all.matrix]] python = ["3.9", "3.10", "3.11"] @@ -275,7 +276,7 @@ requires = ["std-nslog==1.0.0"] [tool.briefcase.app.normcap.linux.appimage] template = "https://github.com/beeware/briefcase-linux-appimage-template" template_branch = "v0.3.16" -manylinux = "manylinux_2_28" +manylinux = "manylinux2014_x86_64" system_requires = [ "wget", "tesseract", From 78e75d2eb905a5dd0bf4e6e66fccc12326753d3a Mon Sep 17 00:00:00 2001 From: dynobo Date: Thu, 30 Nov 2023 22:39:30 +0100 Subject: [PATCH 3/4] build: add step for cleaning old build files --- bundle/platforms/utils.py | 7 +++++++ pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bundle/platforms/utils.py b/bundle/platforms/utils.py index e4b73d2d4..f7933d633 100644 --- a/bundle/platforms/utils.py +++ b/bundle/platforms/utils.py @@ -70,8 +70,15 @@ def compile_locales(self) -> None: cwd=self.PROJECT_PATH, ) + def clean(self) -> None: + build_dir = self.PROJECT_PATH / "build" + if build_dir.exists(): + print(f"Removing old build directory {build_dir.resolve()}") # noqa: T201 + shutil.rmtree(build_dir, ignore_errors=True) + def create(self) -> None: """Run all steps to build prebuilt packages.""" + self.clean() self.download_tessdata() self.install_system_deps() self.compile_locales() diff --git a/pyproject.toml b/pyproject.toml index a85c0d607..f033ae27c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -276,7 +276,7 @@ requires = ["std-nslog==1.0.0"] [tool.briefcase.app.normcap.linux.appimage] template = "https://github.com/beeware/briefcase-linux-appimage-template" template_branch = "v0.3.16" -manylinux = "manylinux2014_x86_64" +manylinux = "manylinux_2_28" system_requires = [ "wget", "tesseract", From 70e6911849970b80b117e063029fb4e16b0535c9 Mon Sep 17 00:00:00 2001 From: dynobo Date: Fri, 1 Dec 2023 22:18:58 +0100 Subject: [PATCH 4/4] build: pin manylinux image tag to fix segfault #534 in an issue in the manylinux repo it was stated, that starting with tags starting from 2023-09-17 a segfault can occure. And indeed: pinning to an older tag solved the segfault in normcap, too. --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index f033ae27c..d4596e9b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -277,6 +277,7 @@ requires = ["std-nslog==1.0.0"] template = "https://github.com/beeware/briefcase-linux-appimage-template" template_branch = "v0.3.16" manylinux = "manylinux_2_28" +manylinux_image_tag="2023-09-16-066b049" system_requires = [ "wget", "tesseract",