Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update mach bootstrap for changes to wpt harness path in gecko
Gecko is now using the wpt harness under the wpt tools directory
rather than a copy in an adjacent directory. Therefore the path to the
requirements files, and the required model paths, have changed.
  • Loading branch information
jgraham committed Jun 5, 2017
1 parent d767e60 commit 06cdf7b
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions python/mach_bootstrap.py
Expand Up @@ -14,11 +14,6 @@
os.path.join("python", "tidy"),
]

WPT_SEARCH_PATHS = [
".",
"harness",
]

# Individual files providing mach commands.
MACH_MODULES = [
os.path.join('python', 'servo', 'bootstrap_commands.py'),
Expand Down Expand Up @@ -106,7 +101,7 @@ def _get_virtualenv_script_dir():
return "bin"


def wpt_path(topdir, paths, is_firefox):
def wpt_path(is_firefox, topdir, *paths):
if is_firefox:
rel = os.path.join("..", "testing", "web-platform")
else:
Expand All @@ -115,6 +110,16 @@ def wpt_path(topdir, paths, is_firefox):
return os.path.join(topdir, rel, *paths)


def wpt_harness_path(is_firefox, topdir, *paths):
wpt_root = wpt_path(is_firefox, topdir)
if is_firefox:
rel = os.path.join(wpt_root, "tests", "tools", "wptrunner")
else:
rel = os.path.join(wpt_root, "harness")

return os.path.join(topdir, rel, *paths)


def _activate_virtualenv(topdir, is_firefox):
virtualenv_path = os.path.join(topdir, "python", "_virtualenv")
check_exec_path = lambda path: path.startswith(virtualenv_path)
Expand Down Expand Up @@ -157,9 +162,9 @@ def _activate_virtualenv(topdir, is_firefox):
# and it will check for conflicts.
requirements_paths = [
os.path.join("python", "requirements.txt"),
wpt_path(topdir, ("harness", "requirements.txt"), is_firefox),
wpt_path(topdir, ("harness", "requirements_firefox.txt"), is_firefox),
wpt_path(topdir, ("harness", "requirements_servo.txt"), is_firefox),
wpt_harness_path(is_firefox, topdir, "requirements.txt",),
wpt_harness_path(is_firefox, topdir, "requirements_firefox.txt"),
wpt_harness_path(is_firefox, topdir, "requirements_servo.txt"),
]

if need_pip_upgrade:
Expand Down Expand Up @@ -257,8 +262,10 @@ def populate_context(context, key=None):
raise AttributeError(key)

sys.path[0:0] = [os.path.join(topdir, path) for path in SEARCH_PATHS]
sys.path[0:0] = [wpt_path(topdir, (path,), is_firefox)
for path in WPT_SEARCH_PATHS]

sys.path[0:0] = [wpt_path(is_firefox, topdir),
wpt_harness_path(is_firefox, topdir)]

import mach.main
mach = mach.main.Mach(os.getcwd())
mach.populate_context_handler = populate_context
Expand Down

0 comments on commit 06cdf7b

Please sign in to comment.