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

Make --relocatable even more relocatable #558

Closed
omribahumi opened this issue Jan 29, 2014 · 8 comments
Closed

Make --relocatable even more relocatable #558

omribahumi opened this issue Jan 29, 2014 · 8 comments

Comments

@omribahumi
Copy link

Apparently even when running virtualenv --relocatable on my virtualenv, it's still not entirely relocatable:

  1. Links in ${VIRTUAL_ENV}/local are absolute instead of symbolic
  2. VIRTUAL_ENV environment variable defined in bin/activate is hard-coded

I'm thinking of fixing these myself, here's how I thought of doing it:

  1. Walk the virtualenv directory tree, make all absolute links to destinations inside the virtualenv relative (absolute links to paths outside of the virtualenv root will stay absolute)
  2. Replace hard-coded virtualenv path with bash magic (similar to this):
VIRTUAL_ENV="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"

Any thoughts?

Omri.

@nukemberg
Copy link

+1

@elistevens
Copy link

@omribahumi have you started on this?

Is there a reason those links aren't relative to start with? It's not clear if there's a firm reason why virtualenvs don't start off relocatable.

@omribahumi
Copy link
Author

@wickedgrey I wrote an external script to update the relevant files. I didn't want to maintain a fork of virtualenv.

I see no reason not to make the links symbolic globally, as you said.
One more thing we should consider is /bin/sh compatibility. My 2nd suggestion involves a BASH trick that doesn't work with /bin/sh.

We can add a new activate script though: activate.bash

@franciscolourenco
Copy link

+1

1 similar comment
@kairichard
Copy link

+1

@dbarbeau
Copy link

dbarbeau commented Jul 22, 2016

Yes, the bash activate script should set VIRTUAL_ENV with bash magic. This would help a ton when packaging our projects for use with external tools like uwsgi. So a huge +1.

However, as stated earlier, this doesn't concern --relocatable, but activate which should be modified with that black magic.

Are there strong motivations against this change?

@arizvisa
Copy link

Adding a reference to the newest issue #1067 related to this to help consolidate efforts on solving this half-decade old problem with the activation scripts.

@stale
Copy link

stale bot commented Jan 14, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Just add a comment if you want to keep it open. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 14, 2019
@stale stale bot closed this as completed Jan 21, 2019
@pypa pypa locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants