mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Put a copy of the wptrunner harness in-tree.
This is the same configuration as gecko and is convenient for making changes compared to using releases from pypi
This commit is contained in:
parent
f7ff2aa558
commit
168b81773e
120 changed files with 11690 additions and 0 deletions
53
tests/wpt/harness/wptrunner/vcs.py
Normal file
53
tests/wpt/harness/wptrunner/vcs.py
Normal file
|
@ -0,0 +1,53 @@
|
|||
# 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 http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import subprocess
|
||||
from functools import partial
|
||||
|
||||
from mozlog.structured import get_default_logger
|
||||
|
||||
logger = None
|
||||
|
||||
def vcs(bin_name):
|
||||
def inner(command, *args, **kwargs):
|
||||
global logger
|
||||
|
||||
if logger is None:
|
||||
logger = get_default_logger("vcs")
|
||||
|
||||
repo = kwargs.pop("repo", None)
|
||||
log_error = kwargs.pop("log_error", True)
|
||||
if kwargs:
|
||||
raise TypeError, kwargs
|
||||
|
||||
args = list(args)
|
||||
|
||||
proc_kwargs = {}
|
||||
if repo is not None:
|
||||
proc_kwargs["cwd"] = repo
|
||||
|
||||
command_line = [bin_name, command] + args
|
||||
logger.debug(" ".join(command_line))
|
||||
try:
|
||||
return subprocess.check_output(command_line, stderr=subprocess.STDOUT, **proc_kwargs)
|
||||
except subprocess.CalledProcessError as e:
|
||||
if log_error:
|
||||
logger.error(e.output)
|
||||
raise
|
||||
return inner
|
||||
|
||||
git = vcs("git")
|
||||
hg = vcs("hg")
|
||||
|
||||
|
||||
def bind_to_repo(vcs_func, repo):
|
||||
return partial(vcs_func, repo=repo)
|
||||
|
||||
|
||||
def is_git_root(path):
|
||||
try:
|
||||
rv = git("rev-parse", "--show-cdup", repo=path)
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
return rv == "\n"
|
Loading…
Add table
Add a link
Reference in a new issue