davidmarble / virtualenvwrapper-win

Port of Doug Hellmann's virtualenvwrapper to Windows batch scripts
Other
461 stars 106 forks source link

Global site packages still ignored in v1.1.3 #29

Closed felciano closed 11 years ago

felciano commented 11 years ago

I am following up on https://github.com/davidmarble/virtualenvwrapper-win/issues/27 and am still not able to inherit global site packages in a new virtualenv on windows. I have done a fresh install of pip (1.3.1), distribute (0.6.35), virtualenv (1.9.1), and virtualenvwrapper-win (1.1.3). I still do not see any visible difference in packages before and after toggling the global site package status:

C:\Dropbox\Code>mkvirtualenv toggletest
PYTHONHOME is set.  You *must* activate the virtualenv before using it
New python executable in toggletest\Scripts\python.exe
Installing setuptools................done.
Installing pip...................done.

(toggletest) C:\Dropbox\Code>lssitepackages

dir /b "C:\Dropbox\Code\virtualenvs\toggletest\Lib\site-packages"
==============================================================================
easy-install.pth
pip-1.3.1-py2.7.egg
setuptools-0.6c11-py2.7.egg
setuptools.pth

C:\Dropbox\Code\virtualenvs\toggletest\Lib\site-packages\easy-install.pth
==============================================================================
import sys; sys.__plen = len(sys.path)
./setuptools-0.6c11-py2.7.egg
./pip-1.3.1-py2.7.egg
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)

(toggletest) C:\Dropbox\Code>toggleglobalsitepackages

    Enabled global site-packages

(toggletest) C:\Dropbox\Code>lssitepackages

dir /b "C:\Dropbox\Code\virtualenvs\toggletest\Lib\site-packages"
==============================================================================
easy-install.pth
pip-1.3.1-py2.7.egg
setuptools-0.6c11-py2.7.egg
setuptools.pth

C:\Dropbox\Code\virtualenvs\toggletest\Lib\site-packages\easy-install.pth
==============================================================================
import sys; sys.__plen = len(sys.path)
./setuptools-0.6c11-py2.7.egg
./pip-1.3.1-py2.7.egg
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)

(toggletest) C:\Dropbox\Code>toggleglobalsitepackages

    Disabled global site-packages

(toggletest) C:\Dropbox\Code>lssitepackages

dir /b "C:\Dropbox\Code\virtualenvs\toggletest\Lib\site-packages"
==============================================================================
easy-install.pth
pip-1.3.1-py2.7.egg
setuptools-0.6c11-py2.7.egg
setuptools.pth

C:\Dropbox\Code\virtualenvs\toggletest\Lib\site-packages\easy-install.pth
==============================================================================
import sys; sys.__plen = len(sys.path)
./setuptools-0.6c11-py2.7.egg
./pip-1.3.1-py2.7.egg
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)

(toggletest) C:\Dropbox\Code>
davidmarble commented 11 years ago

The feature works fine. Example below. What doesn't work is listing the global site packages (when they're toggled on) with lssitepackages. I'll have to add that feature in. In the future I might support some of the virtualenv command-line switches by passing them through.

C:\Users\Dave>pip install html5lib
Downloading/unpacking html5lib
  Downloading html5lib-0.95.tar.gz (222kB): 222kB downloaded
  Running setup.py egg_info for package html5lib

Installing collected packages: html5lib
  Running setup.py install for html5lib

Successfully installed html5lib
Cleaning up...

C:\Users\Dave>mkvirtualenv toggletest
New python executable in toggletest\Scripts\python.exe
Installing setuptools................done.
Installing pip...................done.

(toggletest) C:\Users\Dave>python -c "import html5lib"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named html5lib

(toggletest) C:\Users\Dave>toggleglobalsitepackages

    Enabled global site-packages

(toggletest) C:\Users\Dave>python -c "import html5lib"

(toggletest) C:\Users\Dave>
felciano commented 11 years ago

Got it -- thanks for the quick resolution David.