Actually, try this patch.  (I'm having some difficulty committing this to svn.)
Index: patches/remove_syspath0_on_reinvoke.patch
===================================================================
--- patches/remove_syspath0_on_reinvoke.patch	(revision 0)
+++ patches/remove_syspath0_on_reinvoke.patch	(revision 0)
@@ -0,0 +1,24 @@
+Description: When reinvoked, sys.path[0] will point into /usr/share/pyshared
+ on Debian, which will cause the following import to pick up the wrong version
+ (i.e. the 2.7 version when -p python3 is used).  We don't need sys.path[0], so
+ just remove it permanently. 
+Author: Barry Warsaw <[email protected]>
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=625784
+Forwarded: not-needed
+--- a/virtualenv.py
++++ b/virtualenv.py
+@@ -469,6 +469,14 @@
+         project_name = 'distribute'
+         bootstrap_script = DISTRIBUTE_SETUP_PY
+         try:
++            # When reinvoked, sys.path[0] will point into /usr/share/pyshared
++            # on Debian, which will cause the following import to pick up the
++            # wrong version (i.e. the 2.7 version when -p python3 is used).
++            # We don't need sys.path[0], so just remove it permanently.  See
++            # Debian bug 625785.
++            if (os.environ.get('VIRTUALENV_INTERPRETER_RUNNING', '') == 'true'
++                and sys.path[0] == '/usr/share/pyshared'):
++                del sys.path[0]
+             # check if the global Python has distribute installed or plain
+             # setuptools
+             import pkg_resources
Index: patches/series
===================================================================
--- patches/series	(revision 16912)
+++ patches/series	(working copy)
@@ -1,2 +1,3 @@
 look_for_external_files.patch
 add_distribute.patch
+remove_syspath0_on_reinvoke.patch
Index: changelog
===================================================================
--- changelog	(revision 16912)
+++ changelog	(working copy)
@@ -1,3 +1,13 @@
+python-virtualenv (1.6-2) unstable; urgency=low
+
+  * debian/patches/remove_syspath0_on_reinvoke.patch
+    When virtualenv.py is re-invoked, remove sys.path[0], since it points
+    to /usr/share/pyshared, which causes the wrong version of
+    pkg_resources to be imported.  This fixes -p python3 on Debian.
+    Closes: 625784
+
+ -- Barry Warsaw <[email protected]>  Fri, 06 May 2011 15:54:09 -0400
+
 python-virtualenv (1.6-1) unstable; urgency=low
 
   * New upstream version. Closes: #617941

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Python-modules-team mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/python-modules-team

Reply via email to