Commit 2e80398
authored
Fix infinite os.execv when unsuitable dependencies are specified in PYTHONPATH (#151)
Remove incompatible Python tools from environment
Whenever a Python tool is about to be installed with `pip`
in the virtualenv, get rid of previous installation of this tool
in the environment if any (sys.path and PYTHONPATH environment variable)
so that it doesn't interference with pip installation.
The change also detects the conflicts encountered by pip to ensure
that unsuitable dependencies of the package are also excluded from
the environment.
This change solves an issue where an unsuitable version of black was provided
via PYTHONPATH, and pip was not able to uninstall it because provided from
outside. The required version of black also needed a newer version of `pathspec`
provided in PYTHONPATH. Therefore, despite the `pip install proper-version-of-black`,
`pip` considered that the conditions were not met, and the loop was going on forever.1 parent 82b157f commit 2e80398
1 file changed
+32
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
31 | 59 | | |
32 | 60 | | |
33 | 61 | | |
| |||
370 | 398 | | |
371 | 399 | | |
372 | 400 | | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
373 | 404 | | |
374 | 405 | | |
375 | 406 | | |
| |||
708 | 739 | | |
709 | 740 | | |
710 | 741 | | |
| 742 | + | |
711 | 743 | | |
712 | 744 | | |
713 | 745 | | |
| |||
0 commit comments