From 676792fcb456700d0ddfe9eb0c26e609d384d980 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Fri, 9 Feb 2024 10:41:19 -0300 Subject: [PATCH 01/16] Update Release workflow --- .github/workflows/release.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2cd3d65..765eec6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,17 +31,14 @@ jobs: release: needs: build - strategy: - matrix: - arch: [ARM64, X64] - openfoam-version: [2312, 2306] runs-on: ubuntu-latest steps: - - name: Download app artifact + - name: Download app artifacts uses: actions/download-artifact@v4 with: - name: app-${{ matrix.openfoam-version }}-${{ matrix.arch }} - - name: Upload app to release + pattern: app-* + merge-multiple: true + - name: Upload apps to release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} From 2b74d56b6a822fdba13fd248eedea0cec347e6a4 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Fri, 9 Feb 2024 17:38:24 -0300 Subject: [PATCH 02/16] Update Release workflow --- .github/workflows/ci.yml | 8 +++++++- .github/workflows/release.yml | 9 +-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 746b12e..201ade2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,11 @@ on: - main schedule: - cron: '0 6 * * 5' + workflow_call: + inputs: + app-version: + type: string + required: true workflow_dispatch: inputs: use-cached: @@ -40,8 +45,9 @@ jobs: fail-fast: false uses: ./.github/workflows/build-test.yml with: - openfoam-version: ${{ matrix.openfoam-version }} build-os: ${{ matrix.build-os }} + openfoam-version: ${{ matrix.openfoam-version }} + app-version: ${{ github.event_name == 'workflow_call' && inputs.app-version || '' }} deps-kind: ${{ inputs.deps-kind }} use-cached: ${{ github.event_name == 'workflow_dispatch' && inputs.use-cached || github.event_name != 'workflow_dispatch' && github.event_name != 'schedule' }} cache-build: ${{ github.event_name != 'workflow_dispatch' && inputs.cache-build || github.event_name != 'workflow_dispatch' }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 765eec6..9f3e8b8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,15 +18,8 @@ jobs: build: needs: get-version - strategy: - matrix: - build-os: [macos-14, macos-12] - openfoam-version: [2312, 2306] - fail-fast: false - uses: ./.github/workflows/build-test.yml + uses: ./.github/workflows/ci.yml with: - openfoam-version: ${{ matrix.openfoam-version }} - build-os: ${{ matrix.build-os }} app-version: ${{ needs.get-version.outputs.app-version }} release: From c15a27dd1ba4e9703005c09ba8a872f635617cc5 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Sat, 10 Feb 2024 17:26:20 -0300 Subject: [PATCH 03/16] Update CI workflow --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 201ade2..30c0981 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: with: build-os: ${{ matrix.build-os }} openfoam-version: ${{ matrix.openfoam-version }} - app-version: ${{ github.event_name == 'workflow_call' && inputs.app-version || '' }} + app-version: ${{ inputs.app-version }} deps-kind: ${{ inputs.deps-kind }} use-cached: ${{ github.event_name == 'workflow_dispatch' && inputs.use-cached || github.event_name != 'workflow_dispatch' && github.event_name != 'schedule' }} cache-build: ${{ github.event_name != 'workflow_dispatch' && inputs.cache-build || github.event_name != 'workflow_dispatch' }} From 1e4f423001009d326d95a2cdb5d2fbc117cc47fb Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Wed, 21 Feb 2024 21:25:04 -0300 Subject: [PATCH 04/16] Use pytest for testing --- .github/dependabot.yml | 5 +++ .github/workflows/build-test.yml | 2 ++ .gitignore | 3 +- Makefile | 55 +++++--------------------------- scripts/test.sh | 41 ------------------------ tests/requirements.txt | 3 ++ tests/test_basic.py | 15 +++++++++ tests/test_foamy.py | 16 ++++++++++ tests/test_parallel.py | 36 +++++++++++++++++++++ tests/test_regression.py | 20 ++++++++++++ 10 files changed, 107 insertions(+), 89 deletions(-) delete mode 100755 scripts/test.sh create mode 100644 tests/requirements.txt create mode 100644 tests/test_basic.py create mode 100644 tests/test_foamy.py create mode 100644 tests/test_parallel.py create mode 100644 tests/test_regression.py diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5ace460..b49ab4d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,3 +4,8 @@ updates: directory: "/" schedule: interval: "weekly" + + - package-ecosystem: "pip" + directory: "/tests" + schedule: + interval: "weekly" diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index a6c2fbf..8b8c691 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -214,3 +214,5 @@ jobs: - name: Test run: | make test ${{ env.MAKE_VARS }} + env: + PRTE_MCA_rmaps_default_mapping_policy: ':oversubscribe' diff --git a/.gitignore b/.gitignore index f18074e..00dfb09 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /build Brewfile.lock.json *.tgz -.DS_Store \ No newline at end of file +.DS_Store +venv diff --git a/Makefile b/Makefile index 781af90..d17fe1d 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,6 @@ DEPS_KIND = standalone DMG_FORMAT = UDRO APP_HOMEPAGE = https://github.com/gerlero/openfoam-app APP_VERSION = -TEST_DIR = build/test-v$(OPENFOAM_VERSION) DIST_NAME = openfoam$(OPENFOAM_VERSION)-app-$(shell uname -m) INSTALL_DIR = /Applications @@ -206,51 +205,13 @@ $(OPENFOAM_TARBALL).sha256: # Non-build targets and rules -test: test-dmg test-openfoam test-bash test-zsh - -test-openfoam: - [ ! -d $(VOLUME) ] || hdiutil detach $(VOLUME) - rm -rf $(TEST_DIR)/test-openfoam - mkdir -p $(TEST_DIR)/test-openfoam - build/$(APP_NAME).app/Contents/Resources/etc/openfoam -c foamInstallationTest - cd $(TEST_DIR)/test-openfoam \ - && "$(CURDIR)/build/$(APP_NAME).app/Contents/Resources/etc/openfoam" < "$(CURDIR)/scripts/test.sh" - build/$(APP_NAME).app/Contents/Resources/volume eject && [ ! -d $(VOLUME) ] - -test-bash: - [ ! -d $(VOLUME) ] || hdiutil detach $(VOLUME) - rm -rf $(TEST_DIR)/test-bash - mkdir -p $(TEST_DIR)/test-bash - PATH=$(VOLUME)/usr/opt/bash/bin:$$PATH bash -c \ - 'source build/$(APP_NAME).app/Contents/Resources/etc/bashrc; \ - set -ex; \ - foamInstallationTest; \ - cd $(TEST_DIR)/test-bash; \ - source "$(CURDIR)/scripts/test.sh"' +test: | tests/venv + tests/venv/bin/pip install -r tests/requirements.txt + build/$(APP_NAME).app/Contents/Resources/etc/openfoam -c tests/venv/bin/pytest build/$(APP_NAME).app/Contents/Resources/volume eject && [ ! -d $(VOLUME) ] -test-zsh: - [ ! -d $(VOLUME) ] || hdiutil detach $(VOLUME) - rm -rf $(TEST_DIR)/test-zsh - mkdir -p $(TEST_DIR)/test-zsh - zsh -c \ - 'source build/$(APP_NAME).app/Contents/Resources/etc/bashrc; \ - set -ex; \ - foamInstallationTest; \ - cd $(TEST_DIR)/test-zsh; \ - source "$(CURDIR)/scripts/test.sh"' - build/$(APP_NAME).app/Contents/Resources/volume eject && [ ! -d $(VOLUME) ] - -test-dmg: - [ ! -d $(VOLUME) ] || hdiutil detach $(VOLUME) - hdiutil attach build/$(APP_NAME).app/Contents/Resources/$(APP_NAME).dmg - rm -rf $(TEST_DIR)/test-dmg - mkdir -p $(TEST_DIR)/test-dmg - cd $(TEST_DIR)/test-dmg \ - && source $(VOLUME)/etc/bashrc \ - && foamInstallationTest \ - && "$(CURDIR)/scripts/test.sh" - hdiutil detach $(VOLUME) +tests/venv: + python3 -m venv tests/venv clean-app: [ ! -d $(VOLUME) ] || hdiutil detach $(VOLUME) @@ -258,17 +219,17 @@ clean-app: clean-build: clean-app rm -f build/$(DIST_NAME).zip - rm -rf build/$(APP_NAME)-build.sparsebundle $(TEST_DIR)/test-openfoam $(TEST_DIR)/test-bash $(TEST_DIR)/test-zsh $(TEST_DIR)/test-dmg - rmdir $(TEST_DIR) || true + rm -rf build/$(APP_NAME)-build.sparsebundle rmdir build || true clean: clean-build rm -f $(OPENFOAM_TARBALL) Brewfile.lock.json + rm -rf tests/venv uninstall: rm -rf $(INSTALL_DIR)/$(APP_NAME).app # Set special targets -.PHONY: app build deps fetch-source zip install test test-openfoam test-bash test-zsh test-dmg clean-app clean-build clean uninstall +.PHONY: app build deps fetch-source zip install test clean-app clean-build clean uninstall .SECONDARY: $(VOLUME) $(OPENFOAM_TARBALL) .DELETE_ON_ERROR: diff --git a/scripts/test.sh b/scripts/test.sh deleted file mode 100755 index 2010c5f..0000000 --- a/scripts/test.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -e - -rm -rf pitzDaily -cp -r "$FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily" pitzDaily -cd pitzDaily -blockMesh -simpleFoam -cd .. - -rm -rf flange -cp -r "$FOAM_TUTORIALS/basic/laplacianFoam/flange" flange -cd flange -PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe ./Allrun-parallel -reconstructPar -cd .. - -rm -rf flange_manual -cp -r "$FOAM_TUTORIALS/basic/laplacianFoam/flange" flange_manual -cd flange_manual -cp -r 0.orig 0 -ansysToFoam "$FOAM_TUTORIALS/resources/geometry/flange.ans" -scale 0.001 -decomposePar -mpirun -np 4 --oversubscribe laplacianFoam -parallel < /dev/null -reconstructPar -cd .. - -rm -rf backwardFacingStep2D -cp -r "$FOAM_TUTORIALS/incompressible/simpleFoam/backwardFacingStep2D" backwardFacingStep2D -cd backwardFacingStep2D -./Allrun -! grep 'FOAM Warning' log.simpleFoam -cd .. - -rm -rf blob -cp -r "$FOAM_TUTORIALS/mesh/foamyHexMesh/blob" blob -cd blob -./Allrun -cd .. - -# https://github.com/gerlero/openfoam-app/issues/88 -cartesianMesh -help diff --git a/tests/requirements.txt b/tests/requirements.txt new file mode 100644 index 0000000..457dfed --- /dev/null +++ b/tests/requirements.txt @@ -0,0 +1,3 @@ +pytest>=7,<7.3 +pytest-asyncio-cooperative>=0.36,<0.37 +aiofoam>=0.4,<0.5 diff --git a/tests/test_basic.py b/tests/test_basic.py new file mode 100644 index 0000000..5650cd6 --- /dev/null +++ b/tests/test_basic.py @@ -0,0 +1,15 @@ +import pytest + +import os +from pathlib import Path + +from aiofoam import Case + +@pytest.fixture +async def pitz_case(tmp_path): + case = Case(Path(os.environ["FOAM_TUTORIALS"]) / "incompressible" / "simpleFoam" / "pitzDaily") + return await case.clone(tmp_path / case.name) + +@pytest.mark.asyncio_cooperative +async def test_pitz(pitz_case): + await pitz_case.run() diff --git a/tests/test_foamy.py b/tests/test_foamy.py new file mode 100644 index 0000000..9e8ffdd --- /dev/null +++ b/tests/test_foamy.py @@ -0,0 +1,16 @@ +import pytest + +import os +from pathlib import Path + +from aiofoam import Case + +@pytest.fixture +async def blob(tmp_path): + case = Case(Path(os.environ["FOAM_TUTORIALS"]) / "mesh" / "foamyHexMesh" / "blob") + return await case.clone(tmp_path / case.name) + +@pytest.mark.parametrize("parallel", [False, True]) +@pytest.mark.asyncio_cooperative +async def test_blob(blob, parallel): + await blob.run(parallel=parallel) diff --git a/tests/test_parallel.py b/tests/test_parallel.py new file mode 100644 index 0000000..7cba644 --- /dev/null +++ b/tests/test_parallel.py @@ -0,0 +1,36 @@ +import pytest + +import os +import shutil +from pathlib import Path + +from aiofoam import Case + +@pytest.fixture +async def flange(tmp_path): + case = Case(Path(os.environ["FOAM_TUTORIALS"]) / "basic" / "laplacianFoam" / "flange") + return await case.clone(tmp_path / case.name) + +@pytest.mark.asyncio_cooperative +async def test_serial(flange): + await flange.run(parallel=False) + +@pytest.mark.asyncio_cooperative +async def test_parallel(flange): + await flange.run(parallel=True) + await flange.cmd(["reconstructPar"]) + +@pytest.mark.asyncio_cooperative +async def test_parallel_manual(flange): + shutil.copytree(flange.path / "0.orig", flange.path / "0") + await flange.cmd(["ansysToFoam", Path(os.environ["FOAM_TUTORIALS"]) / "resources" / "geometry" / "flange.ans", "-scale", "0.001"]) + await flange.run(script=False, parallel=True) + await flange.cmd(["reconstructPar"]) + +@pytest.mark.asyncio_cooperative +async def test_parallel_manual_shell(flange): + shutil.copytree(flange.path / "0.orig", flange.path / "0") + await flange.cmd("ansysToFoam \"$FOAM_TUTORIALS/resources/geometry/flange.ans\" -scale 0.001") + await flange.cmd("decomposePar") + await flange.cmd("laplacianFoam", parallel=True) + await flange.cmd("reconstructPar") diff --git a/tests/test_regression.py b/tests/test_regression.py new file mode 100644 index 0000000..f49fe74 --- /dev/null +++ b/tests/test_regression.py @@ -0,0 +1,20 @@ +import pytest + +import os +import subprocess +from pathlib import Path + +from aiofoam import Case + +@pytest.fixture +async def step(tmp_path): + case = Case(Path(os.environ["FOAM_TUTORIALS"]) / "incompressible" / "simpleFoam" / "backwardFacingStep2D") + return await case.clone(tmp_path / case.name) + +@pytest.mark.asyncio_cooperative +async def test_step(step): + await step.run() + assert "FOAM Warning" not in (step.path / "log.simpleFoam").read_text() + +def test_cartesian(): # https://github.com/gerlero/openfoam-app/issues/88 + subprocess.run(["cartesianMesh", "-help"], check=True) From 8accfbd8eeb4677c44b7c6b20b55ab4681ad3aa9 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Mon, 18 Mar 2024 15:18:18 -0300 Subject: [PATCH 05/16] Update README.md --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 2a85b65..77a6309 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,6 @@ # **OpenFOAM.app**: OpenFOAM for macOS -| 🎉 [OpenFOAM v2312 is now available!](#-install) | -| ---- | - **Native OpenFOAM as a Mac app**, with binaries compiled from the [OpenFOAM source code](https://develop.openfoam.com/Development/openfoam/-/blob/master/doc/Build.md). Intel and Apple silicon variants. [![CI](https://github.com/gerlero/openfoam-app/actions/workflows/ci.yml/badge.svg)](https://github.com/gerlero/openfoam-app/actions/workflows/ci.yml) From ab16fd5d11e12b9efeae556a450c48b150da1579 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Mon, 18 Mar 2024 15:40:26 -0300 Subject: [PATCH 06/16] Upgrade to foamlib --- tests/requirements.txt | 2 +- tests/test_basic.py | 4 ++-- tests/test_foamy.py | 4 ++-- tests/test_parallel.py | 20 ++++++++++---------- tests/test_regression.py | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 457dfed..a3a7a37 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,3 +1,3 @@ pytest>=7,<7.3 pytest-asyncio-cooperative>=0.36,<0.37 -aiofoam>=0.4,<0.5 +foamlib>=0.1.0,<0.2.0 diff --git a/tests/test_basic.py b/tests/test_basic.py index 5650cd6..5da3a50 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -3,11 +3,11 @@ import os from pathlib import Path -from aiofoam import Case +from foamlib import AsyncFoamCase @pytest.fixture async def pitz_case(tmp_path): - case = Case(Path(os.environ["FOAM_TUTORIALS"]) / "incompressible" / "simpleFoam" / "pitzDaily") + case = AsyncFoamCase(Path(os.environ["FOAM_TUTORIALS"]) / "incompressible" / "simpleFoam" / "pitzDaily") return await case.clone(tmp_path / case.name) @pytest.mark.asyncio_cooperative diff --git a/tests/test_foamy.py b/tests/test_foamy.py index 9e8ffdd..3bb5aab 100644 --- a/tests/test_foamy.py +++ b/tests/test_foamy.py @@ -3,11 +3,11 @@ import os from pathlib import Path -from aiofoam import Case +from foamlib import AsyncFoamCase @pytest.fixture async def blob(tmp_path): - case = Case(Path(os.environ["FOAM_TUTORIALS"]) / "mesh" / "foamyHexMesh" / "blob") + case = AsyncFoamCase(Path(os.environ["FOAM_TUTORIALS"]) / "mesh" / "foamyHexMesh" / "blob") return await case.clone(tmp_path / case.name) @pytest.mark.parametrize("parallel", [False, True]) diff --git a/tests/test_parallel.py b/tests/test_parallel.py index 7cba644..e728329 100644 --- a/tests/test_parallel.py +++ b/tests/test_parallel.py @@ -4,11 +4,11 @@ import shutil from pathlib import Path -from aiofoam import Case +from foamlib import AsyncFoamCase @pytest.fixture async def flange(tmp_path): - case = Case(Path(os.environ["FOAM_TUTORIALS"]) / "basic" / "laplacianFoam" / "flange") + case = AsyncFoamCase(Path(os.environ["FOAM_TUTORIALS"]) / "basic" / "laplacianFoam" / "flange") return await case.clone(tmp_path / case.name) @pytest.mark.asyncio_cooperative @@ -18,19 +18,19 @@ async def test_serial(flange): @pytest.mark.asyncio_cooperative async def test_parallel(flange): await flange.run(parallel=True) - await flange.cmd(["reconstructPar"]) + await flange.run(["reconstructPar"]) @pytest.mark.asyncio_cooperative async def test_parallel_manual(flange): shutil.copytree(flange.path / "0.orig", flange.path / "0") - await flange.cmd(["ansysToFoam", Path(os.environ["FOAM_TUTORIALS"]) / "resources" / "geometry" / "flange.ans", "-scale", "0.001"]) + await flange.run(["ansysToFoam", Path(os.environ["FOAM_TUTORIALS"]) / "resources" / "geometry" / "flange.ans", "-scale", "0.001"]) await flange.run(script=False, parallel=True) - await flange.cmd(["reconstructPar"]) + await flange.run(["reconstructPar"]) @pytest.mark.asyncio_cooperative async def test_parallel_manual_shell(flange): - shutil.copytree(flange.path / "0.orig", flange.path / "0") - await flange.cmd("ansysToFoam \"$FOAM_TUTORIALS/resources/geometry/flange.ans\" -scale 0.001") - await flange.cmd("decomposePar") - await flange.cmd("laplacianFoam", parallel=True) - await flange.cmd("reconstructPar") + await flange.run("cp -r 0.orig 0") + await flange.run("ansysToFoam \"$FOAM_TUTORIALS/resources/geometry/flange.ans\" -scale 0.001") + await flange.run("decomposePar") + await flange.run(flange.application, parallel=True) + await flange.run("reconstructPar") diff --git a/tests/test_regression.py b/tests/test_regression.py index f49fe74..e49a8cc 100644 --- a/tests/test_regression.py +++ b/tests/test_regression.py @@ -4,11 +4,11 @@ import subprocess from pathlib import Path -from aiofoam import Case +from foamlib import AsyncFoamCase @pytest.fixture async def step(tmp_path): - case = Case(Path(os.environ["FOAM_TUTORIALS"]) / "incompressible" / "simpleFoam" / "backwardFacingStep2D") + case = AsyncFoamCase(Path(os.environ["FOAM_TUTORIALS"]) / "incompressible" / "simpleFoam" / "backwardFacingStep2D") return await case.clone(tmp_path / case.name) @pytest.mark.asyncio_cooperative From 027357525cdd4142fe88a666296e77338e20f0f6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 08:29:20 +0000 Subject: [PATCH 07/16] Update foamlib requirement in /tests Updates the requirements on [foamlib](https://github.com/gerlero/foamlib) to permit the latest version. - [Release notes](https://github.com/gerlero/foamlib/releases) - [Commits](https://github.com/gerlero/foamlib/compare/v0.1.0...v0.2.2) --- updated-dependencies: - dependency-name: foamlib dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index a3a7a37..9495f0e 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,3 +1,3 @@ pytest>=7,<7.3 pytest-asyncio-cooperative>=0.36,<0.37 -foamlib>=0.1.0,<0.2.0 +foamlib>=0.1.0,<0.3.0 From f23b851968680272b5a0648512a618155a4e7e79 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Tue, 16 Apr 2024 13:18:34 -0300 Subject: [PATCH 08/16] Update macho module --- scripts/macho.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/macho.py b/scripts/macho.py index 8331b66..427eb76 100644 --- a/scripts/macho.py +++ b/scripts/macho.py @@ -3,7 +3,10 @@ """ import subprocess import platform -import os +import sys + +if sys.version_info < (3, 12): + import os from pathlib import Path @@ -25,7 +28,11 @@ def change_install_name(file, old_install_name, new_install_name, *, relative=Fa if relative: new_install_name = Path(new_install_name) assert new_install_name.is_absolute() - new_install_name = Path("@loader_path") / os.path.relpath(new_install_name, start=file.parent) + if sys.version_info >= (3, 12): + new_install_name = new_install_name.relative_to(file.parent, walk_up=True) + else: # No walk_up parameter in Python < 3.12 + new_install_name = Path(os.path.relpath(new_install_name, start=file.parent)) + new_install_name = "@loader_path" / new_install_name subprocess.run(["install_name_tool", "-change", old_install_name, new_install_name, file], check=True) if platform.machine() == "arm64": _codesign(file) From 1f353df3fbfdff2cce6b59114fa9e8bffaa24717 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Tue, 16 Apr 2024 15:55:40 -0300 Subject: [PATCH 09/16] Fix macho module --- scripts/macho.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/macho.py b/scripts/macho.py index 427eb76..ba61f87 100644 --- a/scripts/macho.py +++ b/scripts/macho.py @@ -24,7 +24,7 @@ def get_install_names(file): return install_names def change_install_name(file, old_install_name, new_install_name, *, relative=False): - file = Path(file) + file = Path(file).absolute() if relative: new_install_name = Path(new_install_name) assert new_install_name.is_absolute() From 61d91d886c5cf2083e37120a38a3cf3a90b7149d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Apr 2024 08:56:50 +0000 Subject: [PATCH 10/16] Update foamlib requirement in /tests Updates the requirements on [foamlib](https://github.com/gerlero/foamlib) to permit the latest version. - [Release notes](https://github.com/gerlero/foamlib/releases) - [Commits](https://github.com/gerlero/foamlib/compare/v0.1.0...v0.3.6) --- updated-dependencies: - dependency-name: foamlib dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 9495f0e..ba2e7b2 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,3 +1,3 @@ pytest>=7,<7.3 pytest-asyncio-cooperative>=0.36,<0.37 -foamlib>=0.1.0,<0.3.0 +foamlib>=0.1.0,<0.4.0 From d9acc13762118f7f5274f168cd4ea644cb47812d Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Mon, 22 Apr 2024 09:59:01 -0300 Subject: [PATCH 11/16] Update Python scripts --- scripts/bundle_deps.py | 6 +++--- scripts/macho.py | 2 +- scripts/relativize_install_names.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/bundle_deps.py b/scripts/bundle_deps.py index 8cf397a..3eb5803 100755 --- a/scripts/bundle_deps.py +++ b/scripts/bundle_deps.py @@ -9,16 +9,16 @@ import macho -SRC_PREFIX = Path(subprocess.run(["brew", "--prefix"], stdout=subprocess.PIPE, check=True).stdout.decode().strip()) +SRC_PREFIX = Path(subprocess.run(["brew", "--prefix"], stdout=subprocess.PIPE, text=True, check=True).stdout.strip()) def bundle_list(): - return subprocess.run(["brew", "bundle", "list"], stdout=subprocess.PIPE, check=True).stdout.decode().splitlines() + return subprocess.run(["brew", "bundle", "list"], stdout=subprocess.PIPE, text=True, check=True).stdout.splitlines() def deps(*formulae, union=False): cmd = ["brew", "deps"] if union: cmd.append("--union") - return subprocess.run([*cmd, *formulae], stdout=subprocess.PIPE, check=True).stdout.decode().splitlines() + return subprocess.run([*cmd, *formulae], stdout=subprocess.PIPE, text=True, check=True).stdout.splitlines() def copy_installed_formula(formula, dst_prefix, *, relative_install_names=False): dst_prefix = Path(dst_prefix) diff --git a/scripts/macho.py b/scripts/macho.py index ba61f87..8d21651 100644 --- a/scripts/macho.py +++ b/scripts/macho.py @@ -19,7 +19,7 @@ def change_dylib_id(lib, id): _codesign(lib) def get_install_names(file): - otool_stdout = subprocess.run(["otool", "-L", file], stdout=subprocess.PIPE, check=True).stdout.decode() + otool_stdout = subprocess.run(["otool", "-L", file], stdout=subprocess.PIPE, text=True, check=True).stdout install_names = [Path(line.rpartition(" (compatibility version ")[0].strip()) for line in otool_stdout.splitlines()[1:]] return install_names diff --git a/scripts/relativize_install_names.py b/scripts/relativize_install_names.py index b52a76f..5875cf6 100755 --- a/scripts/relativize_install_names.py +++ b/scripts/relativize_install_names.py @@ -23,7 +23,7 @@ def relativize_install_names(file, lib_dirs): lib_dirs = {Path("usr").resolve(): Path("usr")} # In case "usr" is a symlink # Replace references to OpenFOAM libraries if necessary -OPENFOAM_VERSION = int(subprocess.run(["bin/foamEtcFile", "-show-api"], stdout=subprocess.PIPE, check=True).stdout) +OPENFOAM_VERSION = int(subprocess.run(["bin/foamEtcFile", "-show-api"], stdout=subprocess.PIPE, text=True, check=True).stdout) if OPENFOAM_VERSION < 2312: # References are already relative in OpenFOAM >= 2312 # See https://develop.openfoam.com/Development/openfoam/-/issues/2948 From a437ef29a28670a40c16078b133f2278dbc9f693 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Mon, 6 May 2024 12:01:20 -0300 Subject: [PATCH 12/16] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 77a6309..3f1f9f1 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ * Install with [Homebrew](https://brew.sh): ```sh - brew install --no-quarantine gerlero/openfoam/openfoam2312 + brew install --no-quarantine gerlero/openfoam/openfoam@2312 ``` * Manual download: [⬇️ Apple silicon](https://github.com/gerlero/openfoam-app/releases/latest/download/openfoam2312-app-arm64.zip) | [⬇️ Intel](https://github.com/gerlero/openfoam-app/releases/latest/download/openfoam2312-app-x86_64.zip) @@ -44,7 +44,7 @@ * Install with [Homebrew](https://brew.sh): ```sh - brew install --no-quarantine gerlero/openfoam/openfoam2306 + brew install --no-quarantine gerlero/openfoam/openfoam@2306 ``` * Manual download: [⬇️ Apple silicon](https://github.com/gerlero/openfoam-app/releases/latest/download/openfoam2306-app-arm64.zip) | [⬇️ Intel](https://github.com/gerlero/openfoam-app/releases/latest/download/openfoam2306-app-x86_64.zip) @@ -133,17 +133,17 @@ If you need an older version of OpenFOAM, you can: * Use an older release of **OpenFOAM.app** (note that these apps are no longer updated): * [**OpenFOAM-v2212.app** 1.11.1](https://github.com/gerlero/openfoam-app/releases/tag/v1.11.1) - * Homebrew: `brew install --no-quarantine gerlero/openfoam/openfoam2212` + * Homebrew: `brew install --no-quarantine gerlero/openfoam/openfoam@2212` * [⬇️ Apple silicon](https://github.com/gerlero/openfoam-app/releases/download/v1.11.1/openfoam2212-app-arm64.zip): tested with macOS 14 Sonoma * [⬇️ Intel](https://github.com/gerlero/openfoam-app/releases/download/v1.11.1/openfoam2212-app-x86_64.zip): tested with macOS 11 Big Sur through macOS 13 Ventura * [**OpenFOAM-v2206.app** 1.10.2](https://github.com/gerlero/openfoam-app/releases/tag/v1.10.2) - * Homebrew: `brew install --no-quarantine gerlero/openfoam/openfoam2206` + * Homebrew: `brew install --no-quarantine gerlero/openfoam/openfoam@2206` * [⬇️ Apple silicon](https://github.com/gerlero/openfoam-app/releases/download/v1.10.2/openfoam2206-app-standalone-arm64.zip): tested with macOS 13 Ventura and macOS 14 Sonoma * [⬇️ Intel](https://github.com/gerlero/openfoam-app/releases/download/v1.10.2/openfoam2206-app-standalone-x86_64.zip): tested with macOS 11 Big Sur through macOS 13 Ventura * [**OpenFOAM-v2112.app** 1.10.2](https://github.com/gerlero/openfoam-app/releases/tag/v1.10.2) - * Homebrew: `brew install --no-quarantine gerlero/openfoam/openfoam2112` + * Homebrew: `brew install --no-quarantine gerlero/openfoam/openfoam@2112` * [⬇️ Apple silicon](https://github.com/gerlero/openfoam-app/releases/download/v1.10.2/openfoam2112-app-standalone-arm64.zip): tested with macOS 13 Ventura and macOS 14 Sonoma * [⬇️ Intel](https://github.com/gerlero/openfoam-app/releases/download/v1.10.2/openfoam2112-app-standalone-x86_64.zip): tested with macOS 11 Big Sur through macOS 13 Ventura From 34e3675e4199fc4faaf9b7e4d29b5b77f0894ea2 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Wed, 8 May 2024 12:21:45 -0300 Subject: [PATCH 13/16] Update build workflow --- .github/workflows/build-test.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 8b8c691..248fc96 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -97,8 +97,6 @@ jobs: deps-restore-key: ${{ steps.caching.outputs.DEPS_RESTORE_KEY }} build-restore-key: ${{ steps.caching.outputs.BUILD_RESTORE_KEY }} steps: - - name: Use Xcode Command Line Tools - run: sudo xcode-select --switch /Library/Developer/CommandLineTools - name: Checkout uses: actions/checkout@v4 - name: Get Make recipes for caching @@ -137,8 +135,6 @@ jobs: needs: deps runs-on: ${{ inputs.build-os }} steps: - - name: Use Xcode Command Line Tools - run: sudo xcode-select --switch /Library/Developer/CommandLineTools - name: Checkout uses: actions/checkout@v4 - name: Restore cached build if available From 3bda066819beaad72e109803e16bae13b61f6d11 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Wed, 22 May 2024 11:08:41 -0300 Subject: [PATCH 14/16] Add pytest.ini file --- pytest.ini | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 pytest.ini diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..cb69634 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +asyncio_task_timeout = 1800 From ed0e3ad3dcfd20647bc3354ff39351299d37ab76 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Sat, 1 Jun 2024 14:43:48 -0300 Subject: [PATCH 15/16] Revert "Update build workflow" --- .github/workflows/build-test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 248fc96..8b8c691 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -97,6 +97,8 @@ jobs: deps-restore-key: ${{ steps.caching.outputs.DEPS_RESTORE_KEY }} build-restore-key: ${{ steps.caching.outputs.BUILD_RESTORE_KEY }} steps: + - name: Use Xcode Command Line Tools + run: sudo xcode-select --switch /Library/Developer/CommandLineTools - name: Checkout uses: actions/checkout@v4 - name: Get Make recipes for caching @@ -135,6 +137,8 @@ jobs: needs: deps runs-on: ${{ inputs.build-os }} steps: + - name: Use Xcode Command Line Tools + run: sudo xcode-select --switch /Library/Developer/CommandLineTools - name: Checkout uses: actions/checkout@v4 - name: Restore cached build if available From ba6df790283086541b3a4e4c546c718a727cee0b Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Sat, 1 Jun 2024 18:32:11 -0300 Subject: [PATCH 16/16] Update build workflow --- .github/workflows/build-test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 8b8c691..a2da2b8 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -137,8 +137,6 @@ jobs: needs: deps runs-on: ${{ inputs.build-os }} steps: - - name: Use Xcode Command Line Tools - run: sudo xcode-select --switch /Library/Developer/CommandLineTools - name: Checkout uses: actions/checkout@v4 - name: Restore cached build if available