cutter/scripts/appbundle_embed_python.sh
Florian Märkl 732f2d8cde
Use cutter-deps on macOS ()
* Update deps scripts for macOS

* Update deps

* Update appbundle_embed_python.sh

* Use cutter-deps for macOS

* Remove qt from Brewfile

* Fix .travis.yml

* Disable Homebrew update

* Fix llvm for macOS

* Fix regex in update_deps.py

* Fix PYTHON_FRAMEWORK_DIR

* Some debug output in travis

* Enable Python Bindings for cmake on macOS

* QMake debug

* Update deps

* Hopefully fix pkg-config

* QMake hack for shiboken2 and pyside2

* Deploy on deps-test

* Update deps

* Fix call to appbundle_embed_python.sh

* Update deps

* Fix Python for cmake on macOS

* Update deps

* Fix appbundle_embed_python.sh

* Copy pyside libs in appbundle_embed_python.sh

* Fix includes for CMake on macOS

* Copy PySide2 and Shiboke2 libs to Frameworks dir

* Manually deploy QtDBus and QtPrintSupport

* Print plugins dir

* Fix appbundle_embed_python.sh

* Update deps

* Remove some debug output

* Use last release of linuxdeployqt
2019-03-09 00:01:24 +01:00

41 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
if ! [[ $# -eq 3 ]]; then
echo "Usage: $0 [Python.framework] [AppBundle.app] [AppBundle.app/Contents/MacOS/Executable]"
exit 1
fi
python_version=python3.6
py_framework=$1
appbundle=$2
executable=$3
echo "Embedding $py_framework into $appbundle"
mkdir -p "$appbundle/Contents/Frameworks" || exit 1
cp -a "$py_framework" "$appbundle/Contents/Frameworks/" || exit 1
echo "Making executable $executable point to embedded Framework"
install_name_tool -change `otool -L "$executable" | sed -n "s/^[[:blank:]]*\([^[:blank:]]*Python\) (.*$/\1/p"` @executable_path/../Frameworks/Python.framework/Versions/Current/Python "$executable"
echo "Cleaning up embedded Python Framework"
cd "$appbundle/Contents/Frameworks/Python.framework" || exit 1
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf || exit 1
rm -r Versions/Current/Resources/* Versions/Current/lib/python3.6/test Versions/Current/lib/python3.6/idlelib Versions/Current/lib/python3.6/curses Versions/Current/lib/python3.6/lib2to3 || exit 1
echo "Checking if PySide2 is available"
pyside_prefix=$(pkg-config --variable=prefix pyside2)
if [ $? -ne 0 ]; then
echo "PySide2 is not available, ignoring."
exit 0
fi
echo "PySide is at $pyside_prefix"
cp -va "$pyside_prefix/lib/$python_version/" "Versions/Current/lib/$python_version" || exit 1
cd .. # $appbundle/Contents/Frameworks
cp -va "$pyside_prefix/lib/"*.dylib . || exit 1