diff --git a/python/mach_bootstrap.py b/python/mach_bootstrap.py index 0f7e1ac6882..4bbd1fe7d95 100644 --- a/python/mach_bootstrap.py +++ b/python/mach_bootstrap.py @@ -131,7 +131,7 @@ def wpt_path(is_firefox, topdir, *paths): return os.path.join(topdir, rel, *paths) -def wpt_harness_path(is_firefox, topdir, *paths): +def wptrunner_path(is_firefox, topdir, *paths): wpt_root = wpt_path(is_firefox, topdir) if is_firefox: rel = os.path.join(wpt_root, "tests", "tools", "wptrunner") @@ -141,6 +141,16 @@ def wpt_harness_path(is_firefox, topdir, *paths): return os.path.join(topdir, rel, *paths) +def wptserve_path(is_firefox, topdir, *paths): + wpt_root = wpt_path(is_firefox, topdir) + if is_firefox: + rel = os.path.join(wpt_root, "tests", "tools", "wptserve") + else: + rel = os.path.join(wpt_root, "web-platform-tests", "tools", "wptserve") + + 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) @@ -175,9 +185,9 @@ def _activate_virtualenv(topdir, is_firefox): # and it will check for conflicts. requirements_paths = [ os.path.join("python", "requirements.txt"), - 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"), + wptrunner_path(is_firefox, topdir, "requirements.txt",), + wptrunner_path(is_firefox, topdir, "requirements_firefox.txt"), + wptrunner_path(is_firefox, topdir, "requirements_servo.txt"), ] if need_pip_upgrade: @@ -267,7 +277,8 @@ def bootstrap(topdir): sys.path[0:0] = [os.path.join(topdir, path) for path in SEARCH_PATHS] sys.path[0:0] = [wpt_path(is_firefox, topdir), - wpt_harness_path(is_firefox, topdir)] + wptrunner_path(is_firefox, topdir), + wptserve_path(is_firefox, topdir)] import mach.main mach = mach.main.Mach(os.getcwd()) diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 2d0a2fc23f6..1dcdfd17849 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -30,12 +30,15 @@ wpt = os.path.join(topdir, "tests", "wpt") def wpt_path(*args): return os.path.join(wpt, *args) -sys.path.append(wpt_path("web-platform-tests", "tools", "wptrunner", "wptrunner")) -from wptmanifest import parser, node - CONFIG_FILE_PATH = os.path.join(".", "servo-tidy.toml") WPT_MANIFEST_PATH = wpt_path("include.ini") +# Import wptmanifest only when we do have wpt in tree, i.e. we're not +# inside a Firefox checkout. +if os.path.isfile(WPT_MANIFEST_PATH): + sys.path.append(wpt_path("web-platform-tests", "tools", "wptrunner", "wptrunner")) + from wptmanifest import parser, node + # Default configs config = { "skip-check-length": False, @@ -1166,7 +1169,10 @@ def scan(only_changed_files=False, progress=True, stylo=False): # check config file for errors config_errors = check_config_file(CONFIG_FILE_PATH) # check ini directories exist - manifest_errors = check_manifest_dirs(WPT_MANIFEST_PATH) + if os.path.isfile(WPT_MANIFEST_PATH): + manifest_errors = check_manifest_dirs(WPT_MANIFEST_PATH) + else: + manifest_errors = () # check directories contain expected files directory_errors = check_directory_files(config['check_ext']) # standard checks