diff options
author | Jason Williams <jase.williams@gmail.com> | 2016-01-05 00:22:28 +0000 |
---|---|---|
committer | Lars Bergstrom <lars@lars.com> | 2016-01-22 19:27:29 -0600 |
commit | 13d98f153ae330329ac1c0450db758a73b6d6e1f (patch) | |
tree | 62c51f04378a081e735a039d276e0339ad25988d /python | |
parent | 095658e098ea695fef651f5b51a0081cfeb94f32 (diff) | |
download | servo-13d98f153ae330329ac1c0450db758a73b6d6e1f.tar.gz servo-13d98f153ae330329ac1c0450db758a73b6d6e1f.zip |
adding check for windows then using Scripts instead of bin
Diffstat (limited to 'python')
-rw-r--r-- | python/mach_bootstrap.py | 4 | ||||
-rw-r--r-- | python/servo/bootstrap_commands.py | 2 | ||||
-rw-r--r-- | python/servo/command_base.py | 26 | ||||
-rw-r--r-- | python/servo/devenv_commands.py | 1 |
4 files changed, 14 insertions, 19 deletions
diff --git a/python/mach_bootstrap.py b/python/mach_bootstrap.py index 9f1bfd5f485..e78132d21d2 100644 --- a/python/mach_bootstrap.py +++ b/python/mach_bootstrap.py @@ -92,7 +92,9 @@ def _activate_virtualenv(topdir): if python is None: sys.exit("Python is not installed. Please install it prior to running mach.") - activate_path = os.path.join(virtualenv_path, "bin", "activate_this.py") + # Virtualenv calls its scripts folder "bin" on linux/OSX but "Scripts" on Windows, detect which one then use that + script_dir = "Scripts" if os.name == "nt" else "bin" + 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)): virtualenv = _get_exec(*VIRTUALENV_NAMES) if virtualenv is None: diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py index 9959c14ed11..cc4aeedf101 100644 --- a/python/servo/bootstrap_commands.py +++ b/python/servo/bootstrap_commands.py @@ -28,7 +28,7 @@ from mach.decorators import ( Command, ) -from servo.command_base import CommandBase, cd, host_triple, use_nightly_rust, check_call, BIN_SUFFIX +from servo.command_base import CommandBase, cd, host_triple, check_call, BIN_SUFFIX def download(desc, src, writer): diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 650db517d48..ad411b3de53 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -16,9 +16,7 @@ import toml from mach.registrar import Registrar -BIN_SUFFIX = "" -if sys.platform == "win32": - BIN_SUFFIX = ".exe" +BIN_SUFFIX = ".exe" if sys.platform == "win32" else "" @contextlib.contextmanager @@ -59,10 +57,8 @@ def host_triple(): def use_nightly_rust(): - envvar = os.environ.get("SERVO_USE_NIGHTLY_RUST") - if envvar: - return envvar != "0" - return False + envvar = os.environ.get("SERVO_USE_NIGHTLY_RUST", "0") + return envvar != "0" def call(*args, **kwargs): @@ -70,11 +66,9 @@ def call(*args, **kwargs): verbose = kwargs.pop('verbose', False) if verbose: print(' '.join(args[0])) - if sys.platform == "win32": - # we have to use shell=True in order to get PATH handling - # when looking for the binary on Windows - return subprocess.call(*args, shell=True, **kwargs) - return subprocess.call(*args, **kwargs) + # we have to use shell=True in order to get PATH handling + # when looking for the binary on Windows + return subprocess.call(*args, shell=sys.platform == 'win32', **kwargs) def check_call(*args, **kwargs): @@ -82,11 +76,9 @@ def check_call(*args, **kwargs): verbose = kwargs.pop('verbose', False) if verbose: print(' '.join(args[0])) - if sys.platform == "win32": - # we have to use shell=True in order to get PATH handling - # when looking for the binary on Windows - return subprocess.check_call(*args, shell=True, **kwargs) - return subprocess.check_call(*args, **kwargs) + # we have to use shell=True in order to get PATH handling + # when looking for the binary on Windows + return subprocess.check_call(*args, shell=sys.platform == 'win32', **kwargs) class CommandBase(object): diff --git a/python/servo/devenv_commands.py b/python/servo/devenv_commands.py index 015ae3c91af..d16c4ce619c 100644 --- a/python/servo/devenv_commands.py +++ b/python/servo/devenv_commands.py @@ -10,6 +10,7 @@ from __future__ import print_function, unicode_literals from os import path, getcwd, listdir +import subprocess import sys from mach.decorators import ( |