Sitelet https://github.com/niess/linuxdeploy-plugin-python/pull/11/files
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ set -ex
./appimage/build-python.sh python2
./appimage/build-python.sh python3
./appimage/build-python.sh scipy
./appimage/build-python.sh xonsh

python3 -m tests
4 changes: 4 additions & 0 deletions appimage/recipes/xonsh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export PYTHON_VERSION="3.7.3"
export PIP_REQUIREMENTS="xonsh prompt_toolkit gnureadline Pygments"
export PYTHON_ENTRYPOINT='"-u" "-c" "from xonsh.main import main; main()"'
export LD_LIBRARY_PATH="AppDir/usr/python/lib/python3.7/site-packages/.libsgnureadline:${LD_LIBRARY_PATH}"
4 changes: 3 additions & 1 deletion linuxdeploy-plugin-python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ script=$(readlink -f $0)
exe_name="$(basename ${APPIMAGE:-$script})"
BASEDIR="${APPDIR:-$(readlink -m $(dirname $script))}"

PYTHON_ENTRYPOINT="${PYTHON_ENTRYPOINT:-}"

# Parse the CLI
show_usage () {
Expand Down Expand Up @@ -153,6 +154,7 @@ do
cp "${BASEDIR}/share/python-wrapper.sh" "$python"
sed -i "s|[{][{]PYTHON[}][}]|$python|g" "$python"
sed -i "s|[{][{]PREFIX[}][}]|$prefix|g" "$python"
sed -i "s|[{][{]ENTRYPOINT[}][}]|$PYTHON_ENTRYPOINT|g" "$python"
fi
done

Expand All @@ -162,7 +164,7 @@ cd "$APPDIR/${prefix}/bin"
for exe in $(ls "${APPDIR}/${prefix}/bin"*)
do
if [[ -f "$exe" ]] && [[ -x "$exe" ]]; then
sed -i '1s|^#!.*\(python[0-9.]*\)|#!/bin/sh\n"exec" "$(dirname $(readlink -f $\{0\}))/../../bin/\1" "$0" "$@"|' "$exe"
sed -i '1s|^#!.*\(python[0-9.]*\).*|#!/bin/sh\n"exec" "$(dirname $(readlink -f $\{0\}))/../../bin/\1" "$0" "$@"|' "$exe"
fi
done

Expand Down
6 changes: 5 additions & 1 deletion share/python-wrapper.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

SCRIPT=`realpath $0`
SCRIPTPATH=`dirname $SCRIPT`
APPDIR="${APPDIR:-$SCRIPTPATH/../..}"

# Configure the environment
prefix="{{PREFIX}}"
export TCL_LIBRARY="${APPDIR}/${prefix}/share/tcltk/tcl"*
Expand Down Expand Up @@ -34,5 +38,5 @@ fi
# Wrap the call to Python in order to mimic a call from the source
# executable ($ARGV0), but potentially located outside of the Python
# install ($PYTHONHOME)
(PYTHONHOME="${APPDIR}/${prefix}" exec -a "${executable}" "$APPDIR/${prefix}/bin/${nickname}" "$@")
(PYTHONHOME="${APPDIR}/${prefix}" exec -a "${executable}" "$APPDIR/${prefix}/bin/${nickname}" {{ENTRYPOINT}} "$@")
exit "$?"