Skip to content
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

Fix assert error when virtual path shares a common prefix with real path #320

Merged
merged 1 commit into from
Oct 19, 2012

Conversation

jkleint
Copy link

@jkleint jkleint commented Aug 21, 2012

If (real) Python is installed at (say) /opt/python2.7.3 and you have a
virtualenv at /opt/python, change_prefix() will try to split off
/opt/python from a path like /opt/python2.7.3/lib/python2.7/distutils,
leaving 2.7.3/lib/python2.7/distutils, which is not valid and fails
the assert.

This patch sorts the list of prefixes by length, so the longer path is
tried before its prefix.

@travisbot
Copy link

This pull request passes (merged 99d90e7c into 85595e4).

@carljm
Copy link

carljm commented Aug 24, 2012

Looks like this area of code changed a bit with another recently-merged PR, mind rebasing or merging from develop so this merges cleanly? Thanks!

…ath.

If (real) Python is installed at (say) `/opt/python2.7.3` and you have a
virtualenv at `/opt/python`, `change_prefix()` will try to split off
`/opt/python` from a path like `/opt/python2.7.3/lib/python2.7/distutils`,
leaving `2.7.3/lib/python2.7/distutils`, which is not valid and fails
the assert.

This patch sorts the list of prefixes by length, so the longer path is
tried before its prefix.
@jkleint
Copy link
Author

jkleint commented Oct 19, 2012

I've rebased my patch. Sorry about the delay; the other updates in between actually fixed the specific instance of my problem, but this will hopefully keep others from running into it.

pnasrat added a commit that referenced this pull request Oct 19, 2012
Fix assert error when virtual path shares a common prefix with real path
@pnasrat pnasrat merged commit 98b8160 into pypa:develop Oct 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants