aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/servo/build_commands.py11
-rw-r--r--python/servo/command_base.py3
-rw-r--r--python/servo/post_build_commands.py10
-rw-r--r--python/servo/testing_commands.py12
4 files changed, 23 insertions, 13 deletions
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py
index 666c8945e1d..1352877d048 100644
--- a/python/servo/build_commands.py
+++ b/python/servo/build_commands.py
@@ -73,7 +73,7 @@ class MachCommands(CommandBase):
else:
status = subprocess.call(
["cargo", "build"] + opts,
- env=self.build_env())
+ env=self.build_env(), cwd=self.servo_crate())
elapsed = time() - build_start
print("Build completed in %0.2fs" % elapsed)
@@ -105,7 +105,8 @@ class MachCommands(CommandBase):
build_start = time()
with cd(path.join("ports", "cef")):
- ret = subprocess.call(["cargo", "build"], env=self.build_env())
+ ret = subprocess.call(["cargo", "build"],
+ env=self.build_env(), cwd=self.servo_crate())
elapsed = time() - build_start
print("CEF build completed in %0.2fs" % elapsed)
@@ -124,7 +125,8 @@ class MachCommands(CommandBase):
if jobs is not None:
opts += ["-j", jobs]
return subprocess.call(
- ["cargo", "test", "--no-run"], env=self.build_env())
+ ["cargo", "test", "--no-run"],
+ env=self.build_env(), cwd=self.servo_crate())
@Command('clean',
description='Clean the build directory.',
@@ -144,4 +146,5 @@ class MachCommands(CommandBase):
if verbose:
opts += ["-v"]
- return subprocess.call(["cargo", "clean"] + opts, env=self.build_env())
+ return subprocess.call(["cargo", "clean"] + opts,
+ env=self.build_env(), cwd=self.servo_crate())
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index 8dc872e8656..a34104b734e 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -142,6 +142,9 @@ class CommandBase(object):
return env
+ def servo_crate(self):
+ return path.join(self.context.topdir, "components", "servo")
+
def ensure_bootstrapped(self):
if self.context.bootstrapped:
return
diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py
index c2c4bb5c06b..972dea7429b 100644
--- a/python/servo/post_build_commands.py
+++ b/python/servo/post_build_commands.py
@@ -37,7 +37,7 @@ class MachCommands(CommandBase):
env = self.build_env()
env["RUST_BACKTRACE"] = "1"
- args = [path.join("target", "servo")]
+ args = [path.join("components", "servo", "target", "servo")]
# Borrowed and modified from:
# http://hg.mozilla.org/mozilla-central/file/c9cfa9b91dea/python/mozbuild/mozbuild/mach_commands.py#l883
@@ -71,7 +71,7 @@ class MachCommands(CommandBase):
def doc(self, params):
self.ensure_bootstrapped()
return subprocess.call(["cargo", "doc"] + params,
- env=self.build_env())
+ env=self.build_env(), cwd=self.servo_crate())
@Command('serve-docs',
description='Locally serve Servo and Rust documentation',
@@ -81,13 +81,13 @@ class MachCommands(CommandBase):
help="Port to serve documentation at (default is 8888)")
def serve_docs(self, port):
self.doc([])
- servedir = path.join("target", "serve-docs")
- docdir = path.join("target", "doc")
+ servedir = path.join("components", "servo", "target", "serve-docs")
+ docdir = path.join("components", "servo", "target", "doc")
rmtree(servedir, True)
copytree(docdir, servedir, ignore=ignore_patterns('.*'))
- rustdocs = path.join("rust", self.rust_snapshot_path(), "doc")
+ rustdocs = path.join(self.config["tools"]["rust-root"], "doc")
copytree(rustdocs, path.join(servedir, "rust"), ignore=ignore_patterns('.*'))
chdir(servedir)
diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py
index 8735a234e12..ff4844731d8 100644
--- a/python/servo/testing_commands.py
+++ b/python/servo/testing_commands.py
@@ -31,10 +31,12 @@ class MachCommands(CommandBase):
self.context.built_tests = True
def find_test(self, prefix):
- target_contents = os.listdir(path.join(self.context.topdir, "target"))
+ target_contents = os.listdir(path.join(
+ self.context.topdir, "components", "servo", "target"))
for filename in target_contents:
if filename.startswith(prefix + "-"):
- filepath = path.join(self.context.topdir, "target", filename)
+ filepath = path.join(
+ self.context.topdir, "components", "servo", "target", filename)
if path.isfile(filepath) and os.access(filepath, os.X_OK):
return filepath
@@ -104,10 +106,12 @@ class MachCommands(CommandBase):
def cargo_test(component):
return 0 != subprocess.call(
- ["cargo", "test", "-p", component] + test_name, env=self.build_env())
+ ["cargo", "test", "-p", component] + test_name,
+ env=self.build_env(), cwd=self.servo_crate())
for component in os.listdir("components"):
- ret = ret or cargo_test(component)
+ if component != "servo":
+ ret = ret or cargo_test(component)
return ret