Skip to content

Commit a73d8a2

Browse files
authored
Merge pull request #11 from anki-code/entrypoint
Add python entrypoint
2 parents 39d4c9c + f5267db commit a73d8a2

4 files changed

Lines changed: 12 additions & 1 deletion

File tree

.travis/script.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ set -ex
66
./appimage/build-python.sh python2
77
./appimage/build-python.sh python3
88
./appimage/build-python.sh scipy
9+
./appimage/build-python.sh xonsh
910

1011
python3 -m tests

appimage/recipes/xonsh.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export PYTHON_VERSION="3.7.3"
2+
export PIP_REQUIREMENTS="xonsh prompt_toolkit gnureadline Pygments"
3+
export PYTHON_ENTRYPOINT='"-u" "-c" "from xonsh.main import main; main()"'
4+
export LD_LIBRARY_PATH="AppDir/usr/python/lib/python3.7/site-packages/.libsgnureadline:${LD_LIBRARY_PATH}"

linuxdeploy-plugin-python.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ script=$(readlink -f $0)
2020
exe_name="$(basename ${APPIMAGE:-$script})"
2121
BASEDIR="${APPDIR:-$(readlink -m $(dirname $script))}"
2222

23+
PYTHON_ENTRYPOINT="${PYTHON_ENTRYPOINT:-}"
2324

2425
# Parse the CLI
2526
show_usage () {
@@ -154,6 +155,7 @@ do
154155
cp "${BASEDIR}/share/python-wrapper.sh" "$python"
155156
sed -i "s|[{][{]PYTHON[}][}]|$python|g" "$python"
156157
sed -i "s|[{][{]PREFIX[}][}]|$prefix|g" "$python"
158+
sed -i "s|[{][{]ENTRYPOINT[}][}]|$PYTHON_ENTRYPOINT|g" "$python"
157159
fi
158160
done
159161

share/python-wrapper.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash
22

3+
SCRIPT=`realpath $0`
4+
SCRIPTPATH=`dirname $SCRIPT`
5+
APPDIR="${APPDIR:-$SCRIPTPATH/../..}"
6+
37
# Configure the environment
48
prefix="{{PREFIX}}"
59
export TCL_LIBRARY="${APPDIR}/${prefix}/share/tcltk/tcl"*
@@ -34,5 +38,5 @@ fi
3438
# Wrap the call to Python in order to mimic a call from the source
3539
# executable ($ARGV0), but potentially located outside of the Python
3640
# install ($PYTHONHOME)
37-
(PYTHONHOME="${APPDIR}/${prefix}" exec -a "${executable}" "$APPDIR/${prefix}/bin/${nickname}" "$@")
41+
(PYTHONHOME="${APPDIR}/${prefix}" exec -a "${executable}" "$APPDIR/${prefix}/bin/${nickname}" {{ENTRYPOINT}} "$@")
3842
exit "$?"

0 commit comments

Comments
 (0)