annotate deploy/osx/copy-pyqt.sh @ 731:2cb03c4665aa

Include kdiff3 executable in bundle on macOS
author Chris Cannam
date Mon, 17 Dec 2018 11:18:55 +0000
parents c59c17665162
children
rev   line source
Chris@722 1 #!/bin/bash
Chris@722 2
Chris@722 3 app="$1"
Chris@722 4 if [ -z "$app" ]; then
Chris@722 5 echo "Usage: $0 <appname>"
Chris@722 6 echo "Provide appname without the .app extension, please"
Chris@722 7 exit 2
Chris@722 8 fi
Chris@722 9
Chris@731 10 set -eu
Chris@731 11
Chris@722 12 PYQT_DIR=/Library/Python/2.7/site-packages/PyQt5
Chris@722 13
Chris@722 14 if [ ! -d "$PYQT_DIR" ]; then
Chris@722 15 echo "PyQt directory $PYQT_DIR not found - is it installed?"
Chris@722 16 exit 2
Chris@722 17 fi
Chris@722 18
Chris@722 19 if [ ! -f "$PYQT_DIR/sip.so" ]; then
Chris@722 20 echo "sip.so not found in $PYQT_DIR - did you remember --sip-module PyQt5.sip when building sip?"
Chris@722 21 exit 2
Chris@722 22 fi
Chris@722 23
Chris@722 24 ENUM_EGG=/Library/Python/2.7/site-packages/enum34-1.1.6-py2.7.egg
Chris@722 25
Chris@722 26 if [ ! -f "$ENUM_EGG" ]; then
Chris@722 27 echo "Enum module egg $ENUM_EGG not found - install it or update the reference in this script"
Chris@722 28 exit 2
Chris@722 29 fi
Chris@722 30
cannam@724 31 pydir="$app.app/Contents/MacOS/Py27"
Chris@722 32 mkdir -p "$pydir/PyQt5"
Chris@722 33 mkdir -p "$pydir/enum"
Chris@722 34
Chris@722 35 echo
Chris@722 36 echo "Copying PyQt libraries..."
Chris@722 37 for library in Qt QtCore QtGui QtWidgets sip; do
Chris@722 38 cp "$PYQT_DIR/$library.so" "$pydir/PyQt5/"
Chris@722 39 done
Chris@722 40 cp "$PYQT_DIR/__init__.py" "$pydir/PyQt5/"
Chris@722 41
Chris@722 42 echo
Chris@722 43 echo "Copying enum library..."
Chris@722 44 ( cd "$pydir" ; mkdir -p tmp ; cd tmp ; unzip "$ENUM_EGG" ; cp enum/__init__.py ../enum/ ; cd .. ; rm -rf tmp )
Chris@722 45
Chris@722 46 echo "Done"
Chris@722 47