From 6069c0e95595b343ed575a7e47ec608542d729c0 Mon Sep 17 00:00:00 2001 From: Torsten Paul Date: Sun, 9 Mar 2025 21:36:57 +0100 Subject: [PATCH 1/5] Disable tcl/tk --- linuxdeploy-plugin-python.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/linuxdeploy-plugin-python.sh b/linuxdeploy-plugin-python.sh index 03460c9..5405dba 100755 --- a/linuxdeploy-plugin-python.sh +++ b/linuxdeploy-plugin-python.sh @@ -275,16 +275,16 @@ find "lib-dynload" -name '*.so' -type f | while read file; do patch_binary "${fi # Copy any TCl/Tk shared data -if [[ ! -d "${APPDIR}/${prefix}/share/tcltk" ]]; then - if [[ -d "/usr/share/tcltk" ]]; then - mkdir -p "${APPDIR}/${prefix}/share" - cp -r "/usr/share/tcltk" "${APPDIR}/${prefix}/share" - else - mkdir -p "${APPDIR}/${prefix}/share/tcltk" - tclpath="$(ls -d /usr/share/tcl* | tail -1)" - tkpath="$(ls -d /usr/share/tk* | tail -1)" - for path in "${tclpath}" "${tkpath}"; do - cp -r "${path}" "${APPDIR}/${prefix}/share/tcltk" - done - fi -fi +#if [[ ! -d "${APPDIR}/${prefix}/share/tcltk" ]]; then +# if [[ -d "/usr/share/tcltk" ]]; then +# mkdir -p "${APPDIR}/${prefix}/share" +# cp -r "/usr/share/tcltk" "${APPDIR}/${prefix}/share" +# else +# mkdir -p "${APPDIR}/${prefix}/share/tcltk" +# tclpath="$(ls -d /usr/share/tcl* | tail -1)" +# tkpath="$(ls -d /usr/share/tk* | tail -1)" +# for path in "${tclpath}" "${tkpath}"; do +# cp -r "${path}" "${APPDIR}/${prefix}/share/tcltk" +# done +# fi +#fi From 6ae095ae781efb8c0b87068accf359b11b1e4e7c Mon Sep 17 00:00:00 2001 From: Torsten Paul Date: Sun, 9 Mar 2025 21:37:44 +0100 Subject: [PATCH 2/5] Change prefix to just /usr --- linuxdeploy-plugin-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linuxdeploy-plugin-python.sh b/linuxdeploy-plugin-python.sh index 5405dba..10b1cdf 100755 --- a/linuxdeploy-plugin-python.sh +++ b/linuxdeploy-plugin-python.sh @@ -20,7 +20,7 @@ script=$(readlink -f $0) exe_name="$(basename ${APPIMAGE:-$script})" BASEDIR="${APPDIR:-$(readlink -m $(dirname $script))}" -prefix="usr/python" +prefix="usr" # Parse the CLI From fdc69eed718389e1ccd8ee17918f6b0f69579046 Mon Sep 17 00:00:00 2001 From: Torsten Paul Date: Sun, 9 Mar 2025 21:46:53 +0100 Subject: [PATCH 3/5] Handle minor versions > 9 --- linuxdeploy-plugin-python.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linuxdeploy-plugin-python.sh b/linuxdeploy-plugin-python.sh index 10b1cdf..7201527 100755 --- a/linuxdeploy-plugin-python.sh +++ b/linuxdeploy-plugin-python.sh @@ -111,7 +111,7 @@ fi # Install Python from source, if not already in the AppDir set +e -python=$(ls "${APPDIR}/${prefix}/bin/python"?"."?) +python=$(ls "${APPDIR}/${prefix}/bin/python"?"."*|grep "[0-9]$") set -e if [[ -x "${python}" ]]; then @@ -149,7 +149,7 @@ else fi cd "${APPDIR}/${prefix}/bin" -PYTHON_X_Y=$(ls "python"?"."?) +PYTHON_X_Y=$(ls "python"?"."*|grep "[0-9]$") # Install any extra requirements with pip From 3603e52f9129b5f48618fafeb78c4be01d25f772 Mon Sep 17 00:00:00 2001 From: Torsten Paul Date: Sun, 9 Mar 2025 21:54:25 +0100 Subject: [PATCH 4/5] Try without executable wrapper --- linuxdeploy-plugin-python.sh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/linuxdeploy-plugin-python.sh b/linuxdeploy-plugin-python.sh index 7201527..867bec4 100755 --- a/linuxdeploy-plugin-python.sh +++ b/linuxdeploy-plugin-python.sh @@ -167,21 +167,21 @@ rm -rf "bin/python"*"-config" "bin/idle"* "lib/pkgconfig" \ # Wrap the Python executables -cd "$APPDIR/${prefix}/bin" -set +e -pythons=$(ls "python" "python"? "python"?"."? "python"?"."?"m" 2>/dev/null) -set -e -mkdir -p "$APPDIR/usr/bin" -cd "$APPDIR/usr/bin" -for python in $pythons -do - if [[ ! -L "$python" ]]; then - strip "$APPDIR/${prefix}/bin/${python}" - cp "${BASEDIR}/share/python-wrapper.sh" "$python" - sed -i "s|[{][{]PYTHON[}][}]|$python|g" "$python" - sed -i "s|[{][{]PREFIX[}][}]|$prefix|g" "$python" - fi -done +#cd "$APPDIR/${prefix}/bin" +#set +e +#pythons=$(ls "python" "python"? "python"?"."? "python"?"."?"m" 2>/dev/null) +#set -e +#mkdir -p "$APPDIR/usr/bin" +#cd "$APPDIR/usr/bin" +#for python in $pythons +#do +# if [[ ! -L "$python" ]]; then +# strip "$APPDIR/${prefix}/bin/${python}" +# cp "${BASEDIR}/share/python-wrapper.sh" "$python" +# sed -i "s|[{][{]PYTHON[}][}]|$python|g" "$python" +# sed -i "s|[{][{]PREFIX[}][}]|$prefix|g" "$python" +# fi +#done # Sanitize the shebangs of local Python scripts @@ -195,11 +195,11 @@ done # Set a hook in Python for cleaning the path detection -cp "$BASEDIR/share/sitecustomize.py" "$APPDIR"/${prefix}/lib/python*/site-packages +cp "$BASEDIR/sitecustomize.py" "$APPDIR"/${prefix}/lib/python*/site-packages # Patch binaries and install dependencies -excludelist="${BASEDIR}/share/excludelist" +excludelist="${BASEDIR}/excludelist" if [[ ! -f "${excludelist}" ]]; then pushd "${BASEDIR}" wget -cq --no-check-certificate "https://raw.githubusercontent.com/probonopd/AppImages/master/excludelist" From db6af2f589ca4a6f94f79a4d1cd608f5d6a67a10 Mon Sep 17 00:00:00 2001 From: Torsten Paul Date: Sun, 9 Mar 2025 23:14:41 +0100 Subject: [PATCH 5/5] Allow setting python version via envronment variable --- linuxdeploy-plugin-python.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linuxdeploy-plugin-python.sh b/linuxdeploy-plugin-python.sh index 867bec4..fd9a38c 100755 --- a/linuxdeploy-plugin-python.sh +++ b/linuxdeploy-plugin-python.sh @@ -13,8 +13,8 @@ PIP_OPTIONS="${PIP_OPTIONS:---upgrade}" PIP_REQUIREMENTS="${PIP_REQUIREMENTS:-}" PYTHON_BUILD_DIR="${PYTHON_BUILD_DIR:-}" PYTHON_CONFIG="${PYTHON_CONFIG:-}" -version="3.8.2" -PYTHON_SOURCE="${PYTHON_SOURCE:-https://www.python.org/ftp/python/${version}/Python-${version}.tgz}" +PYTHON_VERSION="${PYTHON_VERSION:-3.10.12}" +PYTHON_SOURCE="${PYTHON_SOURCE:-https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz}" script=$(readlink -f $0) exe_name="$(basename ${APPIMAGE:-$script})"