2018-01-14 01:18:50 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
site_packages="$(python -c "import os; print(os.path.dirname(os.__file__) + '/site-packages')")"
|
|
|
|
|
2018-02-20 02:43:39 +00:00
|
|
|
if [ "$TRAVIS_OS_NAME" = "linux" -a "$BUILD" != "windows" ]; then
|
|
|
|
# pyinstaller misses these two
|
|
|
|
pyinstaller_args+="--add-binary /usr/lib/x86_64-linux-gnu/gio/modules/libgiolibproxy.so:. "
|
|
|
|
pyinstaller_args+="--add-binary /usr/lib/x86_64-linux-gnu/libproxy.so.1:. "
|
|
|
|
fi
|
2018-01-14 01:18:50 +00:00
|
|
|
|
|
|
|
# This one's tricky. ink/stitch doesn't actually _use_ gi.repository.Gtk,
|
|
|
|
# but it does use GTK (through wxPython). pyinstaller has some special
|
|
|
|
# logic to handle GTK apps that is engaged when you import
|
|
|
|
# gi.repository.Gtk that pulls in things like themes, icons, etc. Without
|
|
|
|
# that, the Params dialog is unthemed and barely usable. This hidden
|
|
|
|
# import option is actually the only reason we had to install python-gi
|
|
|
|
# above!
|
|
|
|
pyinstaller_args+="--hidden-import gi.repository.Gtk "
|
|
|
|
|
2018-02-20 02:43:39 +00:00
|
|
|
# mac and windows build seem to miss wx and libembroidery import
|
|
|
|
pyinstaller_args+="--hidden-import wx --hidden-import libembroidery "
|
|
|
|
|
|
|
|
if [ -d windows-libembroidery ]; then
|
|
|
|
pyinstaller_args+="-p windows-libembroidery "
|
|
|
|
else
|
|
|
|
pyinstaller_args+="-p embroidermodder/experimental/python/binding "
|
|
|
|
fi
|
2018-01-14 01:18:50 +00:00
|
|
|
|
2018-02-20 02:43:39 +00:00
|
|
|
# This lets pyinstaller see inkex.py, etc.
|
|
|
|
pyinstaller_args+="-p inkscape-0.92.2/share/extensions "
|
2018-01-24 01:13:37 +00:00
|
|
|
|
2018-01-14 01:18:50 +00:00
|
|
|
mkdir -p dist/inkstitch/bin
|
|
|
|
for extension in "$@"; do
|
2018-02-20 02:43:39 +00:00
|
|
|
if [ "$BUILD" = "windows" ]; then
|
2018-02-23 04:06:27 +00:00
|
|
|
wine c:\\Python\\scripts\\pyinstaller.exe $pyinstaller_args ${extension}.py
|
2018-02-20 02:43:39 +00:00
|
|
|
else
|
|
|
|
# without the LD_LIBRARY_PATH, it seems that pyinstaller can't find all of
|
|
|
|
# wxpython's shared libraries
|
|
|
|
LD_LIBRARY_PATH="${site_packages}/wx" pyinstaller $pyinstaller_args ${extension}.py;
|
|
|
|
fi
|
2018-01-14 01:18:50 +00:00
|
|
|
|
|
|
|
# By default, pyinstaller will treat each of ink/stitch's extensions
|
|
|
|
# separately. This means it packages a lot of the same shared libraries (like
|
|
|
|
# wxPython) multiple times. Turns out that we can just copy the contents of
|
|
|
|
# the directories pyinstaller creates into one and it works fine, eliminating
|
|
|
|
# the duplication. This significantly decreases the size of the inkstitch
|
|
|
|
# tarball/zip.
|
|
|
|
cp -a dist/${extension}/* dist/inkstitch/bin
|
|
|
|
rm -rf dist/${extension}
|
|
|
|
|
|
|
|
# Inkscape doesn't let us run native binaries as extensions(?!). Instead we
|
|
|
|
# add this stub script which executes the binaries that pyinstaller creates.
|
|
|
|
cp stub.py dist/${extension}.py
|
|
|
|
done
|