mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Fix build on windows when default python is MSYS64 python
This commit is contained in:
parent
525e77f64f
commit
25b0ee22f2
1 changed files with 8 additions and 2 deletions
|
@ -80,6 +80,13 @@ def _get_exec(*names):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _get_virtualenv_script_dir():
|
||||||
|
# Virtualenv calls its scripts folder "bin" on linux/OSX/MSYS64 but "Scripts" on Windows
|
||||||
|
if os.name == "nt" and os.path.sep != "/":
|
||||||
|
return "Scripts"
|
||||||
|
return "bin"
|
||||||
|
|
||||||
|
|
||||||
# Possible names of executables, sorted from most to least specific
|
# Possible names of executables, sorted from most to least specific
|
||||||
PYTHON_NAMES = ["python-2.7", "python2.7", "python2", "python"]
|
PYTHON_NAMES = ["python-2.7", "python2.7", "python2", "python"]
|
||||||
VIRTUALENV_NAMES = ["virtualenv-2.7", "virtualenv2.7", "virtualenv2", "virtualenv"]
|
VIRTUALENV_NAMES = ["virtualenv-2.7", "virtualenv2.7", "virtualenv2", "virtualenv"]
|
||||||
|
@ -92,8 +99,7 @@ def _activate_virtualenv(topdir):
|
||||||
if python is None:
|
if python is None:
|
||||||
sys.exit("Python is not installed. Please install it prior to running mach.")
|
sys.exit("Python is not installed. Please install it prior to running mach.")
|
||||||
|
|
||||||
# Virtualenv calls its scripts folder "bin" on linux/OSX but "Scripts" on Windows, detect which one then use that
|
script_dir = _get_virtualenv_script_dir()
|
||||||
script_dir = "Scripts" if os.name == "nt" else "bin"
|
|
||||||
activate_path = os.path.join(virtualenv_path, script_dir, "activate_this.py")
|
activate_path = os.path.join(virtualenv_path, script_dir, "activate_this.py")
|
||||||
if not (os.path.exists(virtualenv_path) and os.path.exists(activate_path)):
|
if not (os.path.exists(virtualenv_path) and os.path.exists(activate_path)):
|
||||||
virtualenv = _get_exec(*VIRTUALENV_NAMES)
|
virtualenv = _get_exec(*VIRTUALENV_NAMES)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue