mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Added a comment explaining how __main__.py gets teh wheel name
This commit is contained in:
parent
2b75d510f9
commit
77be5e914e
1 changed files with 4 additions and 0 deletions
|
@ -4,6 +4,10 @@ import sys
|
|||
# This allows the usage python pip-*.whl/pip install pip-*.whl
|
||||
if __package__ == '':
|
||||
import os
|
||||
# __file__ is pip-*.whl/pip/__main__.py
|
||||
# first dirname call strips of '/__main__.py', second strips off '/pip'
|
||||
# Resulting path is the name of the wheel itself
|
||||
# Add that to sys.path so we can import pip
|
||||
path = os.path.dirname(os.path.dirname(__file__))
|
||||
sys.path.insert(0, path)
|
||||
|
||||
|
|
Loading…
Reference in a new issue