linuxdeploy-plugin-conda icon indicating copy to clipboard operation
linuxdeploy-plugin-conda copied to clipboard

Runs the system-installed Python

Open probonopd opened this issue 6 years ago • 4 comments

If we bundle a script that uses !/usr/bin/env python, then we end up running the system-installed Python rather the bundled one. We need some sort of a wrapper to set up $PATH at least.

wget -c "https://raw.githubusercontent.com/TheAssassin/linuxdeploy-plugin-conda/master/linuxdeploy-plugin-conda.sh"
wget -c "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
chmod +x linuxdeploy-x86_64.AppImage linuxdeploy-plugin-conda.sh

wget -c "https://raw.githubusercontent.com/probonopd/ptouch-770/patch-1/ptouch-770.desktop"
cp /usr/share/icons/gnome/256x256/devices/printmgr.png .
rm -rf ./_temp_home AppDir/ || true
mkdir -p AppDir/usr/bin
wget -c "https://raw.githubusercontent.com/probonopd/ptouch-770/patch-1/ptouch-770-gui" -O AppDir/usr/bin/ptouch-770-gui
chmod +x AppDir/usr/bin/*

export CONDA_CHANNELS=ostrokach CONDA_PACKAGES=gtk;pil;pyusb

./linuxdeploy-x86_64.AppImage --appdir AppDir -d ptouch-770.desktop  --plugin conda --output appimage -i printmgr.png 

./P-touch_P700_Labels-x86_64.AppImage

probonopd avatar Jun 09 '19 12:06 probonopd

Duplicate of/related to https://github.com/linuxdeploy/linuxdeploy-plugin-conda/issues/12.

This can't be done simply, since we cannot guess the path of the Python installation in the AppDir, the paths in shebangs are either absolute or it's about things in $PATH, as you stated. Can you evaluate other commands or environment variables in a shebang? Then $APPDIR/usr/bin/python or $(readlink -f .)/python or so might work.

TheAssassin avatar Jun 09 '19 12:06 TheAssassin

As stated in #12, Python scripts should never call each other "directly", as that's anything but portable. And for running at first, python -m "name_of_module" is usually good enough.

If either of the solutions above works (I'd favor the $APPDIR one) that'd be a great step forward and we could also fix #12 with that.

TheAssassin avatar Jun 09 '19 12:06 TheAssassin

I think we need some sort of AppRun, no?

probonopd avatar Jun 09 '19 13:06 probonopd

Yes, it's needed with this. But the solution is not really to export any variables. That only works when the shebang uses /usr/bin/env or doesn't specify an absolute path altogether. The proper solution for #12 would be to replace the shebangs, and that likely also makes the need for an AppRun obsolete so it could solve #25, too.

TheAssassin avatar Jun 09 '19 13:06 TheAssassin