shaunvxc / envy

:memo: safely make edits and sync local changes to files living in the site-packages of your virtualenvs
MIT License
39 stars 3 forks source link

Check for alternate Virtualenv locations #1

Closed andrewgross closed 8 years ago

andrewgross commented 8 years ago

You can check the WORKON_HOME environmental variable to see where the virtualenvs should be managed from. For some strange reason I set mine to ~/.envs which makes things break from time to time.

shaunvxc commented 8 years ago

So, to find the path to where the package sits, we use: imp.find_module(get_package_name(pkg_path))[1] --

find module SHOULD be able to handle wherever the virtualenv is (at least that's what I thought...)

Was it breaking for you?

andrewgross commented 8 years ago

I was looking at https://github.com/shaunvxc/envy/blob/master/envy/application.py#L46

shaunvxc commented 8 years ago

Ah good point. Question though, is WORKON_HOME tied to .virtualenv wrapper? (obviously my current approach also assumes this sort of convention). I wonder if there is a better check we can make..?

shaunvxc commented 8 years ago

@andrewgross do you think looking up in os.environ would be reliable?

i.e.:

if 'VIRTUAL_ENV' in os.environ:
         return os.environ['VIRTUAL_ENV'].split('/')[-1]`
else:
    # default to the current check
shaunvxc commented 8 years ago

@andrewgross version 0.0.6 (see 28e399cff74d7bf346a4c912bff9113555305726) should handle your case

andrewgross commented 8 years ago

Awesome, thanks!

Andrew Gross andrew.w.gross@gmail.com

On Thu, Feb 25, 2016 at 1:30 AM, Shaun Viguerie notifications@github.com wrote:

Closed #1 https://github.com/shaunvxc/envy/issues/1.

— Reply to this email directly or view it on GitHub https://github.com/shaunvxc/envy/issues/1#event-565028739.