本文整理汇总了Python中webkitpy.common.system.deprecated_logging.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
def run(self, state):
if not self._options.test:
return
if not self._options.non_interactive:
# FIXME: We should teach the commit-queue and the EWS how to run these tests.
python_unittests_command = self._tool.port().run_python_unittests_command()
if python_unittests_command:
log("Running Python unit tests")
self._tool.executive.run_and_throw_if_fail(python_unittests_command, cwd=self._tool.scm().checkout_root)
perl_unittests_command = self._tool.port().run_perl_unittests_command()
if perl_unittests_command:
log("Running Perl unit tests")
self._tool.executive.run_and_throw_if_fail(perl_unittests_command, cwd=self._tool.scm().checkout_root)
javascriptcore_tests_command = self._tool.port().run_javascriptcore_tests_command()
if javascriptcore_tests_command:
log("Running JavaScriptCore tests")
self._tool.executive.run_and_throw_if_fail(javascriptcore_tests_command, quiet=True, cwd=self._tool.scm().checkout_root)
webkit_unit_tests_command = self._tool.port().run_webkit_unit_tests_command()
if webkit_unit_tests_command:
log("Running WebKit unit tests")
args = webkit_unit_tests_command
if self._options.non_interactive:
args.append("--gtest_output=xml:%s/webkit_unit_tests_output.xml" % self._tool.port().results_directory)
try:
self._tool.executive.run_and_throw_if_fail(args, cwd=self._tool.scm().checkout_root)
except ScriptError, e:
log("Error running webkit_unit_tests: %s" % e.message_with_output())
示例2: post
def post(self, diff, message=None, codereview_issue=None, cc=None):
if not message:
raise ScriptError("Rietveld requires a message.")
args = [
# First argument is empty string to mimic sys.argv.
"",
"--assume_yes",
"--server=%s" % config.codereview_server_host,
"--message=%s" % message,
]
if codereview_issue:
args.append("--issue=%s" % codereview_issue)
if cc:
args.append("--cc=%s" % cc)
if self.dryrun:
log("Would have run %s" % args)
return
# Set logging level to avoid rietveld's logging spew.
old_level_name = logging.getLogger().getEffectiveLevel()
logging.getLogger().setLevel(logging.ERROR)
# Use RealMain instead of calling upload from the commandline so that
# we can pass in the diff ourselves. Otherwise, upload will just use
# git diff for git checkouts, which doesn't respect --squash and --git-commit.
issue, patchset = upload.RealMain(args[1:], data=diff)
# Reset logging level to the original value.
logging.getLogger().setLevel(old_level_name)
return issue
示例3: feed
def feed(self):
ids_needing_review = set(self._tool.bugs.queries.fetch_attachment_ids_from_review_queue())
new_ids = ids_needing_review.difference(self._ids_sent_to_server)
log("Feeding EWS (%s, %s new)" % (pluralize("r? patch", len(ids_needing_review)), len(new_ids)))
for attachment_id in new_ids: # Order doesn't really matter for the EWS.
self._tool.status_server.submit_to_ews(attachment_id)
self._ids_sent_to_server.add(attachment_id)
示例4: run
def run(self):
self._begin_logging()
self._delegate.begin_work_queue()
while (self._delegate.should_continue_work_queue()):
try:
self._ensure_work_log_closed()
work_item = self._delegate.next_work_item()
if not work_item:
self._sleep("No work item.")
continue
if not self._delegate.should_proceed_with_work_item(work_item):
self._sleep("Not proceeding with work item.")
continue
# FIXME: Work logs should not depend on bug_id specificaly.
# This looks fixed, no?
self._open_work_log(work_item)
try:
if not self._delegate.process_work_item(work_item):
self._sleep("Unable to process work item.")
except ScriptError, e:
# Use a special exit code to indicate that the error was already
# handled in the child process and we should just keep looping.
if e.exit_code == self.handled_error_code:
continue
message = "Unexpected failure when landing patch! Please file a bug against webkit-patch.\n%s" % e.message_with_output()
self._delegate.handle_unexpected_error(work_item, message)
except TerminateQueue, e:
log("\nTerminateQueue exception received.")
return 0
except KeyboardInterrupt, e:
log("\nUser terminated queue.")
return 1
示例5: _run_script
def _run_script(self, script_name, args=None, quiet=False, port=WebKitPort):
log("Running %s" % script_name)
command = [port.script_path(script_name)]
if args:
command.extend(args)
# FIXME: This should use self.port()
self._tool.executive.run_and_throw_if_fail(command, quiet)
示例6: _commit_on_branch
def _commit_on_branch(self, message, git_commit, username=None, password=None):
branch_ref = self.run(["git", "symbolic-ref", "HEAD"]).strip()
branch_name = branch_ref.replace("refs/heads/", "")
commit_ids = self.commit_ids_from_commitish_arguments([git_commit])
# We want to squash all this branch's commits into one commit with the proper description.
# We do this by doing a "merge --squash" into a new commit branch, then dcommitting that.
MERGE_BRANCH_NAME = "webkit-patch-land"
self.delete_branch(MERGE_BRANCH_NAME)
# We might be in a directory that's present in this branch but not in the
# trunk. Move up to the top of the tree so that git commands that expect a
# valid CWD won't fail after we check out the merge branch.
# FIXME: We should never be using chdir! We can instead pass cwd= to run_command/self.run!
self._filesystem.chdir(self.checkout_root)
# Stuff our change into the merge branch.
# We wrap in a try...finally block so if anything goes wrong, we clean up the branches.
commit_succeeded = True
try:
self.run(["git", "checkout", "-q", "-b", MERGE_BRANCH_NAME, self.remote_branch_ref()])
for commit in commit_ids:
# We're on a different branch now, so convert "head" to the branch name.
commit = re.sub(r"(?i)head", branch_name, commit)
# FIXME: Once changed_files and create_patch are modified to separately handle each
# commit in a commit range, commit each cherry pick so they'll get dcommitted separately.
self.run(["git", "cherry-pick", "--no-commit", commit])
self.run(["git", "commit", "-m", message])
output = self.push_local_commits_to_server(username=username, password=password)
except Exception, e:
log("COMMIT FAILED: " + str(e))
output = "Commit failed."
commit_succeeded = False
示例7: run
def run(self, state):
self._commit_message = self._tool.checkout().commit_message_for_this_commit(self._options.git_commit).message()
if len(self._commit_message) < 50:
raise Exception("Attempted to commit with a commit message shorter than 50 characters. Either your patch is missing a ChangeLog or webkit-patch may have a bug.")
self._state = state
username = None
force_squash = False
num_tries = 0
while num_tries < 3:
num_tries += 1
try:
scm = self._tool.scm()
commit_text = scm.commit_with_message(self._commit_message, git_commit=self._options.git_commit, username=username, force_squash=force_squash)
svn_revision = scm.svn_revision_from_commit_text(commit_text)
log("Committed r%s: <%s>" % (svn_revision, view_source_url(svn_revision)))
self._state["commit_text"] = commit_text
break;
except AmbiguousCommitError, e:
if self._tool.user.confirm(self._commit_warning(e)):
force_squash = True
else:
# This will correctly interrupt the rest of the commit process.
raise ScriptError(message="Did not commit")
except AuthenticationError, e:
username = self._tool.user.prompt("%s login: " % e.server_host, repeat=5)
if not username:
raise ScriptError("You need to specify the username on %s to perform the commit as." % self.svn_server_host)
示例8: authenticate
def authenticate(self):
if self.authenticated:
return
credentials = Credentials(config_urls.bug_server_host, git_prefix="bugzilla")
attempts = 0
while not self.authenticated:
attempts += 1
username, password = credentials.read_credentials()
log("Logging in as %s..." % username)
self.browser.open(config_urls.bug_server_url + "index.cgi?GoAheadAndLogIn=1")
self.browser.select_form(name="login")
self.browser["Bugzilla_login"] = username
self.browser["Bugzilla_password"] = password
response = self.browser.submit()
match = re.search("<title>(.+?)</title>", response.read())
# If the resulting page has a title, and it contains the word
# "invalid" assume it's the login failure page.
if match and re.search("Invalid", match.group(1), re.IGNORECASE):
errorMessage = "Bugzilla login failed: %s" % match.group(1)
# raise an exception only if this was the last attempt
if attempts < 5:
log(errorMessage)
else:
raise Exception(errorMessage)
else:
self.authenticated = True
self.username = username
示例9: set_flag_on_attachment
def set_flag_on_attachment(
self, attachment_id, flag_name, flag_value, comment_text=None, additional_comment_text=None
):
log(
"MOCK setting flag '%s' to '%s' on attachment '%s' with comment '%s' and additional comment '%s'"
% (flag_name, flag_value, attachment_id, comment_text, additional_comment_text)
)
示例10: apply_reverse_diff
def apply_reverse_diff(self, revision):
# '-c -revision' applies the inverse diff of 'revision'
svn_merge_args = ['svn', 'merge', '--non-interactive', '-c', '-%s' % revision, self._repository_url()]
log("WARNING: svn merge has been known to take more than 10 minutes to complete. It is recommended you use git for rollouts.")
log("Running '%s'" % " ".join(svn_merge_args))
# FIXME: Should this use cwd=self.checkout_root?
self.run(svn_merge_args)
示例11: _commit_on_branch
def _commit_on_branch(self, message, git_commit):
branch_ref = self.run(['git', 'symbolic-ref', 'HEAD']).strip()
branch_name = branch_ref.replace('refs/heads/', '')
commit_ids = self.commit_ids_from_commitish_arguments([git_commit])
# We want to squash all this branch's commits into one commit with the proper description.
# We do this by doing a "merge --squash" into a new commit branch, then dcommitting that.
MERGE_BRANCH_NAME = 'webkit-patch-land'
self.delete_branch(MERGE_BRANCH_NAME)
# We might be in a directory that's present in this branch but not in the
# trunk. Move up to the top of the tree so that git commands that expect a
# valid CWD won't fail after we check out the merge branch.
os.chdir(self.checkout_root)
# Stuff our change into the merge branch.
# We wrap in a try...finally block so if anything goes wrong, we clean up the branches.
commit_succeeded = True
try:
self.run(['git', 'checkout', '-q', '-b', MERGE_BRANCH_NAME, self.remote_branch_ref()])
for commit in commit_ids:
# We're on a different branch now, so convert "head" to the branch name.
commit = re.sub(r'(?i)head', branch_name, commit)
# FIXME: Once changed_files and create_patch are modified to separately handle each
# commit in a commit range, commit each cherry pick so they'll get dcommitted separately.
self.run(['git', 'cherry-pick', '--no-commit', commit])
self.run(['git', 'commit', '-m', message])
output = self.push_local_commits_to_server()
except Exception, e:
log("COMMIT FAILED: " + str(e))
output = "Commit failed."
commit_succeeded = False
示例12: _fetch_list_of_patches_to_process
def _fetch_list_of_patches_to_process(self, options, args, tool):
all_patches = []
for bug_id in args:
patches = tool.bugs.fetch_bug(bug_id).reviewed_patches()
log("%s found on bug %s." % (pluralize("reviewed patch", len(patches)), bug_id))
all_patches += patches
return all_patches
示例13: begin_work_queue
def begin_work_queue(self):
log("CAUTION: %s will discard all local changes in \"%s\"" % (self.name, self.tool.scm().checkout_root))
if self.options.confirm:
response = self.tool.user.prompt("Are you sure? Type \"yes\" to continue: ")
if (response != "yes"):
error("User declined.")
log("Running WebKit %s." % self.name)
示例14: add_patch_to_bug
def add_patch_to_bug(
self,
bug_id,
file_or_string,
description,
comment_text=None,
mark_for_review=False,
mark_for_commit_queue=False,
mark_for_landing=False,
):
self.authenticate()
log('Adding patch "%s" to %s' % (description, self.bug_url_for_bug_id(bug_id)))
self.browser.open(self.add_attachment_url(bug_id))
self.browser.select_form(name="entryform")
file_object = self._file_object_for_upload(file_or_string)
filename = self._filename_for_upload(file_object, bug_id, extension="patch")
self._fill_attachment_form(
description,
file_object,
mark_for_review=mark_for_review,
mark_for_commit_queue=mark_for_commit_queue,
mark_for_landing=mark_for_landing,
is_patch=True,
filename=filename,
)
if comment_text:
log(comment_text)
self.browser["comment"] = comment_text
self.browser.submit()
示例15: run_command
def run_command(self,
args,
cwd=None,
input=None,
error_handler=None,
return_exit_code=False,
return_stderr=True,
decode_output=False,
env=None):
self.calls.append(args)
assert(isinstance(args, list) or isinstance(args, tuple))
if self._should_log:
env_string = ""
if env:
env_string = ", env=%s" % env
input_string = ""
if input:
input_string = ", input=%s" % input
log("MOCK run_command: %s, cwd=%s%s%s" % (args, cwd, env_string, input_string))
output = "MOCK output of child process"
if self._should_throw:
raise ScriptError("MOCK ScriptError", output=output)
return output