Chris@722: #!/bin/bash Chris@722: Chris@722: app="$1" Chris@722: if [ -z "$app" ]; then Chris@722: echo "Usage: $0 " Chris@722: echo "Provide appname without the .app extension, please" Chris@722: exit 2 Chris@722: fi Chris@722: Chris@722: set -eu Chris@722: Chris@722: qtdir=$(grep "Command:" Makefile | head -1 | awk '{ print $3; }' | sed s,/bin/.*,,) Chris@722: Chris@722: if [ ! -d "$qtdir" ]; then Chris@722: echo "Failed to discover Qt installation directory from Makefile, exiting" Chris@722: exit 2 Chris@722: fi Chris@722: Chris@722: pyqtdir=/Library/Python/2.7/site-packages/PyQt5 Chris@722: Chris@722: if [ ! -d "$pyqtdir" ]; then Chris@722: echo "PyQt directory $pyqtdir not found - is it installed?" Chris@722: fi Chris@722: Chris@722: enumegg=/Library/Python/2.7/site-packages/enum34-1.1.6-py2.7.egg Chris@722: Chris@722: if [ ! -f "$enumegg" ]; then Chris@722: echo "Enum module egg $enumegg not found - check and maybe update the reference in this script" Chris@722: fi Chris@722: Chris@722: set -x Chris@722: Chris@722: suffix=$$ Chris@722: Chris@722: move_aside() { Chris@722: sudo mv "$qtdir" "$qtdir"_$suffix Chris@722: sudo mv "$pyqtdir" "$pyqtdir"_$suffix Chris@722: sudo mv "$enumegg" "$enumegg"_$suffix Chris@722: } Chris@722: Chris@722: restore() { Chris@722: sudo mv "$qtdir"_$suffix "$qtdir" Chris@722: sudo mv "$pyqtdir"_$suffix "$pyqtdir" Chris@722: sudo mv "$enumegg"_$suffix "$enumegg" Chris@722: } Chris@722: Chris@722: move_aside Chris@722: trap restore 0 Chris@722: Chris@722: "$app.app"/Contents/MacOS/$app Chris@722: