diff options
| author | Lex Neva <github.com@lexneva.name> | 2019-04-20 21:55:26 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2019-04-20 22:11:27 -0400 |
| commit | 2c6adea15068ff828344c034142b74883fe6a9ae (patch) | |
| tree | ca20a64a5073393f17bbc6fe3d40f8e5b1b78bca /bin/build-python | |
| parent | d61b99891285ff879cbacdb8e23f9c025efc6a09 (diff) | |
refactor 'make dist' archive creation into a shell script
Diffstat (limited to 'bin/build-python')
| -rwxr-xr-x | bin/build-python | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/bin/build-python b/bin/build-python new file mode 100755 index 00000000..c740c782 --- /dev/null +++ b/bin/build-python @@ -0,0 +1,61 @@ +#!/bin/bash + +set -e + +site_packages="$(python -c "import os; print(os.path.dirname(os.__file__) + '/site-packages')")" + +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 + +# 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 " + +# mac and windows build seem to miss wx import +pyinstaller_args+="--hidden-import wx " + +# We need to use the precompiled bootloader linked with graphical Mac OS X +# libraries if we develop a GUI application for Mac: +if [ "$TRAVIS_OS_NAME" = "osx" ]; then + pyinstaller_args+="--windowed " +fi + +# This lets pyinstaller see inkex.py, etc. +pyinstaller_args+="-p inkscape/share/extensions " + +# output useful debugging info that helps us trace library dependency issues +pyinstaller_args+="--log-level DEBUG " + +if [ "$BUILD" = "windows" ]; then + wine c:\\Python\\scripts\\pyinstaller.exe $pyinstaller_args inkstitch.py +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 --strip inkstitch.py; +fi + +# pyinstaller put a whole mess of libraries under dist/inkstitch. We'd like +# to put some more user-accessible stuff like examples and palettes in +# folders under inkstitch/ (see ../Makefile) so let's move the pyinstaller +# stuff into its own dir. +shopt -s dotglob +mkdir dist/bin +mv dist/inkstitch/* dist/bin +mv dist/bin dist/inkstitch + +# on Mac, pyinstaller creates a .app version as well, but we don't need that +if [ "$TRAVIS_OS_NAME" = "osx" ]; then + rm -rf dist/inkstitch.app/ +fi + +# Inkscape doesn't let us run native binaries as extensions(?!). Instead we +# add this stub script which executes the binary that pyinstaller creates. +cp stub.py dist/inkstitch.py |
