-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
sys.path rewrite in Python 2 regression #1670
Comments
Here's how to reproduce:
(reproducible on macOS) |
An oversight on our side, we should skip PYTHONPATH paths here https://github.com/pypa/virtualenv/blob/master/src/virtualenv/create/via_global_ref/builtin/python2/site.py#L90 |
@jd can you make a PR addressing the issue? |
@gaborbernat sure, let me do that |
Two things:
This is clearly wrong.
Hint? |
For 1 we just need to validate the path ends or not with the correct. We don't have os path so string manipulation is all we can do. For 2 you need a two phase approach. First let the rewrite happen. Now import is and fixup pythonpath entries. |
Gave a try at this in #1673 |
I like the idea, would just encourage some style fixes 👍 |
I've encountered this too and can be workarounded by pinning virtualenv to 20.0.4, so it was likely introduced in #1641 . |
Well, it was working before #1641 only by chance of a technicality of how macOs works, so in my eyes is a regression of the 20.0.0 series, that being said we'll have out a fix next weeks second part. |
Resolved by #1673 |
pypa/virtualenv#1670 has been fixed in 20.0.8 Uses `-U` with pip install for tox since the base image might already have tox; then upgrade it.
Version >= 20.0.0 of virtualenv changed the way
sys.path
is modified by thesite.py
file (at least for Linux). That breaks at least one of our test cases.When
PYTHONPATH
is set to a directory that is inside virtualenv and starts withsys.prefix
it's rewritten to target thesys.base_prefix
.The problem is that is the directory might not be part of the standard library nor install in pyenv. This is our case since we're using tox to install our library in the virtualenv and then setting PYTHONPATH to a subdirectory somewhere in this installed package.
IIRC the culprit
https://github.com/pypa/virtualenv/blob/master/src/virtualenv/create/via_global_ref/builtin/python2/site.py#L96-L97
The text was updated successfully, but these errors were encountered: