aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/command_base.py
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-05-31 21:20:57 -0500
committerbors-servo <metajack+bors@gmail.com>2015-05-31 21:20:57 -0500
commit713f18a58d9ba39d0f2cd1cc987774a28a9035ee (patch)
treef9fa58b20d0f65294f3e017e432abcce77d343de /python/servo/command_base.py
parent1d19338a93348c4e817a0b1619dc236881ba18f6 (diff)
parentbe7ae0c7326a802bd5a86fe9b73673296399d0ed (diff)
downloadservo-713f18a58d9ba39d0f2cd1cc987774a28a9035ee.tar.gz
servo-713f18a58d9ba39d0f2cd1cc987774a28a9035ee.zip
Auto merge of #6201 - glennw:jquery-runner, r=metajack
<!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6201) <!-- Reviewable:end -->
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r--python/servo/command_base.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index 185b716165d..80811e30a04 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -121,6 +121,44 @@ class CommandBase(object):
self._cargo_build_id = open(filename).read().strip()
return self._cargo_build_id
+ def get_binary_path(self, release, dev):
+ base_path = path.join("components", "servo", "target")
+ release_path = path.join(base_path, "release", "servo")
+ dev_path = path.join(base_path, "debug", "servo")
+
+ # Prefer release if both given
+ if release and dev:
+ dev = False
+
+ release_exists = path.exists(release_path)
+ dev_exists = path.exists(dev_path)
+
+ if not release_exists and not dev_exists:
+ print("No Servo binary found. Please run './mach build' and try again.")
+ sys.exit()
+
+ if release and release_exists:
+ return release_path
+
+ if dev and dev_exists:
+ return dev_path
+
+ if not dev and not release and release_exists and dev_exists:
+ print("You have multiple profiles built. Please specify which "
+ "one to run with '--release' or '--dev'.")
+ sys.exit()
+
+ if not dev and not release:
+ if release_exists:
+ return release_path
+ else:
+ return dev_path
+
+ print("The %s profile is not built. Please run './mach build%s' "
+ "and try again." % ("release" if release else "dev",
+ " --release" if release else ""))
+ sys.exit()
+
def build_env(self, gonk=False, hosts_file_path=None):
"""Return an extended environment dictionary."""
env = os.environ.copy()