diff -r 5da7b8cb6f75 -r fb39f6a8a864 setup.py --- a/setup.py Wed Feb 21 16:51:09 2018 -0500 +++ b/setup.py Fri Feb 23 17:57:04 2018 -0800 @@ -67,6 +67,26 @@ printf(error, file=sys.stderr) sys.exit(1) +# We don't yet officially support Python 3. But we want to allow developers to +# hack on. Detect and disallow running on Python 3 by default. But provide a +# backdoor to enable working on Python 3. +if sys.version_info[0] != 2: + badpython = True + + # Allow Python 3 from source checkouts. + if os.path.isdir('.hg'): + badpython = False + + if badpython: + error = """ +Mercurial only supports Python 2.7. +Python {py} detected. +Please re-run with Python 2.7. +""".format(py=sys.version_info) + + printf(error, file=sys.stderr) + sys.exit(1) + # Solaris Python packaging brain damage try: import hashlib