-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In HackedPythonVersion, patch sys.version_info #1076
Conversation
sigh |
def __init__(self, python_version, python_path): | ||
self.python_version = python_version | ||
self.python_path = python_path | ||
|
||
def __enter__(self): | ||
os.environ['PIP_PYTHON_VERSION'] = str(self.python_version) | ||
os.environ['PIP_PYTHON_PATH'] = str(self.python_path) | ||
self.backup_version_info = sys.version_info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this being used by pip-tools or is it being added as a nice to have for use later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to reset sys.version_info
outside of the context manager (in __exit__
). We don't want that patched thing globally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or was your question "Why are we patching sys.version_info
? That's for pip to generate the right list of pep425 tags for wheel selection, i.e. Pick the right wheel for the right python version in the managed venv.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that makes sense. Thanks for clarifying!
This is required to have pip/pip-tools get the right wheels according to the project virtualenv python version.
bb21e93
to
f19ee42
Compare
🛬 Landing, thanks @vphilippon! |
This is required to have pip/pip-tools get the right wheels according to
the project virtualenv python version.
Should completely fix #857, and the likes.
/cc @kennethreitz @erinxocon @nateprewitt @techalchemy