mirror of
https://github.com/servo/servo.git
synced 2025-06-06 00:25:37 +00:00
Allow to run mach with Python3 (>=3.5)
This commit is contained in:
parent
01c1a6c4c9
commit
67c2c115c0
2 changed files with 7 additions and 6 deletions
4
mach
4
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)
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue