Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix isolated builds when enum34 is installed
With the prior code, a python library installed into the same directory as pip will be promoted to be found before other libraries of the same name when an isolated build is performed. This is because pip/__main__.py adds the directory holding pip to the front of sys.path where both the pip library and the other libraries will be found before the other libraries. This is especially problematic for libraries which shadow the names of stdlib libraries. The enum34 library, for instance, will shadow the stdlib enum library. When pip runs an isolated build and the enum34 library is installed, enum.py from the enum34 library will be found and imported instead of enum.py from the stdlib. That, in turn, breaks the stdlib re module which then breaks pip. This commit fixes that by changing build_env to invoke pip a different way (by calling python on pip/__main__.py instead of calling python on pip/). Using __main__.py changes what python sets the value of __package__ to which, in turn, makes it so the code in __main__.py does not add the directory holding pip to sys.path. Fixes pypa#8214
- Loading branch information