linuxdeploy/linuxdeploy-plugin-conda

Files do not end up in usr/conda/share/...

probonopd opened this issue · 12 comments

Trying to make an AppImage for GPodder with

#! /bin/bash

sudo apt -y install git pkg-config libcairo2-dev gobject-introspection libgirepository1.0-dev libdbus-1-dev

export VERSION=$(wget -q "https://api.github.com/repos/gpodder/gpodder/commits?sha=master" -O - | grep sha | head -n 1 | cut -d '"' -f 4 | head -c 7
)

export APPNAME=gpodder
export PIP_REQUIREMENTS="eyeD3 html5lib webencodings certifi six dbus-python pycairo pygobject mygpoclient podcastparser -e git+https://github.com/gpodder/gpodder#egg=$APPNAME"
# export CONDA_CHANNELS="conda-forge"
# export CONDA_PACKAGES=";;"  # Only use this if the package is in a Conda channel (e.g., conda-forge); can also be used for dependencies if the main application has no depends.txt

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

rm -r AppDir || true

wget -c "https://github.com/gpodder/gpodder/raw/master/share/applications/gpodder.desktop.in"
sed -i -e 's|^_||g' *.in # FIXME
sed -i -e 's|__PREFIX__/bin/||g' *.in # FIXME
mv *.in gpodder.desktop

cat > AppRun <<\EOF
#!/bin/bash
HERE="$(dirname "$(readlink -f "${0}")")"
exec "$HERE/usr/conda/bin/python" "$HERE/usr/conda/bin/gpodder" "$@"
EOF
chmod +x AppRun

wget -c "https://github.com/gpodder/gpodder/raw/master/share/icons/hicolor/64x64/apps/gpodder.png" -O $APPNAME.png
# convert app.png -resize 512x512 $APPNAME.png

./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin conda -i $APPNAME.png -d $(readlink -f "$APPNAME.desktop") --custom-apprun AppRun --output appimage

Getting

1547894800.128399 [gpodder.gtkui.main] ERROR: Cannot find gtk/menus.ui in ['/home/me/squashfs-root/usr/conda/share/gpodder/ui/gtk', '/home/me/squashfs-root/usr/conda/share/gpodder/ui'], exiting

And indeed usr/conda/share/gpodder is missing entirely.

You must open an issue over there, if you want their setup.py to install stuff into specific locations.

They say they can't reproduce: gpodder/gpodder#596 (comment)

Looks like we need to use pip install --install-option='--prefix="${HERE}/usr/conda/"'?

This also works for me:

> cd gPodder
> pip -v install --prefix /tmp/gpoinstall .
> ls /tmp/gpoinstall/share/gpodder/ui/gtk/
gpodderaddpodcast.ui (...)

Not quite a bug, if any, it's an enhancement. Please send a PR, @probonopd.

PR #18 broke the Pext build (see Pext/Pext#159 and AppImage/appimage.github.io#1237). Can this be reverted if it didn't fix the issue, or otherwise at least be made an environment variable? I'd rather not force the Pext build process to a specific old commit of this repo unless absolutely necessary.

@TheLastProject I'm sorry I didn't get to replying here yet, but I had debugged your script on the weekend, too, and you're absolutely right, this is what broke your builds. I will introduce an env var that allows for switching this on.

@probonopd @elelay please set PIP_PREFIX=<AppDir>/usr/conda in your build scripts.

Will do it, thanks :-)

Sorry for having broken something, feel free to revert #18 @TheAssassin @TheLastProject

Not your fault, @probonopd, more like a misconception in many PyPI packages, I'd say. I was already a bit suspicious of the flag (I have made Python packages myself and never needed some sort of prefix option), but I didn't expect any package to not want to install any more, but rather some other weirdness during installation.

Shipping Python applications isn't too easy, as we all know. The plugin helps with this, but it's often quite a challenge. The plugin here trades small AppImage sizes for more reliable packaging, which is better than otherwise in my opinion.

No need to revert #18, master already contains a fix, and @elelay already applied it in their scripts I guess.

Closing as resolved.