Skip to content

Fix regression in check for stale environments#425

Merged
cjolowicz merged 18 commits intowntrblm:mainfrom
cjolowicz:418-followup
May 23, 2021
Merged

Fix regression in check for stale environments#425
cjolowicz merged 18 commits intowntrblm:mainfrom
cjolowicz:418-followup

Conversation

@cjolowicz
Copy link
Copy Markdown
Collaborator

Fixes #424

Claudio Jolowicz added 18 commits May 23, 2021 17:28
- `sys.real_prefix` was set by virtualenv < 20.0.
- `sys.base_prefix` is used by virtualenv >= 20.0 and python -m venv (PEP 405)
When comparing the resolved interpreter to the interpreter in an existing
virtualenv, we need to use sys.base_prefix (or sys.real_prefix) for both.
The resolved interpreter is located in the virtualenv, so its sys.prefix would
point into the virtualenv instead of the base installation.

This bug results in virtualenvs never being reused.
Environments created by virtualenv < 20.0.0 do not have pyvenv.cfg files.
@cjolowicz cjolowicz requested a review from theacodes May 23, 2021 17:16
@theacodes
Copy link
Copy Markdown
Collaborator

Thanks for fixing this (and adding tests to cover the regression!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Regression: Nox crashes with AttributeError: module 'sys' has no attribute 'real_prefix' when reusing virtualenvs

2 participants