diff options
author | Martin Robinson <mrobinson@igalia.com> | 2023-04-16 11:33:02 +0200 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2023-04-20 12:24:55 +0200 |
commit | e2cf3e8d1a47ae91b53c2edc20ed605731eb5979 (patch) | |
tree | b7b11a8ff3493a204c9c99cfe27f78e4389b7ce5 /python/wpt/update.py | |
parent | 9acb9cc5cf21d14709355a3c75af7202e9301bd5 (diff) | |
download | servo-e2cf3e8d1a47ae91b53c2edc20ed605731eb5979.tar.gz servo-e2cf3e8d1a47ae91b53c2edc20ed605731eb5979.zip |
Reorganize Servo's WPT Python scripts
This change moves all of Servo's WPT Python support scripts into one
directory as they were previously scattered throughout the directory
structure. This should allow more code reuse and make it easier to
understand how everything fits together.
The changes:
- `tests/wpt/update` → `python/wpt/importer`
- `etc/ci/upstream-wpt-changes/wptupstreamer` → `python/wpt/exporter`
- `etc/ci/upstream-wpt-changes/test.py` → `python/wpt/test.py`
- `etc/ci/upstream-wpt-changes/tests` → `python/wpt/tests`
- `tests/wpt/servowpt.py` →
- `python/wpt/update.py`
- `python/wpt/run.py`
- `tests/wpt/manifestupdate.py` → `python/wpt/manifestupdate.py`
This change also removes
- The ability to run the `update-wpt` and `test-wpt` commands without
using `mach`. These didn't work very well, because it was difficult
to get all of the wptrunner and mach dependencies installed outside
of the Python virtualenv. It's simpler if they are always run through
`mach`.
- The old WPT change upstreaming script that was no longer used.
Diffstat (limited to 'python/wpt/update.py')
-rw-r--r-- | python/wpt/update.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/python/wpt/update.py b/python/wpt/update.py new file mode 100644 index 00000000000..377ba06e3ce --- /dev/null +++ b/python/wpt/update.py @@ -0,0 +1,29 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. +# pylint: disable=missing-docstring + +import os + +from . import WPT_PATH, update_args_for_layout_2020 +from . import importer + + +def set_if_none(args: dict, key: str, value): + if key not in args or args[key] is None: + args[key] = value + + +def update_tests(**kwargs): + set_if_none(kwargs, "product", "servo") + set_if_none(kwargs, "config", os.path.join(WPT_PATH, "config.ini")) + kwargs["store_state"] = False + + importer.check_args(kwargs) + update_args_for_layout_2020(kwargs) + + return 1 if not importer.run_update(**kwargs) else 0 + + +def create_parser(**kwargs): + return importer.create_parser() |