From 4c240eb6325da2bae1e5431288b38bffb4b6a886 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 7 Mar 2018 17:22:12 +1100 Subject: [PATCH] Don't import wptmanifest when in firefox tree. --- python/tidy/servo_tidy/tidy.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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