pypa/virtualenv — pull request #320 by jkleint (2012-08-21 18:59:17+00:00)
Title: Fix assert error when virtual path shares a common prefix with real path

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.