[Distutils] pip/easy_install mercurial in virtualenv on Python 3.3

Carl Meyer carl at oddbird.net
Mon Feb 25 17:47:15 CET 2013

Hi Christian,

On 02/25/2013 05:27 AM, Christian Tismer wrote:
> Some further analysis of the problem:
> Mercurial is (and should be) installed system-wide.
> The 'hg' command (at least my homebrew install) uses the normal shebang
> line
> "#!/usr/bin/env python"
> When using virtualenv and python2.7, this works fine.
> When using virtualenv or venv and python3.3, then the following happens:
> - The 'python' command gets redirected to python3.
> - Then the system mercurial is run with the wrong interpreter.
> That finally made me try to install mercurial using pip, and that caused
> the
> question from below.
> But actually, the "bad thing" IMHO is the naming clash introduced by the
> symlinks that v(irtual)env is setting:
> Why does it ignore the otherwise clear distinction between python and
> python3 ?

When Vinay ported virtualenv to Python 3, we made the decision that
since virtualenvs generally have exactly one Python interpreter of one
version, that it would be less surprising if every virtualenv always had
a "python", regardless of 2v3. I don't know for sure if that was the
right choice or not.

> And who is responsible to make things "right":
> Should virtualenv avoid this naming problem,
> or should the mercurial installer become more carefully specify its
> interpreter?

In general, I think that it is wrong for system-installed scripts to
ever use "/usr/bin/env python" in the shebang line, as that makes it too
easy for them to be run with the wrong Python. I know that, for
instance, it is the policy of Debian/Ubuntu to not use "#!/usr/bin/env
python". I don't know what homebrew's policy is, but I'd suggest raising
this as a bug in the Homebrew Mercurial package.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20130225/e2ae17a5/attachment.pgp>

More information about the Distutils-SIG mailing list