Skip to content

Commit

Permalink
AppImage: fixed Jupyter and ILua modes on all but my own system
Browse files Browse the repository at this point in the history
* We cannot use the Pip-installed launchers since they have hardcoded paths.
  Instead we reference python3 explicitly in the /usr/bin/applause launcher.
* For some strange reason, the site-packages directory where all of the relevant packages are put
  is not in sys.path. So also export it via $PYTHONPATH.
  • Loading branch information
rhaberkorn committed May 21, 2024
1 parent ebd28ee commit bd705fe
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions AppImage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ script:
# Install Jupyter notebooks...
- virtualenv --python=python3 ./usr
- ./usr/bin/pip3 install --no-input notebook twisted==22.10.0 git+https://github.com/rhaberkorn/ilua.git@improvements
# This custom launcher starts the notebook by default but allows launching the plain CLI as well:
- cat >./usr/bin/applause <<EOF
# This custom launcher starts the notebook by default but allows launching the plain CLI as well.
# NOTE: The Pip-installed hash-bang lines hard code paths from the build system.
- cat >./usr/bin/applause <<\EOF
- #!/bin/sh
- HERE="$(dirname "$(readlink -f "${0}")")"
- HERE="$(dirname "$(readlink -f "$0")")"
- APPDIR=$(readlink -f "$HERE/../../")
- export PYTHONPATH="$APPDIR/usr/lib/python3.8/site-packages"
- cd ~/
- if [ "\$1" = cli ]; then shift; exec lua "\$@"; fi
- if [ "\$1" = ilua ]; then shift; exec python3 "$APPDIR/usr/bin/ilua" "\$@"; fi
- exec python3 "$APPDIR/usr/bin/jupyter" notebook --MultiKernelManager.default_kernel_name=lua "\$@"
- if [ "$1" = cli ]; then shift; exec lua "$@"; fi
- if [ "$1" = ilua ]; then shift; exec python3 "$APPDIR/usr/bin/ilua" "$@"; fi
- exec python3 "$APPDIR/usr/bin/jupyter" notebook --MultiKernelManager.default_kernel_name=lua "$@"
- EOF
- chmod a+x ./usr/bin/applause
# Some thinning - remove unneeded files
Expand Down

0 comments on commit bd705fe

Please sign in to comment.