This is an archive of the discontinued Mercurial Phabricator instance.

Allow to run setup.py with python 3 without a mercurial checkout
ClosedPublic

Authored by glandium on Jul 16 2018, 8:43 PM.

Details

Summary

Some people may want to test mercurial in a python 3 environment through e.g. pip, in which case setup.py doesn't run in a mercurial checkout, so the hack in setup.py to allow python 3 cannot be overcome.

This change allows a manual override with the HGPYTHON3 environment variable.

Additionally, when for some reason the version is unknown (for crazy people like me, who have a git checkout of the mercurial repo), the version variable ends up being an unicode string, which fails the isinstance(version, bytes) assertion. So fix that at the same time.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

glandium created this revision.Jul 16 2018, 8:43 PM
indygreg accepted this revision.Jul 16 2018, 8:47 PM

I'm OK with this undocumented hack. And there are cases where we may want to test setup.py outside the context of a checkout as well. The important thing is end-users not running Mercurial with Python 3 unknowingly.

The only thing I could bikeshed here is the naming. History tells us that someone will find this hack and e.g. post it to stackoverflow without the context that Mercurial is unsupported on Python 3. Perhaps a name like HGALLOWUNSUPPORTEDPYTHON3 would be better?

I'll queue this for now. We can change the name easily enough if others want that.

This revision is now accepted and ready to land.Jul 16 2018, 8:47 PM
This revision was automatically updated to reflect the committed changes.