4 from argparse
import ArgumentParser
6 logger
= logging
.getLogger()
8 wpt_root
= os
.path
.abspath(os
.path
.join(os
.path
.dirname(__file__
), os
.pardir
, os
.pardir
))
11 "canvas": ["html/canvas/tools/gentest.py"],
12 "conformance-checkers": ["conformance-checkers/tools/dl.py",
13 "conformance-checkers/tools/ins-del-datetime.py",
14 "conformance-checkers/tools/picture.py",
15 "conformance-checkers/tools/url.py"],
16 "css-ui": ["css/css-ui/tools/appearance-build-webkit-reftests.py"],
17 "html5lib": ["html/tools/update_html5lib_tests.py"],
18 "infrastructure": ["infrastructure/assumptions/tools/ahem-generate-table.py"],
19 "mimesniff": ["mimesniff/mime-types/resources/generated-mime-types.py"],
20 "speculative-parsing": ["html/syntax/speculative-parsing/tools/generate.py"]
25 parser
= ArgumentParser()
26 parser
.add_argument("--list", action
="store_true",
27 help="List suites that can be updated and the related script files")
28 parser
.add_argument("--include", nargs
="*", choices
=scripts
.keys(), default
=None,
29 help="Suites to update (default is to update everything)")
33 def list_suites(include
):
34 for name
, script_paths
in scripts
.items():
37 for script_path
in script_paths
:
38 print(f
" {script_path}")
41 def run(venv
, **kwargs
):
42 include
= kwargs
["include"]
44 include
= list(scripts
.keys())
52 for target
in include
:
53 for script
in scripts
[target
]:
54 script_path
= script
.replace("/", os
.path
.sep
)
55 cmd
= [os
.path
.join(venv
.bin_path
, "python3"), os
.path
.join(wpt_root
, script_path
)]
56 logger
.info(f
"Running {' '.join(cmd)}")
58 subprocess
.check_call(cmd
, cwd
=os
.path
.dirname(script_path
))
59 except subprocess
.CalledProcessError
:
60 logger
.error(f
"Update script {script} failed")
63 return 1 if failed
else 0