Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix absolute paths in scripts #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

knarfS
Copy link
Contributor

@knarfS knarfS commented Jun 11, 2021

This removes some of the wrong paths pointing to the build location of the
AppImage by using a different shebang and some environment variables.

Fixes #12, Fixes #25 and Fixes #32

I left out some of the scripts, like:

  • AppDir/usr/conda/shell/condabin/conda-hook.ps1: No need for Powershell
  • AppDir/usr/conda/conda-meta/*.json: dunno...
  • AppDir/usr/conda/lib/*/*.sh: Some config scripts, not needed I suppose?
  • AppDir/usr/conda/lib/pkgconfig/*.pc: pkg-config files, not needed and no idea how to fix them.
  • AppDir/usr/conda/lib/python3.8/*/*.py: dunno...

I only have a base install of conda with no extra packages, so probably not all possible files are covered.
Also some of the regex could be a little bit more sophisticated...

@knarfS knarfS force-pushed the paths branch 3 times, most recently from 8df6f50 to 07491c6 Compare June 12, 2021 18:37
This removes some of the wrong, absolute paths pointing to the build location
of the AppImage by using a different shebang and some environment variables,
set by the linuxdeploy-plugin-conda-hook at the AppImage start.

Fixes linuxdeploy#12, fixes linuxdeploy#25 and fixes linuxdeploy#32
@knarfS
Copy link
Contributor Author

knarfS commented Jun 25, 2021

I've added an additional replacement for 32bit conda installations.

# export APPDIR variable to allow for running from extracted AppDir as well
export APPDIR="${APPDIR:-$(readlink -f "$(dirname "$0")")}"
# export PATH to allow /usr/bin/env shebangs to use the supplied applications
export PATH="$APPDIR"/usr/bin:"$PATH"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break calling any sorts of external tools, because they'll then also have to use all tools contained in the AppDir. Can you think of a different solution perhaps? The use of environment variables like PATH and LD_LIBRARY_PATH is actually an antipattern and has to be done with great care.

To limit the effects, one possible solution would be to create a separate bin dir somewhere in the AppDir that only points to the bundled Python binary/binaries, but none of the other stuff in AppDir/usr/bin. But that's also a hack. I think you could even further limit the effects by generating some sort of unique name for the symlink to the main binary. Then, you can safely use /usr/bin/env linuxdeploy-plugin-conda-python or something like that with bundled tools.

Of course, bundled scripts that just point to /usr/bin/env python would still fail to run. But I'm not sure that issue can be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Activating Conda Environment Runs the system-installed Python $HOME ends up hardcoded in shebangs
2 participants