diff --git a/mach b/mach index c92653e1af8..317374d6c27 100755 --- a/mach +++ b/mach @@ -18,8 +18,8 @@ import sys # Check for the current python version as some users (especially on archlinux) # may not have python 2 installed and their /bin/python binary symlinked to # python 3. -if sys.version_info >= (3, 0): - print("mach does not support python 3, please install python 2") +if sys.version_info >= (3, 0) and sys.version_info < (3, 5): + print("mach does not support python 3 (< 3.5), please install python 2 or python 3 (>= 3.5)") sys.exit(1) diff --git a/python/mach_bootstrap.py b/python/mach_bootstrap.py index 80b71a2bfeb..5dd1077c923 100644 --- a/python/mach_bootstrap.py +++ b/python/mach_bootstrap.py @@ -256,7 +256,8 @@ def bootstrap(topdir): # We don't support paths with Unicode characters for now # https://github.com/servo/servo/issues/10002 try: - topdir.decode('ascii') + # Trick to support both python2 and python3 + topdir.encode().decode('ascii') except UnicodeDecodeError: print('Cannot run mach in a path with Unicode characters.') print('Current path:', topdir) @@ -269,10 +270,10 @@ def bootstrap(topdir): print('Current path:', topdir) sys.exit(1) - # Ensure we are running Python 2.7+. We put this check here so we generate a + # Ensure we are running Python 2.7+ or Python 3.5+. We put this check here so we generate a # user-friendly error message rather than a cryptic stack trace on module import. - if not (3, 0) > sys.version_info >= (2, 7): - print('Python 2.7 or above (but not Python 3) is required to run mach.') + if sys.version_info < (2, 7) or (sys.version_info >= (3, 0) and sys.version_info < (3, 5)): + print('Python2 (>=2.7) or Python3 (>=3.5) is required to run mach.') print('You are running Python', platform.python_version()) sys.exit(1)