aboutsummaryrefslogtreecommitdiffstats
path: root/python/mach_bootstrap.py
diff options
context:
space:
mode:
authorAnthony Broad-Crawford <abc@MBP.local>2015-09-18 11:45:52 -0500
committerAnthony Broad-Crawford <abc@MBP.local>2015-09-21 13:38:30 -0500
commit2e0e2288ed3367e3bf8a17b763a89ef34d370e17 (patch)
tree726779f79716895177be1406c8695a24046c0c92 /python/mach_bootstrap.py
parent8a8204ffc8fa287dde2321c40d12b191b51960da (diff)
downloadservo-2e0e2288ed3367e3bf8a17b763a89ef34d370e17.tar.gz
servo-2e0e2288ed3367e3bf8a17b763a89ef34d370e17.zip
Added error handling and improved error messaging when running mach without python's virtualenv or pip installed
Diffstat (limited to 'python/mach_bootstrap.py')
-rw-r--r--python/mach_bootstrap.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/python/mach_bootstrap.py b/python/mach_bootstrap.py
index d32b6f8be45..12609b035c3 100644
--- a/python/mach_bootstrap.py
+++ b/python/mach_bootstrap.py
@@ -84,7 +84,14 @@ def _activate_virtualenv(topdir):
if not os.path.exists(virtualenv_path):
virtualenv = _get_exec("virtualenv2", "virtualenv")
- subprocess.check_call([virtualenv, "-p", python, virtualenv_path])
+
+ try:
+ subprocess.check_call([virtualenv, "-p", python, virtualenv_path])
+ except subprocess.CalledProcessError:
+ sys.exit("Python virtualenv failed to execute properly.")
+ except OSError:
+ sys.exit("Please install virtualenv "
+ "and ensure permissions prior to running mach.")
activate_path = os.path.join(virtualenv_path, "bin", "activate_this.py")
execfile(activate_path, dict(__file__=activate_path))
@@ -109,7 +116,15 @@ def _activate_virtualenv(topdir):
continue
except OSError:
open(marker_path, 'w').close()
- subprocess.check_call(["pip", "install", "-q", "-r", req_path])
+
+ try:
+ subprocess.check_call(["pip", "install", "-q", "-r", req_path])
+ except subprocess.CalledProcessError:
+ sys.exit("Pip failed to execute properly.")
+ except OSError:
+ sys.exit("Pip not found. Please install pip and verify permissions"
+ " prior to running mach.")
+
os.utime(marker_path, None)