setuptools and distribute don't prepend PYTHONPATH to sys.path

Bug #821000 reported by Zooko Wilcox-O'Hearn
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Tahoe-LAFS
New
Unknown
distribute
Invalid
Undecided
Unassigned
python-setuptools
Unknown
Unknown
distribute (Ubuntu)
Invalid
Undecided
Unassigned
python-setuptools (Ubuntu)
Opinion
Undecided
Unassigned

Bug Description

This is a long-standing issue in setuptools, which was copied into distribute when distribute forked. There exist patches the attempt to fix the issue offered against both setuptools and distribute. There are tickets in the setuptools issue tracker, distribute issue tracker, and the Tahoe-LAFS issue tracker (where we maintain a fork of setuptools in order to fix this among other outstanding bugs).

The crux of the problem is that the Python documentation says:

  "The PYTHONPATH variable can be set to a list of paths that will be added to the beginning of sys.path."

http://docs.python.org/install/index.html#modifying-python-s-search-path

This is true with standard distutils, false with setuptools, false with distribute, and true if you apply the following patch to either setuptools or distribute:

 Index: setuptools/command/easy_install.py
 ===================================================================
 --- setuptools/command/easy_install.py (revision 560)
 +++ setuptools/command/easy_install.py (revision 562)
 @@ -1365,5 +1365,5 @@
                  "import sys; new=sys.path[sys.__plen:];"
                  " del sys.path[sys.__plen:];"
 - " p=getattr(sys,'__egginsert',0); sys.path[p:p]=new;"
 + " p=getattr(sys,'__egginsert',len(os.environ.get('PYTHONPATH','').split(os.pathsep))); sys.path[p:p]=new;"
                  " sys.__egginsert = p+len(new)\n"
              ) % data

description: updated
description: updated
description: updated
description: updated
Changed in tahoe-lafs:
status: Unknown → New
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in distribute (Ubuntu):
status: New → Confirmed
Changed in python-setuptools (Ubuntu):
assignee: nobody → Barry Warsaw (barry)
Revision history for this message
Barry Warsaw (barry) wrote :

This is a pretty old bug and setuptools has come a long way since then. Also, distribute was re-merged back into setuptools, so it's not even a thing any more. I'm unassigning from myself. I don't think this is something that Ubuntu should drive. Best to engage upstream setuptools, if it's still a problem.

Changed in python-setuptools (Ubuntu):
assignee: Barry Warsaw (barry) → nobody
Changed in distribute (Ubuntu):
status: Confirmed → Invalid
Changed in distribute:
status: New → Invalid
Changed in python-setuptools (Ubuntu):
status: New → Opinion
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.