diff setup.py @ 36398:eb73f8a6177e

merge with stable
author Kevin Bullock <kbullock+mercurial@ringworld.org>
date Sat, 24 Feb 2018 17:49:10 -0600
parents a2a6e724d61a fb39f6a8a864
children 23d12524a202
line wrap: on
line diff
--- a/setup.py	Sat Feb 24 16:20:55 2018 +0530
+++ b/setup.py	Sat Feb 24 17:49:10 2018 -0600
@@ -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