本文整理汇总了Python中webkitpy.common.webkit_finder.WebKitFinder.webkit_base方法的典型用法代码示例。如果您正苦于以下问题:Python WebKitFinder.webkit_base方法的具体用法?Python WebKitFinder.webkit_base怎么用?Python WebKitFinder.webkit_base使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webkitpy.common.webkit_finder.WebKitFinder
的用法示例。
在下文中一共展示了WebKitFinder.webkit_base方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import webkit_base [as 别名]
def __init__(self, host, source_directory, options):
self.host = host
self.source_directory = source_directory
self.options = options
self.filesystem = self.host.filesystem
webkit_finder = WebKitFinder(self.filesystem)
self._webkit_root = webkit_finder.webkit_base()
self.destination_directory = webkit_finder.path_from_webkit_base("LayoutTests", options.destination)
self.tests_w3c_relative_path = self.filesystem.join('imported', 'w3c')
self.layout_tests_path = webkit_finder.path_from_webkit_base('LayoutTests')
self.layout_tests_w3c_path = self.filesystem.join(self.layout_tests_path, self.tests_w3c_relative_path)
self.tests_download_path = webkit_finder.path_from_webkit_base('WebKitBuild', 'w3c-tests')
self._test_downloader = None
self._potential_test_resource_files = []
self.import_list = []
self._importing_downloaded_tests = source_directory is None
self._test_resource_files_json_path = self.filesystem.join(self.layout_tests_w3c_path, "resources", "resource-files.json")
self._test_resource_files = json.loads(self.filesystem.read_text_file(self._test_resource_files_json_path)) if self.filesystem.exists(self._test_resource_files_json_path) else None
self._tests_options_json_path = self.filesystem.join(self.layout_tests_path, 'tests-options.json')
self._tests_options = json.loads(self.filesystem.read_text_file(self._tests_options_json_path)) if self.filesystem.exists(self._tests_options_json_path) else None
self._slow_tests = []
if self.options.clean_destination_directory and self._test_resource_files:
self._test_resource_files["files"] = []
if self._tests_options:
self.remove_slow_from_w3c_tests_options()
示例2: _determine_driver_path_statically
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import webkit_base [as 别名]
def _determine_driver_path_statically(cls, host, options):
config_object = config.Config(host.executive, host.filesystem)
build_directory = getattr(options, "build_directory", None)
finder = WebKitFinder(host.filesystem)
webkit_base = finder.webkit_base()
chromium_base = finder.chromium_base()
driver_name = cls.SKY_SHELL_NAME
if hasattr(options, "configuration") and options.configuration:
configuration = options.configuration
else:
configuration = config_object.default_configuration()
return cls._static_build_path(host.filesystem, build_directory, chromium_base, configuration, [driver_name])
示例3: __init__
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import webkit_base [as 别名]
def __init__(self, host, source_directory, options):
self.host = host
self.source_directory = source_directory
self.options = options
self.filesystem = self.host.filesystem
webkit_finder = WebKitFinder(self.filesystem)
self._webkit_root = webkit_finder.webkit_base()
self.destination_directory = webkit_finder.path_from_webkit_base("LayoutTests", options.destination)
self.import_list = []
示例4: __init__
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import webkit_base [as 别名]
def __init__(self, host, source_directory, options):
self.host = host
self.source_directory = source_directory
self.options = options
self.filesystem = self.host.filesystem
webkit_finder = WebKitFinder(self.filesystem)
self._webkit_root = webkit_finder.webkit_base()
self.destination_directory = webkit_finder.path_from_webkit_base("LayoutTests", options.destination)
self.layout_tests_w3c_path = webkit_finder.path_from_webkit_base('LayoutTests', 'imported', 'w3c')
self.tests_download_path = webkit_finder.path_from_webkit_base('WebKitBuild', 'w3c-tests')
self._test_downloader = None
self.import_list = []
self._importing_downloaded_tests = source_directory is None
示例5: TestImporter
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import webkit_base [as 别名]
class TestImporter(object):
def __init__(self, host, dir_to_import, top_of_repo, options):
self.host = host
self.dir_to_import = dir_to_import
self.top_of_repo = top_of_repo
self.options = options
self.filesystem = self.host.filesystem
self.webkit_finder = WebKitFinder(self.filesystem)
self._webkit_root = self.webkit_finder.webkit_base()
self.layout_tests_dir = self.webkit_finder.path_from_webkit_base('LayoutTests')
self.destination_directory = self.filesystem.normpath(self.filesystem.join(self.layout_tests_dir, options.destination,
self.filesystem.basename(self.top_of_repo)))
self.import_in_place = (self.dir_to_import == self.destination_directory)
self.changeset = CHANGESET_NOT_AVAILABLE
self.test_status = TEST_STATUS_UNKNOWN
self.import_list = []
def do_import(self):
_log.info("Importing %s into %s", self.dir_to_import, self.destination_directory)
self.find_importable_tests(self.dir_to_import)
self.load_changeset()
self.import_tests()
def load_changeset(self):
"""Returns the current changeset from mercurial or "Not Available"."""
try:
self.changeset = self.host.executive.run_command(['hg', 'tip']).split('changeset:')[1]
except (OSError, ScriptError):
self.changeset = CHANGESET_NOT_AVAILABLE
def find_importable_tests(self, directory):
# FIXME: use filesystem
paths_to_skip = self.find_paths_to_skip()
for root, dirs, files in os.walk(directory):
cur_dir = root.replace(self.layout_tests_dir + '/', '') + '/'
_log.info(' scanning ' + cur_dir + '...')
total_tests = 0
reftests = 0
jstests = 0
# "archive" and "data" dirs are internal csswg things that live in every approved directory.
# FIXME: skip 'incoming' tests for now, but we should rework the 'test_status' concept and
# support reading them as well.
DIRS_TO_SKIP = ('.git', '.hg', 'data', 'archive', 'incoming')
if dirs:
for d in DIRS_TO_SKIP:
if d in dirs:
dirs.remove(d)
for path in paths_to_skip:
path_base = path.replace(cur_dir, '')
path_full = self.filesystem.join(root, path_base)
if path_base in dirs:
dirs.remove(path_base)
if not self.options.dry_run and self.import_in_place:
_log.info(" pruning %s" % path_base)
self.filesystem.rmtree(path_full)
copy_list = []
for filename in files:
path_full = self.filesystem.join(root, filename)
path_base = path_full.replace(self.layout_tests_dir + '/', '')
if path_base in paths_to_skip:
if not self.options.dry_run and self.import_in_place:
_log.info(" pruning %s" % path_base)
self.filesystem.remove(path_full)
continue
# FIXME: This block should really be a separate function, but the early-continues make that difficult.
if filename.startswith('.') or filename.endswith('.pl'):
continue # For some reason the w3c repo contains random perl scripts we don't care about.
fullpath = os.path.join(root, filename)
mimetype = mimetypes.guess_type(fullpath)
if not 'html' in str(mimetype[0]) and not 'xml' in str(mimetype[0]):
copy_list.append({'src': fullpath, 'dest': filename})
continue
if root.endswith('resources'):
copy_list.append({'src': fullpath, 'dest': filename})
continue
test_parser = TestParser(vars(self.options), filename=fullpath)
test_info = test_parser.analyze_test()
if test_info is None:
continue
if 'reference' in test_info.keys():
reftests += 1
total_tests += 1
test_basename = os.path.basename(test_info['test'])
# Add the ref file, following WebKit style.
#.........这里部分代码省略.........
示例6: TestImporter
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import webkit_base [as 别名]
class TestImporter(object):
def __init__(self, host, dir_to_import, top_of_repo, options):
self.host = host
self.dir_to_import = dir_to_import
self.top_of_repo = top_of_repo
self.options = options
self.filesystem = self.host.filesystem
self.webkit_finder = WebKitFinder(self.filesystem)
self._webkit_root = self.webkit_finder.webkit_base()
self.layout_tests_dir = self.webkit_finder.path_from_webkit_base("LayoutTests")
self.destination_directory = self.filesystem.normpath(
self.filesystem.join(self.layout_tests_dir, options.destination, self.filesystem.basename(self.top_of_repo))
)
self.import_in_place = self.dir_to_import == self.destination_directory
self.dir_above_repo = self.filesystem.dirname(self.top_of_repo)
self.changeset = CHANGESET_NOT_AVAILABLE
self.import_list = []
def do_import(self):
_log.info("Importing %s into %s", self.dir_to_import, self.destination_directory)
self.find_importable_tests(self.dir_to_import)
self.load_changeset()
self.import_tests()
def load_changeset(self):
"""Returns the current changeset from mercurial or "Not Available"."""
try:
self.changeset = self.host.executive.run_command(["hg", "tip"]).split("changeset:")[1]
except (OSError, ScriptError):
self.changeset = CHANGESET_NOT_AVAILABLE
def find_importable_tests(self, directory):
# FIXME: use filesystem
paths_to_skip = self.find_paths_to_skip()
for root, dirs, files in os.walk(directory):
cur_dir = root.replace(self.dir_above_repo + "/", "") + "/"
_log.info(" scanning " + cur_dir + "...")
total_tests = 0
reftests = 0
jstests = 0
DIRS_TO_SKIP = (".git", ".hg")
if dirs:
for d in DIRS_TO_SKIP:
if d in dirs:
dirs.remove(d)
for path in paths_to_skip:
path_base = path.replace(self.options.destination + "/", "")
path_base = path_base.replace(cur_dir, "")
path_full = self.filesystem.join(root, path_base)
if path_base in dirs:
dirs.remove(path_base)
if not self.options.dry_run and self.import_in_place:
_log.info(" pruning %s" % path_base)
self.filesystem.rmtree(path_full)
else:
_log.info(" skipping %s" % path_base)
copy_list = []
for filename in files:
path_full = self.filesystem.join(root, filename)
path_base = path_full.replace(directory + "/", "")
path_base = self.destination_directory.replace(self.layout_tests_dir + "/", "") + "/" + path_base
if path_base in paths_to_skip:
if not self.options.dry_run and self.import_in_place:
_log.info(" pruning %s" % path_base)
self.filesystem.remove(path_full)
continue
else:
continue
# FIXME: This block should really be a separate function, but the early-continues make that difficult.
if filename.startswith(".") or filename.endswith(".pl"):
continue # For some reason the w3c repo contains random perl scripts we don't care about.
fullpath = os.path.join(root, filename)
mimetype = mimetypes.guess_type(fullpath)
if (
not "html" in str(mimetype[0])
and not "application/xhtml+xml" in str(mimetype[0])
and not "application/xml" in str(mimetype[0])
):
copy_list.append({"src": fullpath, "dest": filename})
continue
if root.endswith("resources"):
copy_list.append({"src": fullpath, "dest": filename})
continue
test_parser = TestParser(vars(self.options), filename=fullpath)
test_info = test_parser.analyze_test()
if test_info is None:
continue
#.........这里部分代码省略.........
示例7: W3CExpectationsLineAdder
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import webkit_base [as 别名]
#.........这里部分代码省略.........
if marker_comment_index == -1:
file_contents += '\n%s\n' % MARKER_COMMENT
file_contents += '\n'.join(line_list)
else:
end_of_marker_line = (file_contents[marker_comment_index:].find('\n')) + marker_comment_index
file_contents = file_contents[:end_of_marker_line + 1] + '\n'.join(line_list) + file_contents[end_of_marker_line:]
self.host.filesystem.write_text_file(expectations_file_path, file_contents)
@staticmethod
def _test_name_from_expectation_string(expectation_string):
return TestExpectationLine.tokenize_line(filename='', expectation_string=expectation_string, line_number=0).name
def get_expected_txt_files(self, tests_results):
"""Fetches new baseline files for tests that should be rebaselined.
Invokes webkit-patch rebaseline-from-try-jobs in order to download new
-expected.txt files for testharness.js tests that did not crash or time
out. Then, the platform-specific test is removed from the overall
failure test dictionary.
Args:
tests_results: A dict mapping test name to platform to test results.
Returns:
An updated tests_results dictionary without the platform-specific
testharness.js tests that required new baselines to be downloaded
from `webkit-patch rebaseline-from-try-jobs`.
"""
modified_tests = self.get_modified_existing_tests()
tests_to_rebaseline, tests_results = self.get_tests_to_rebaseline(modified_tests, tests_results)
_log.debug('Tests to rebaseline: %r', tests_to_rebaseline)
if tests_to_rebaseline:
webkit_patch = self.host.filesystem.join(
self.finder.chromium_base(), self.finder.webkit_base(), self.finder.path_to_script('webkit-patch'))
self.host.executive.run_command([
'python',
webkit_patch,
'rebaseline-cl',
'--verbose',
'--no-trigger-jobs',
] + tests_to_rebaseline)
return tests_results
def get_modified_existing_tests(self):
"""Returns a list of layout test names for layout tests that have been modified."""
diff_output = self.host.executive.run_command(
['git', 'diff', 'origin/master', '--name-only', '--diff-filter=AMR']) # Added, modified, and renamed files.
paths_from_chromium_root = diff_output.splitlines()
modified_tests = []
for path in paths_from_chromium_root:
absolute_path = self.host.filesystem.join(self.finder.chromium_base(), path)
if not self.host.filesystem.exists(absolute_path):
_log.warning('File does not exist: %s', absolute_path)
continue
test_path = self.finder.layout_test_name(path)
if test_path:
modified_tests.append(test_path)
return modified_tests
def get_tests_to_rebaseline(self, modified_tests, test_results):
"""Returns a list of tests to download new baselines for.
Creates a list of tests to rebaseline depending on the tests' platform-
specific results. In general, this will be non-ref tests that failed
due to a baseline mismatch (rather than crash or timeout).
示例8: TestImporter
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import webkit_base [as 别名]
class TestImporter(object):
def __init__(self, host, source_repo_path, options):
self.host = host
self.source_repo_path = source_repo_path
self.options = options
self.filesystem = self.host.filesystem
self.webkit_finder = WebKitFinder(self.filesystem)
self._webkit_root = self.webkit_finder.webkit_base()
self.layout_tests_dir = self.webkit_finder.path_from_webkit_base("LayoutTests")
self.destination_directory = self.filesystem.normpath(
self.filesystem.join(
self.layout_tests_dir, options.destination, self.filesystem.basename(self.source_repo_path)
)
)
self.import_in_place = self.source_repo_path == self.destination_directory
self.dir_above_repo = self.filesystem.dirname(self.source_repo_path)
self.import_list = []
def do_import(self):
_log.info("Importing %s into %s", self.source_repo_path, self.destination_directory)
self.find_importable_tests()
self.import_tests()
def find_importable_tests(self):
"""Walks through the source directory to find what tests should be imported.
This function sets self.import_list, which contains information about how many
tests are being imported, and their source and destination paths.
"""
paths_to_skip = self.find_paths_to_skip()
for root, dirs, files in self.filesystem.walk(self.source_repo_path):
cur_dir = root.replace(self.dir_above_repo + "/", "") + "/"
_log.info(" scanning " + cur_dir + "...")
total_tests = 0
reftests = 0
jstests = 0
# Files in 'tools' are not for browser testing, so we skip them.
# See: http://testthewebforward.org/docs/test-format-guidelines.html#tools
DIRS_TO_SKIP = (".git", "test-plan", "tools")
# We copy all files in 'support', including HTML without metadata.
# See: http://testthewebforward.org/docs/test-format-guidelines.html#support-files
DIRS_TO_INCLUDE = ("resources", "support")
if dirs:
for d in DIRS_TO_SKIP:
if d in dirs:
dirs.remove(d)
for path in paths_to_skip:
path_base = path.replace(self.options.destination + "/", "")
path_base = path_base.replace(cur_dir, "")
path_full = self.filesystem.join(root, path_base)
if path_base in dirs:
dirs.remove(path_base)
if not self.options.dry_run and self.import_in_place:
_log.info(" pruning %s", path_base)
self.filesystem.rmtree(path_full)
else:
_log.info(" skipping %s", path_base)
copy_list = []
for filename in files:
path_full = self.filesystem.join(root, filename)
path_base = path_full.replace(self.source_repo_path + "/", "")
path_base = self.destination_directory.replace(self.layout_tests_dir + "/", "") + "/" + path_base
if path_base in paths_to_skip:
if not self.options.dry_run and self.import_in_place:
_log.info(" pruning %s", path_base)
self.filesystem.remove(path_full)
continue
else:
continue
# FIXME: This block should really be a separate function, but the early-continues make that difficult.
if filename.startswith(".") or filename.endswith(".pl"):
# The w3cs repos may contain perl scripts, which we don't care about.
continue
if filename == "OWNERS" or filename == "reftest.list":
# These files fail our presubmits.
# See http://crbug.com/584660 and http://crbug.com/582838.
continue
fullpath = self.filesystem.join(root, filename)
mimetype = mimetypes.guess_type(fullpath)
if (
"html" not in str(mimetype[0])
and "application/xhtml+xml" not in str(mimetype[0])
and "application/xml" not in str(mimetype[0])
):
copy_list.append({"src": fullpath, "dest": filename})
continue
if self.filesystem.basename(root) in DIRS_TO_INCLUDE:
#.........这里部分代码省略.........
示例9: test_webkit_base
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import webkit_base [as 别名]
def test_webkit_base(self):
finder = WebKitFinder(MockFileSystem())
self.assertEqual(finder.webkit_base(), '/mock-checkout/third_party/WebKit')
示例10: TestImporter
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import webkit_base [as 别名]
class TestImporter(object):
def __init__(self, host, dir_to_import, top_of_repo, options):
self.host = host
self.dir_to_import = dir_to_import
self.top_of_repo = top_of_repo
self.options = options
self.filesystem = self.host.filesystem
self.webkit_finder = WebKitFinder(self.filesystem)
self._webkit_root = self.webkit_finder.webkit_base()
self.layout_tests_dir = self.webkit_finder.path_from_webkit_base('LayoutTests')
self.destination_directory = self.filesystem.normpath(self.filesystem.join(self.layout_tests_dir, options.destination,
self.filesystem.basename(self.top_of_repo)))
self.import_in_place = (self.dir_to_import == self.destination_directory)
self.dir_above_repo = self.filesystem.dirname(self.top_of_repo)
self.import_list = []
def do_import(self):
_log.info("Importing %s into %s", self.dir_to_import, self.destination_directory)
self.find_importable_tests(self.dir_to_import)
self.import_tests()
def find_importable_tests(self, directory):
paths_to_skip = self.find_paths_to_skip()
for root, dirs, files in self.filesystem.walk(directory):
cur_dir = root.replace(self.dir_above_repo + '/', '') + '/'
_log.info(' scanning ' + cur_dir + '...')
total_tests = 0
reftests = 0
jstests = 0
# Files in 'tools' are not for browser testing (e.g., a script for generating test files).
# http://testthewebforward.org/docs/test-format-guidelines.html#tools
DIRS_TO_SKIP = ('.git', 'test-plan', 'tools')
# Need to copy all files in 'support', including HTML without meta data.
# http://testthewebforward.org/docs/test-format-guidelines.html#support-files
DIRS_TO_INCLUDE = ('resources', 'support')
if dirs:
for d in DIRS_TO_SKIP:
if d in dirs:
dirs.remove(d)
for path in paths_to_skip:
path_base = path.replace(self.options.destination + '/', '')
path_base = path_base.replace(cur_dir, '')
path_full = self.filesystem.join(root, path_base)
if path_base in dirs:
dirs.remove(path_base)
if not self.options.dry_run and self.import_in_place:
_log.info(" pruning %s" % path_base)
self.filesystem.rmtree(path_full)
else:
_log.info(" skipping %s" % path_base)
copy_list = []
for filename in files:
path_full = self.filesystem.join(root, filename)
path_base = path_full.replace(directory + '/', '')
path_base = self.destination_directory.replace(self.layout_tests_dir + '/', '') + '/' + path_base
if path_base in paths_to_skip:
if not self.options.dry_run and self.import_in_place:
_log.info(" pruning %s" % path_base)
self.filesystem.remove(path_full)
continue
else:
continue
# FIXME: This block should really be a separate function, but the early-continues make that difficult.
if filename.startswith('.') or filename.endswith('.pl'):
continue # For some reason the w3c repo contains random perl scripts we don't care about.
fullpath = self.filesystem.join(root, filename)
mimetype = mimetypes.guess_type(fullpath)
if not 'html' in str(mimetype[0]) and not 'application/xhtml+xml' in str(mimetype[0]) and not 'application/xml' in str(mimetype[0]):
copy_list.append({'src': fullpath, 'dest': filename})
continue
if self.filesystem.basename(root) in DIRS_TO_INCLUDE:
copy_list.append({'src': fullpath, 'dest': filename})
continue
test_parser = TestParser(vars(self.options), filename=fullpath)
test_info = test_parser.analyze_test()
if test_info is None:
continue
if 'reference' in test_info.keys():
reftests += 1
total_tests += 1
test_basename = self.filesystem.basename(test_info['test'])
# Add the ref file, following WebKit style.
# FIXME: Ideally we'd support reading the metadata
#.........这里部分代码省略.........
示例11: DepsUpdater
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import webkit_base [as 别名]
class DepsUpdater(object):
def __init__(self, host):
self.host = host
self.executive = host.executive
self.fs = host.filesystem
self.finder = WebKitFinder(self.fs)
self.verbose = False
self.git_cl = None
def main(self, argv=None):
options = self.parse_args(argv)
self.verbose = options.verbose
if not self.checkout_is_okay(options.allow_local_commits):
return 1
self.git_cl = GitCL(self.host, auth_refresh_token_json=options.auth_refresh_token_json)
self.print_("## Noting the current Chromium commit.")
_, show_ref_output = self.run(["git", "show-ref", "HEAD"])
chromium_commitish = show_ref_output.split()[0]
if options.target == "wpt":
import_commitish = self.update(WPT_DEST_NAME, WPT_REPO_URL, options.keep_w3c_repos_around, options.revision)
self._copy_resources()
elif options.target == "css":
import_commitish = self.update(CSS_DEST_NAME, CSS_REPO_URL, options.keep_w3c_repos_around, options.revision)
else:
raise AssertionError("Unsupported target %s" % options.target)
has_changes = self.commit_changes_if_needed(chromium_commitish, import_commitish)
if options.auto_update and has_changes:
commit_successful = self.do_auto_update()
if not commit_successful:
return 1
return 0
def parse_args(self, argv):
parser = argparse.ArgumentParser()
parser.description = __doc__
parser.add_argument("-v", "--verbose", action="store_true", help="log what we are doing")
parser.add_argument(
"--allow-local-commits", action="store_true", help="allow script to run even if we have local commits"
)
parser.add_argument(
"--keep-w3c-repos-around",
action="store_true",
help="leave the w3c repos around that were imported previously.",
)
parser.add_argument("-r", dest="revision", action="store", help="Target revision.")
parser.add_argument(
"target",
choices=["css", "wpt"],
help='Target repository. "css" for csswg-test, "wpt" for web-platform-tests.',
)
parser.add_argument("--auto-update", action="store_true", help="uploads CL and initiates commit queue.")
parser.add_argument("--auth-refresh-token-json", help="Rietveld auth refresh JSON token.")
return parser.parse_args(argv)
def checkout_is_okay(self, allow_local_commits):
git_diff_retcode, _ = self.run(["git", "diff", "--quiet", "HEAD"], exit_on_failure=False)
if git_diff_retcode:
self.print_("## Checkout is dirty; aborting.")
return False
local_commits = self.run(["git", "log", "--oneline", "origin/master..HEAD"])[1]
if local_commits and not allow_local_commits:
self.print_("## Checkout has local commits; aborting. Use --allow-local-commits to allow this.")
return False
if self.fs.exists(self.path_from_webkit_base(WPT_DEST_NAME)):
self.print_("## WebKit/%s exists; aborting." % WPT_DEST_NAME)
return False
if self.fs.exists(self.path_from_webkit_base(CSS_DEST_NAME)):
self.print_("## WebKit/%s repo exists; aborting." % CSS_DEST_NAME)
return False
return True
def _copy_resources(self):
"""Copies resources from LayoutTests/resources to wpt and vice versa.
There are resources from our repository that we use instead of the
upstream versions. Conversely, there are also some resources that
are copied in the other direction.
Specifically:
- testharnessreport.js contains code needed to integrate our testing
with testharness.js; we also want our code to be used for tests
in wpt.
- TODO(qyearsley, jsbell): Document why other other files are copied,
or stop copying them if it's unnecessary.
If this method is changed, the lists of files expected to be identical
in LayoutTests/PRESUBMIT.py should also be changed.
"""
resources_to_copy_to_wpt = [
("testharnessreport.js", "resources"),
("WebIDLParser.js", "resources"),
#.........这里部分代码省略.........
示例12: DepsUpdater
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import webkit_base [as 别名]
class DepsUpdater(object):
def __init__(self, host):
self.host = host
self.executive = host.executive
self.fs = host.filesystem
self.finder = WebKitFinder(self.fs)
self.verbose = False
self.git_cl = None
def main(self, argv=None):
options = self.parse_args(argv)
self.verbose = options.verbose
if not self.checkout_is_okay(options.allow_local_commits):
return 1
self.git_cl = GitCL(self.host, auth_refresh_token_json=options.auth_refresh_token_json)
self.print_('## Noting the current Chromium commit.')
_, show_ref_output = self.run(['git', 'show-ref', 'HEAD'])
chromium_commitish = show_ref_output.split()[0]
if options.target == 'wpt':
import_commitish = self.update(WPT_DEST_NAME, WPT_REPO_URL, options.keep_w3c_repos_around, options.revision)
self._copy_resources()
elif options.target == 'css':
import_commitish = self.update(CSS_DEST_NAME, CSS_REPO_URL, options.keep_w3c_repos_around, options.revision)
else:
raise AssertionError("Unsupported target %s" % options.target)
has_changes = self.commit_changes_if_needed(chromium_commitish, import_commitish)
if options.auto_update and has_changes:
commit_successful = self.do_auto_update()
if not commit_successful:
return 1
return 0
def parse_args(self, argv):
parser = argparse.ArgumentParser()
parser.description = __doc__
parser.add_argument('-v', '--verbose', action='store_true',
help='log what we are doing')
parser.add_argument('--allow-local-commits', action='store_true',
help='allow script to run even if we have local commits')
parser.add_argument('--keep-w3c-repos-around', action='store_true',
help='leave the w3c repos around that were imported previously.')
parser.add_argument('-r', dest='revision', action='store',
help='Target revision.')
parser.add_argument('target', choices=['css', 'wpt'],
help='Target repository. "css" for csswg-test, "wpt" for web-platform-tests.')
parser.add_argument('--auto-update', action='store_true',
help='uploads CL and initiates commit queue.')
parser.add_argument('--auth-refresh-token-json',
help='Rietveld auth refresh JSON token.')
return parser.parse_args(argv)
def checkout_is_okay(self, allow_local_commits):
git_diff_retcode, _ = self.run(['git', 'diff', '--quiet', 'HEAD'], exit_on_failure=False)
if git_diff_retcode:
self.print_('## Checkout is dirty; aborting.')
return False
local_commits = self.run(['git', 'log', '--oneline', 'origin/master..HEAD'])[1]
if local_commits and not allow_local_commits:
self.print_('## Checkout has local commits; aborting. Use --allow-local-commits to allow this.')
return False
if self.fs.exists(self.path_from_webkit_base(WPT_DEST_NAME)):
self.print_('## WebKit/%s exists; aborting.' % WPT_DEST_NAME)
return False
if self.fs.exists(self.path_from_webkit_base(CSS_DEST_NAME)):
self.print_('## WebKit/%s repo exists; aborting.' % CSS_DEST_NAME)
return False
return True
def _copy_resources(self):
"""Copies resources from LayoutTests/resources to wpt and vice versa.
There are resources from our repository that we use instead of the
upstream versions. Conversely, there are also some resources that
are copied in the other direction.
Specifically:
- testharnessreport.js contains code needed to integrate our testing
with testharness.js; we also want our code to be used for tests
in wpt.
- TODO(qyearsley, jsbell): Document why other other files are copied,
or stop copying them if it's unnecessary.
If this method is changed, the lists of files expected to be identical
in LayoutTests/PRESUBMIT.py should also be changed.
"""
# TODO(tkent): resources_to_copy_to_wpt is unnecessary after enabling
# WPTServe.
resources_to_copy_to_wpt = [
('testharnessreport.js', 'resources'),
('WebIDLParser.js', 'resources'),
#.........这里部分代码省略.........