From 1898c69ff5cef388b67ca42b598e8e913a1b80bc Mon Sep 17 00:00:00 2001 From: Arjan Molenaar Date: Mon, 26 Oct 2020 23:00:04 +0100 Subject: [PATCH 1/2] Let package script reliably find the Python version GObject-introspection is dependent on Python. That's the version we will install. Ensure we use that Python version. --- macos-dmg/package-local.sh | 12 ------------ macos-dmg/package.sh | 14 ++++++++++---- 2 files changed, 10 insertions(+), 16 deletions(-) delete mode 100755 macos-dmg/package-local.sh diff --git a/macos-dmg/package-local.sh b/macos-dmg/package-local.sh deleted file mode 100755 index 17a6f6c30e..0000000000 --- a/macos-dmg/package-local.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# -# This wrapper for the package script contains some -# env vars, so it can build Gaphor with Python 3.8. -# -# It is intended to run from a local Mac, not CI. -# -export PATH="/usr/local/opt/python@3.8/bin:$PATH" -export LDFLAGS="-L/usr/local/opt/python@3.8/lib" -export PKG_CONFIG_PATH="/usr/local/opt/python@3.8/lib/pkgconfig" - -./package.sh diff --git a/macos-dmg/package.sh b/macos-dmg/package.sh index ca7b56b6c0..c24184846f 100755 --- a/macos-dmg/package.sh +++ b/macos-dmg/package.sh @@ -23,13 +23,19 @@ function log() { rm -rf Gaphor.app Gaphor-*.dmg -# Make a virtual env, so we are not bothered with site-packages installed on the host system +VERSION="$(poetry version | cut -d' ' -f2)" -python3 -m venv --copies --prompt Gaphor.app "${RESOURCESDIR}" +# Obtain the Python version from the python dependency. +PYVER="$(brew deps gobject-introspection | grep '^python@' | cut -d@ -f2)" -VERSION="$(poetry version | cut -d' ' -f2)" -PYVER="$(python3 -c 'import sys; print("{}.{}".format(*sys.version_info))')" +test -n "${PYVER}" || { echo "Could not determine Python version!"; exit 1; } +echo "Python version: ${PYVER}" +export LDFLAGS="-L/usr/local/opt/python@${PYVER}/lib" +export PKG_CONFIG_PATH="/usr/local/opt/python@${PYVER}/lib/pkgconfig" + +# Make a virtual env, so we are not bothered with site-packages installed on the host system +"/usr/local/opt/python@${PYVER}/bin/python3" -m venv --copies --prompt Gaphor.app "${RESOURCESDIR}" # Copy all files in the application bundle: From 1fa1f4f7a3d7a574a7721a94846571ff9cf57efe Mon Sep 17 00:00:00 2001 From: Arjan Molenaar Date: Mon, 26 Oct 2020 23:06:26 +0100 Subject: [PATCH 2/2] Run app install via make for macOS As it is for Linux. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f4fbba37ff..8c3329c220 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -178,7 +178,7 @@ jobs: key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} restore-keys: ${{ runner.os }}-poetry- - name: Install Python Dependencies - run: poetry install + run: make install - name: Test with Pytest run: make test-all - name: Create macOS Application