5afb26b7575a — Chris Cannam 2 years ago
Further macOS build & test fixes
4 files changed, 104 insertions(+), 0 deletions(-)

A => deploy/osx/copy-pyqt.sh
M deploy/osx/copy-qt.sh
M deploy/osx/deploy.sh
A => deploy/osx/testrun.sh
A => deploy/osx/copy-pyqt.sh +47 -0
@@ 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"
+

          
M deploy/osx/copy-qt.sh +1 -0
@@ 1,3 1,4 @@ 
+
 #!/bin/bash
 
 set -eu

          
M deploy/osx/deploy.sh +5 -0
@@ 35,6 35,11 @@ echo "Copying in frameworks and plugins 
 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"

          
A => deploy/osx/testrun.sh +51 -0
@@ 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
+