changeset 722:5afb26b7575a

Further macOS build & test fixes
author Chris Cannam
date Thu, 13 Dec 2018 11:59:18 +0000
parents 744933aba33a
children c39a04fed8b2
files deploy/osx/copy-pyqt.sh deploy/osx/copy-qt.sh deploy/osx/deploy.sh deploy/osx/testrun.sh
diffstat 4 files changed, 104 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deploy/osx/copy-pyqt.sh	Thu Dec 13 11:59:18 2018 +0000
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+set -eu
+
+app="$1"
+if [ -z "$app" ]; then
+	echo "Usage: $0 <appname>"
+	echo "Provide appname without the .app extension, please"
+	exit 2
+fi
+
+PYQT_DIR=/Library/Python/2.7/site-packages/PyQt5
+
+if [ ! -d "$PYQT_DIR" ]; then
+    echo "PyQt directory $PYQT_DIR not found - is it installed?"
+    exit 2
+fi
+
+if [ ! -f "$PYQT_DIR/sip.so" ]; then
+    echo "sip.so not found in $PYQT_DIR - did you remember --sip-module PyQt5.sip when building sip?"
+    exit 2
+fi
+
+ENUM_EGG=/Library/Python/2.7/site-packages/enum34-1.1.6-py2.7.egg
+
+if [ ! -f "$ENUM_EGG" ]; then
+    echo "Enum module egg $ENUM_EGG not found - install it or update the reference in this script"
+    exit 2
+fi
+
+pydir="$app.app/Contents/MacOS/Py2.7"
+mkdir -p "$pydir/PyQt5"
+mkdir -p "$pydir/enum"
+
+echo 
+echo "Copying PyQt libraries..."
+for library in Qt QtCore QtGui QtWidgets sip; do
+    cp "$PYQT_DIR/$library.so" "$pydir/PyQt5/"
+done
+cp "$PYQT_DIR/__init__.py" "$pydir/PyQt5/"
+
+echo
+echo "Copying enum library..."
+( cd "$pydir" ; mkdir -p tmp ; cd tmp ; unzip "$ENUM_EGG" ; cp enum/__init__.py ../enum/ ; cd .. ; rm -rf tmp )
+
+echo "Done"
+
--- a/deploy/osx/copy-qt.sh	Thu Dec 13 11:07:12 2018 +0000
+++ b/deploy/osx/copy-qt.sh	Thu Dec 13 11:59:18 2018 +0000
@@ -1,3 +1,4 @@
+
 #!/bin/bash
 
 set -eu
--- a/deploy/osx/deploy.sh	Thu Dec 13 11:07:12 2018 +0000
+++ b/deploy/osx/deploy.sh	Thu Dec 13 11:59:18 2018 +0000
@@ -35,6 +35,11 @@
 deploy/osx/copy-qt.sh "$app" || exit 2
 
 echo
+echo "Copying in PyQt libraries for use by Hg extension module."
+
+deploy/osx/copy-pyqt.sh "$app" || exit 2
+
+echo
 echo "Fixing up paths."
 
 deploy/osx/paths.sh "$app"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deploy/osx/testrun.sh	Thu Dec 13 11:59:18 2018 +0000
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+app="$1"
+if [ -z "$app" ]; then
+	echo "Usage: $0 <appname>"
+	echo "Provide appname without the .app extension, please"
+	exit 2
+fi
+
+set -eu
+
+qtdir=$(grep "Command:" Makefile | head -1 | awk '{ print $3; }' | sed s,/bin/.*,,)
+
+if [ ! -d "$qtdir" ]; then
+    echo "Failed to discover Qt installation directory from Makefile, exiting"
+    exit 2
+fi
+
+pyqtdir=/Library/Python/2.7/site-packages/PyQt5
+
+if [ ! -d "$pyqtdir" ]; then
+    echo "PyQt directory $pyqtdir not found - is it installed?"
+fi
+
+enumegg=/Library/Python/2.7/site-packages/enum34-1.1.6-py2.7.egg
+
+if [ ! -f "$enumegg" ]; then
+    echo "Enum module egg $enumegg not found - check and maybe update the reference in this script"
+fi
+
+set -x
+
+suffix=$$
+
+move_aside() {
+    sudo mv "$qtdir" "$qtdir"_$suffix
+    sudo mv "$pyqtdir" "$pyqtdir"_$suffix
+    sudo mv "$enumegg" "$enumegg"_$suffix
+}
+
+restore() {
+    sudo mv "$qtdir"_$suffix "$qtdir"
+    sudo mv "$pyqtdir"_$suffix "$pyqtdir"
+    sudo mv "$enumegg"_$suffix "$enumegg"
+}
+
+move_aside
+trap restore 0
+
+"$app.app"/Contents/MacOS/$app
+