Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (225723 => 225724)
--- trunk/Source/_javascript_Core/ChangeLog 2017-12-09 10:41:32 UTC (rev 225723)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-12-09 16:58:36 UTC (rev 225724)
@@ -1,3 +1,13 @@
+2017-12-09 Konstantin Tokarev <[email protected]>
+
+ [python] Replace print >> operator with print() function for python3 compatibility
+ https://bugs.webkit.org/show_bug.cgi?id=180611
+
+ Reviewed by Michael Catanzaro.
+
+ * Scripts/make-js-file-arrays.py:
+ (main):
+
2017-12-08 Joseph Pecoraro <[email protected]>
ServiceWorker Inspector: Various issues inspecting service worker on mobile.twitter.com
Modified: trunk/Source/_javascript_Core/Scripts/make-js-file-arrays.py (225723 => 225724)
--- trunk/Source/_javascript_Core/Scripts/make-js-file-arrays.py 2017-12-09 10:41:32 UTC (rev 225723)
+++ trunk/Source/_javascript_Core/Scripts/make-js-file-arrays.py 2017-12-09 16:58:36 UTC (rev 225724)
@@ -21,6 +21,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import print_function
import io
import os
from optparse import OptionParser
@@ -60,11 +61,11 @@
inputPaths = arguments[2:]
headerFile = open(headerPath, 'w')
- print >> headerFile, 'namespace {0:s} {{'.format(namespace)
+ print('namespace {0:s} {{'.format(namespace), file=headerFile)
sourceFile = open(sourcePath, 'w')
- print >> sourceFile, '#include "{0:s}"'.format(os.path.basename(headerPath))
- print >> sourceFile, 'namespace {0:s} {{'.format(namespace)
+ print('#include "{0:s}"'.format(os.path.basename(headerPath)), file=sourceFile)
+ print('namespace {0:s} {{'.format(namespace), file=sourceFile)
jsm = _javascript_Minify()
@@ -81,17 +82,17 @@
size = len(characters)
variableName = os.path.splitext(os.path.basename(inputFileName))[0]
- print >> headerFile, 'extern const char {0:s}_javascript_[{1:d}];'.format(variableName, size)
- print >> sourceFile, 'const char {0:s}_javascript_[{1:d}] = {{'.format(variableName, size)
+ print('extern const char {0:s}_javascript_[{1:d}];'.format(variableName, size), file=headerFile)
+ print('const char {0:s}_javascript_[{1:d}] = {{'.format(variableName, size), file=sourceFile)
codepoints = map(ord, characters)
for codepointChunk in chunk(codepoints, 16):
- print >> sourceFile, ' {0:s},'.format(','.join(map(stringifyCodepoint, codepointChunk)))
+ print(' {0:s},'.format(','.join(map(stringifyCodepoint, codepointChunk))), file=sourceFile)
- print >> sourceFile, '};'
+ print('};', file=sourceFile)
- print >> headerFile, '}} // namespace {0:s}'.format(namespace)
- print >> sourceFile, '}} // namespace {0:s}'.format(namespace)
+ print('}} // namespace {0:s}'.format(namespace), file=headerFile)
+ print('}} // namespace {0:s}'.format(namespace), file=sourceFile)
if __name__ == '__main__':
main()
Modified: trunk/Tools/ChangeLog (225723 => 225724)
--- trunk/Tools/ChangeLog 2017-12-09 10:41:32 UTC (rev 225723)
+++ trunk/Tools/ChangeLog 2017-12-09 16:58:36 UTC (rev 225724)
@@ -1,3 +1,54 @@
+2017-12-09 Konstantin Tokarev <[email protected]>
+
+ [python] Replace print >> operator with print() function for python3 compatibility
+ https://bugs.webkit.org/show_bug.cgi?id=180611
+
+ Reviewed by Michael Catanzaro.
+
+ * CygwinDownloader/cygwin-downloader.py:
+ (download_url_to_file):
+ * Scripts/webkitpy/common/system/profiler.py:
+ (Perf.profile_after_exit):
+ * Scripts/webkitpy/common/version_check.py:
+ * Scripts/webkitpy/layout_tests/lint_test_expectations.py:
+ (main):
+ * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+ (main):
+ * Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py:
+ (run_server):
+ * Scripts/webkitpy/tool/commands/analyzechangelog.py:
+ (ChangeLogAnalyzer._print_status):
+ * Scripts/webkitpy/tool/commands/queries.py:
+ (BugsToCommit.execute):
+ (PatchesInCommitQueue.execute):
+ (PatchesToCommitQueue.execute):
+ (PatchesToReview._print_report):
+ (WhatBroke._print_builder_line):
+ (WhatBroke._print_blame_information_for_builder):
+ (WhatBroke.execute):
+ (ResultsFor._print_layout_test_results):
+ (ResultsFor.execute):
+ (FailureReason._print_blame_information_for_transition):
+ (FailureReason._explain_failures_for_builder):
+ (FailureReason._builder_to_explain):
+ (FailureReason.execute):
+ (FindFlakyTests._find_failures):
+ (FindFlakyTests._print_statistics):
+ (FindFlakyTests._walk_backwards_from):
+ (execute):
+ (PrintExpectations.execute):
+ (PrintBaselines.execute):
+ (PrintBaselines._print_baselines):
+ (FindResolvedBugs.execute):
+ * Scripts/webkitpy/tool/commands/rebaseline.py:
+ (AbstractParallelRebaselineCommand._run_webkit_patch):
+ (AbstractParallelRebaselineCommand._rebaseline):
+ * Scripts/webkitpy/tool/servers/gardeningserver.py:
+ (GardeningHTTPRequestHandler.rebaselineall):
+ * Scripts/webkitpy/tool/servers/gardeningserver_unittest.py:
+ (GardeningServerTest.disabled_test_rebaselineall.run_command):
+ (GardeningServerTest):
+
2017-12-08 Basuke Suzuki <[email protected]>
[Win] The way to detect Windows 10 is wrong
Modified: trunk/Tools/CygwinDownloader/cygwin-downloader.py (225723 => 225724)
--- trunk/Tools/CygwinDownloader/cygwin-downloader.py 2017-12-09 10:41:32 UTC (rev 225723)
+++ trunk/Tools/CygwinDownloader/cygwin-downloader.py 2017-12-09 16:58:36 UTC (rev 225724)
@@ -1,5 +1,6 @@
#!/usr/bin/env python
+from __future__ import print_function
import os, random, sys, time, urllib
#
@@ -21,7 +22,7 @@
def download_url_to_file(url, file, message):
if not quiet:
- print message + " ",
+ print(message + " ", end=' ')
if not dry_run:
dir = os.path.dirname(file)
if len(dir) and not os.path.exists(dir):
@@ -28,7 +29,7 @@
os.makedirs(dir)
urllib.urlretrieve(url, file, download_progress_hook)
if not quiet:
- print
+ print()
# This is mostly just the list of North America http mirrors from http://cygwin.com/mirrors.html,
# but a few have been removed that seemed unresponsive from Cupertino.
@@ -79,7 +80,7 @@
# Main
#
-print "Using Cygwin mirror server " + package_mirror_url + " to download setup.ini..."
+print("Using Cygwin mirror server " + package_mirror_url + " to download setup.ini...")
urllib.urlretrieve(package_mirror_url + "x86/setup.ini", "setup.ini.orig")
@@ -150,19 +151,19 @@
seconds_to_sleep = 10
-print """
+print("""
Finished downloading Cygwin. In %d seconds,
I will run setup.exe. All the suitable options have
been already selected for you.
-""" % (seconds_to_sleep)
+""" % (seconds_to_sleep))
while seconds_to_sleep > 0:
- print "%d..." % seconds_to_sleep,
+ print("%d..." % seconds_to_sleep, end=' ')
sys.stdout.flush()
time.sleep(1)
seconds_to_sleep -= 1
-print
+print()
if not dry_run:
os.execv("setup.exe", list(("-L", "-l", os.getcwd(), "-P", ",".join(required_packages))))
Modified: trunk/Tools/Scripts/webkitpy/common/system/profiler.py (225723 => 225724)
--- trunk/Tools/Scripts/webkitpy/common/system/profiler.py 2017-12-09 10:41:32 UTC (rev 225723)
+++ trunk/Tools/Scripts/webkitpy/common/system/profiler.py 2017-12-09 16:58:36 UTC (rev 225724)
@@ -26,6 +26,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import print_function
import logging
import re
import itertools
@@ -169,7 +170,7 @@
# Return early if the process produced non-zero exit code or is still running (if it couldn't be killed).
exit_code = self._wait_process.poll()
if exit_code is not 0:
- print "'perf record' failed, ",
+ print("'perf record' failed, ", end=' ')
if exit_code:
print("exit code was %i." % exit_code)
else:
Modified: trunk/Tools/Scripts/webkitpy/common/version_check.py (225723 => 225724)
--- trunk/Tools/Scripts/webkitpy/common/version_check.py 2017-12-09 10:41:32 UTC (rev 225723)
+++ trunk/Tools/Scripts/webkitpy/common/version_check.py 2017-12-09 16:58:36 UTC (rev 225724)
@@ -26,8 +26,9 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import print_function
import sys
if sys.version < '2.7' or sys.version >= '2.8':
- print >> sys.stderr, "Unsupported Python version: WebKit only supports 2.7.x, and you're running %s." % sys.version.split()[0]
+ print("Unsupported Python version: WebKit only supports 2.7.x, and you're running %s." % sys.version.split()[0], file=sys.stderr)
sys.exit(1)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations.py (225723 => 225724)
--- trunk/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations.py 2017-12-09 10:41:32 UTC (rev 225723)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations.py 2017-12-09 16:58:36 UTC (rev 225724)
@@ -26,6 +26,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import print_function
import logging
import optparse
import signal
@@ -105,7 +106,7 @@
except KeyboardInterrupt:
exit_status = INTERRUPTED_EXIT_STATUS
except Exception as e:
- print >> stderr, '\n%s raised: %s' % (e.__class__.__name__, str(e))
+ print('\n%s raised: %s' % (e.__class__.__name__, str(e)), file=stderr)
traceback.print_exc(file=stderr)
exit_status = EXCEPTIONAL_EXIT_STATUS
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py (225723 => 225724)
--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py 2017-12-09 10:41:32 UTC (rev 225723)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py 2017-12-09 16:58:36 UTC (rev 225724)
@@ -28,6 +28,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import print_function
import logging
import optparse
import os
@@ -70,7 +71,7 @@
port = host.port_factory.get(options.platform, options)
except NotImplementedError, e:
# FIXME: is this the best way to handle unsupported port names?
- print >> stderr, str(e)
+ print(str(e), file=stderr)
return EXCEPTIONAL_EXIT_STATUS
if options.print_expectations:
@@ -92,7 +93,7 @@
return INTERRUPTED_EXIT_STATUS
except BaseException as e:
if isinstance(e, Exception):
- print >> stderr, '\n%s raised: %s' % (e.__class__.__name__, str(e))
+ print('\n%s raised: %s' % (e.__class__.__name__, str(e)), file=stderr)
traceback.print_exc(file=stderr)
return EXCEPTIONAL_EXIT_STATUS
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py (225723 => 225724)
--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py 2017-12-09 10:41:32 UTC (rev 225723)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py 2017-12-09 16:58:36 UTC (rev 225724)
@@ -28,6 +28,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import print_function
import optparse
import subprocess
import sys
@@ -64,7 +65,7 @@
try:
port = host.port_factory.get(options.platform, options)
except NotImplementedError, e:
- print >> stderr, str(e)
+ print(str(e), file=stderr)
return EXCEPTIONAL_EXIT_STATUS
if options.web_platform_test_server:
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/analyzechangelog.py (225723 => 225724)
--- trunk/Tools/Scripts/webkitpy/tool/commands/analyzechangelog.py 2017-12-09 10:41:32 UTC (rev 225723)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/analyzechangelog.py 2017-12-09 16:58:36 UTC (rev 225724)
@@ -26,6 +26,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import print_function
import json
import re
import time
@@ -125,9 +126,9 @@
def _print_status(self, status):
if self._length_of_previous_output:
- print "\r" + " " * self._length_of_previous_output,
+ print("\r" + " " * self._length_of_previous_output, end=' ')
new_output = ('%' + str(self._longest_filename) + 's: %s') % (self._filename, status)
- print "\r" + new_output,
+ print("\r" + new_output, end=' ')
self._length_of_previous_output = len(new_output)
def _set_filename(self, filename):
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queries.py (225723 => 225724)
--- trunk/Tools/Scripts/webkitpy/tool/commands/queries.py 2017-12-09 10:41:32 UTC (rev 225723)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queries.py 2017-12-09 16:58:36 UTC (rev 225724)
@@ -29,6 +29,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import print_function
import fnmatch
import logging
import re
@@ -74,7 +75,7 @@
# FIXME: This command is poorly named. It's fetching the commit-queue list here. The name implies it's fetching pending-commit (all r+'d patches).
bug_ids = tool.bugs.queries.fetch_bug_ids_from_commit_queue()
for bug_id in bug_ids:
- print "%s" % bug_id
+ print("%s" % bug_id)
class PatchesInCommitQueue(Command):
@@ -85,7 +86,7 @@
patches = tool.bugs.queries.fetch_patches_from_commit_queue()
_log.info("Patches in commit queue:")
for patch in patches:
- print patch.url()
+ print(patch.url())
class PatchesToCommitQueue(Command):
@@ -117,10 +118,10 @@
bugs_needing_cq = map(lambda patch: patch.bug_id(), patches_needing_cq)
bugs_needing_cq = sorted(set(bugs_needing_cq))
for bug_id in bugs_needing_cq:
- print "%s" % tool.bugs.bug_url_for_bug_id(bug_id)
+ print("%s" % tool.bugs.bug_url_for_bug_id(bug_id))
else:
for patch in patches_needing_cq:
- print "%s" % tool.bugs.attachment_url_for_id(patch.id(), action=""
+ print("%s" % tool.bugs.attachment_url_for_id(patch.id(), action=""
class PatchesToReview(Command):
@@ -140,15 +141,15 @@
def _print_report(self, report, cc_email, print_all):
if print_all:
- print "Bugs with attachments pending review:"
+ print("Bugs with attachments pending review:")
else:
- print "Bugs with attachments pending review that has %s in the CC list:" % cc_email
+ print("Bugs with attachments pending review that has %s in the CC list:" % cc_email)
- print "http://webkit.org/b/bugid Description (age in days)"
+ print("http://webkit.org/b/bugid Description (age in days)")
for row in report:
- print "%s (%d)" % (row[1], row[0])
+ print("%s (%d)" % (row[1], row[0]))
- print "Total: %d" % len(report)
+ print("Total: %d" % len(report))
def _generate_report(self, bugs, include_cq_denied):
report = []
@@ -182,7 +183,7 @@
help_text = "Print failing buildbots (%s) and what revisions broke them" % config_urls.buildbot_url
def _print_builder_line(self, builder_name, max_name_width, status_message):
- print "%s : %s" % (builder_name.ljust(max_name_width), status_message)
+ print("%s : %s" % (builder_name.ljust(max_name_width), status_message))
def _print_blame_information_for_builder(self, builder_status, name_width, avoid_flakey_tests=True):
builder = self._tool.buildbot.builder_with_name(builder_status["name"])
@@ -203,9 +204,9 @@
for revision in revisions:
commit_info = self._tool.checkout().commit_info_for_revision(revision)
if commit_info:
- print commit_info.blame_string(self._tool.bugs)
+ print(commit_info.blame_string(self._tool.bugs))
else:
- print "FAILED to fetch CommitInfo for r%s, likely missing ChangeLog" % revision
+ print("FAILED to fetch CommitInfo for r%s, likely missing ChangeLog" % revision)
def execute(self, options, args, tool):
builder_statuses = tool.buildbot.builder_statuses()
@@ -218,9 +219,9 @@
self._print_blame_information_for_builder(builder_status, name_width=longest_builder_name)
failing_builders += 1
if failing_builders:
- print "%s of %s are failing" % (failing_builders, pluralize(len(builder_statuses), "builder"))
+ print("%s of %s are failing" % (failing_builders, pluralize(len(builder_statuses), "builder")))
else:
- print "All builders are passing!"
+ print("All builders are passing!")
class ResultsFor(Command):
@@ -230,17 +231,17 @@
def _print_layout_test_results(self, results):
if not results:
- print " No results."
+ print(" No results.")
return
for title, files in results.parsed_results().items():
- print " %s" % title
+ print(" %s" % title)
for filename in files:
- print " %s" % filename
+ print(" %s" % filename)
def execute(self, options, args, tool):
builders = self._tool.buildbot.builders()
for builder in builders:
- print "%s:" % builder.name()
+ print("%s:" % builder.name())
build = builder.build_for_revision(args[0], allow_failed_lookups=True)
self._print_layout_test_results(build.layout_test_results())
@@ -261,44 +262,44 @@
def _print_blame_information_for_transition(self, regression_window, failing_tests):
red_build = regression_window.failing_build()
- print "SUCCESS: Build %s (r%s) was the first to show failures: %s" % (red_build._number, red_build.revision(), failing_tests)
- print "Suspect revisions:"
+ print("SUCCESS: Build %s (r%s) was the first to show failures: %s" % (red_build._number, red_build.revision(), failing_tests))
+ print("Suspect revisions:")
for revision in regression_window.revisions():
- print self._blame_line_for_revision(revision)
+ print(self._blame_line_for_revision(revision))
def _explain_failures_for_builder(self, builder, start_revision):
- print "Examining failures for \"%s\", starting at r%s" % (builder.name(), start_revision)
+ print("Examining failures for \"%s\", starting at r%s" % (builder.name(), start_revision))
revision_to_test = start_revision
build = builder.build_for_revision(revision_to_test, allow_failed_lookups=True)
layout_test_results = build.layout_test_results()
if not layout_test_results:
# FIXME: This could be made more user friendly.
- print "Failed to load layout test results from %s; can't continue. (start revision = r%s)" % (build.results_url(), start_revision)
+ print("Failed to load layout test results from %s; can't continue. (start revision = r%s)" % (build.results_url(), start_revision))
return 1
results_to_explain = set(layout_test_results.failing_tests())
last_build_with_results = build
- print "Starting at %s" % revision_to_test
+ print("Starting at %s" % revision_to_test)
while results_to_explain and not self._done_explaining():
revision_to_test -= 1
new_build = builder.build_for_revision(revision_to_test, allow_failed_lookups=True)
if not new_build:
- print "No build for %s" % revision_to_test
+ print("No build for %s" % revision_to_test)
continue
build = new_build
latest_results = build.layout_test_results()
if not latest_results:
- print "No results build %s (r%s)" % (build._number, build.revision())
+ print("No results build %s (r%s)" % (build._number, build.revision()))
continue
failures = set(latest_results.failing_tests())
if len(failures) >= 500:
# FIXME: We may need to move this logic into the LayoutTestResults class.
# The buildbot stops runs after 500 failures so we don't have full results to work with here.
- print "Too many failures in build %s (r%s), ignoring." % (build._number, build.revision())
+ print("Too many failures in build %s (r%s), ignoring." % (build._number, build.revision()))
continue
fixed_results = results_to_explain - failures
if not fixed_results:
- print "No change in build %s (r%s), %s unexplained failures (%s in this build)" % (build._number, build.revision(), len(results_to_explain), len(failures))
+ print("No change in build %s (r%s), %s unexplained failures (%s in this build)" % (build._number, build.revision(), len(results_to_explain), len(failures)))
last_build_with_results = build
continue
self.explained_failures.update(fixed_results)
@@ -307,15 +308,15 @@
last_build_with_results = build
results_to_explain -= fixed_results
if results_to_explain:
- print "Failed to explain failures: %s" % results_to_explain
+ print("Failed to explain failures: %s" % results_to_explain)
return 1
- print "Explained all results for %s" % builder.name()
+ print("Explained all results for %s" % builder.name())
return 0
def _builder_to_explain(self):
builder_statuses = self._tool.buildbot.builder_statuses()
red_statuses = [status for status in builder_statuses if not status["is_green"]]
- print "%s failing" % (pluralize(len(red_statuses), "builder"))
+ print("%s failing" % (pluralize(len(red_statuses), "builder")))
builder_choices = [status["name"] for status in red_statuses]
# We could offer an "All" choice here.
chosen_name = self._tool.user.prompt_with_list("Which builder to diagnose:", builder_choices)
@@ -336,7 +337,7 @@
self.failures_to_explain = args
self.explained_failures = set()
if not start_revision:
- print "Revision required."
+ print("Revision required.")
return 1
return self._explain_failures_for_builder(builder, start_revision=int(start_revision))
@@ -348,17 +349,17 @@
def _find_failures(self, builder, revision):
build = builder.build_for_revision(revision, allow_failed_lookups=True)
if not build:
- print "No build for %s" % revision
+ print("No build for %s" % revision)
return (None, None)
results = build.layout_test_results()
if not results:
- print "No results build %s (r%s)" % (build._number, build.revision())
+ print("No results build %s (r%s)" % (build._number, build.revision()))
return (None, None)
failures = set(results.failing_tests())
if len(failures) >= 20:
# FIXME: We may need to move this logic into the LayoutTestResults class.
# The buildbot stops runs after 20 failures so we don't have full results to work with here.
- print "Too many failures in build %s (r%s), ignoring." % (build._number, build.revision())
+ print("Too many failures in build %s (r%s), ignoring." % (build._number, build.revision()))
return (None, None)
return (build, failures)
@@ -368,10 +369,10 @@
flaky_test_statistics[test] = count + 1
def _print_statistics(self, statistics):
- print "=== Results ==="
- print "Occurrences Test name"
+ print("=== Results ===")
+ print("Occurrences Test name")
for value, key in sorted([(value, key) for key, value in statistics.items()]):
- print "%10d %s" % (value, key)
+ print("%10d %s" % (value, key))
def _walk_backwards_from(self, builder, start_revision, limit):
flaky_test_statistics = {}
@@ -380,16 +381,16 @@
previous_build = None
for i in range(limit):
revision = start_revision - i
- print "Analyzing %s ... " % revision,
+ print("Analyzing %s ... " % revision, end=' ')
(build, failures) = self._find_failures(builder, revision)
if failures == None:
# Notice that we don't loop on the empty set!
continue
- print "has %s failures" % len(failures)
+ print("has %s failures" % len(failures))
flaky_tests = one_time_previous_failures - failures
if flaky_tests:
- print "Flaky tests: %s %s" % (sorted(flaky_tests),
- previous_build.results_url())
+ print("Flaky tests: %s %s" % (sorted(flaky_tests),
+ previous_build.results_url()))
self._increment_statistics(flaky_tests, flaky_test_statistics)
_one_time_previous_failures_ = failures - all_previous_failures
all_previous_failures = failures
@@ -419,7 +420,7 @@
def execute(self, options, args, tool):
for builder in tool.buildbot.builder_statuses():
status_string = "ok" if builder["is_green"] else "FAIL"
- print "%s : %s" % (status_string.ljust(4), builder["name"])
+ print("%s : %s" % (status_string.ljust(4), builder["name"]))
class CrashLog(Command):
@@ -435,7 +436,7 @@
pid = None
if len(args) > 1:
pid = int(args[1])
- print crash_logs.find_newest_log(args[0], pid)
+ print(crash_logs.find_newest_log(args[0], pid))
class PrintExpectations(Command):
@@ -463,7 +464,7 @@
def execute(self, options, args, tool):
if not options.paths and not args and not options.all:
- print "You must either specify one or more test paths or --all."
+ print("You must either specify one or more test paths or --all.")
return
if options.platform:
@@ -473,7 +474,7 @@
if default_port:
port_names = [default_port.name()]
else:
- print "No port names match '%s'" % options.platform
+ print("No port names match '%s'" % options.platform)
return
else:
default_port = tool.port_factory.get(port_names[0])
@@ -487,7 +488,7 @@
for file in files:
if file.startswith(layout_tests_dir):
file = file.replace(layout_tests_dir, 'LayoutTests')
- print file
+ print(file)
return
tests = set(default_port.tests(args))
@@ -496,8 +497,8 @@
tests_to_print = self._filter_tests(options, model, tests)
lines = [model.get_expectation_line(test) for test in sorted(tests_to_print)]
if port_name != port_names[0]:
- print
- print '\n'.join(self._format_lines(options, port_name, lines))
+ print()
+ print('\n'.join(self._format_lines(options, port_name, lines)))
def _filter_tests(self, options, model, tests):
filtered_tests = set()
@@ -547,7 +548,7 @@
def execute(self, options, args, tool):
if not args and not options.all:
- print "You must either specify one or more test paths or --all."
+ print("You must either specify one or more test paths or --all.")
return
default_port = tool.port_factory.get()
@@ -554,7 +555,7 @@
if options.platform:
port_names = fnmatch.filter(tool.port_factory.all_port_names(), options.platform)
if not port_names:
- print "No port names match '%s'" % options.platform
+ print("No port names match '%s'" % options.platform)
else:
port_names = [default_port.name()]
@@ -563,9 +564,9 @@
for port_name in port_names:
if port_name != port_names[0]:
- print
+ print()
if not options.csv:
- print "// For %s" % port_name
+ print("// For %s" % port_name)
port = tool.port_factory.get(port_name)
for test_name in tests:
self._print_baselines(options, port_name, test_name, port.expected_baselines_by_extension(test_name))
@@ -575,10 +576,10 @@
baseline_location = baselines[extension]
if baseline_location:
if options.csv:
- print "%s,%s,%s,%s,%s,%s" % (port_name, test_name, self._platform_for_path(test_name),
- extension[1:], baseline_location, self._platform_for_path(baseline_location))
+ print("%s,%s,%s,%s,%s,%s" % (port_name, test_name, self._platform_for_path(test_name),
+ extension[1:], baseline_location, self._platform_for_path(baseline_location)))
else:
- print baseline_location
+ print(baseline_location)
def _platform_for_path(self, relpath):
platform_matchobj = self._platform_regexp.match(relpath)
@@ -595,7 +596,7 @@
def execute(self, options, args, tool):
filename = args[0]
if not tool.filesystem.isfile(filename):
- print "The given path is not a file, please pass a valid path."
+ print("The given path is not a file, please pass a valid path.")
return
ids = set()
@@ -611,10 +612,10 @@
bugzilla = Bugzilla()
for i, bugid in enumerate(ids, start=1):
bug = bugzilla.fetch_bug(bugid)
- print "Checking bug %s \t [%d/%d]" % (bugid, i, num_of_bugs)
+ print("Checking bug %s \t [%d/%d]" % (bugid, i, num_of_bugs))
if not bug.is_open():
resolved_ids.add(bugid)
- print "Resolved bugs in %s :" % (filename)
+ print("Resolved bugs in %s :" % (filename))
for bugid in resolved_ids:
- print "https://bugs.webkit.org/show_bug.cgi?id=%s" % (bugid)
+ print("https://bugs.webkit.org/show_bug.cgi?id=%s" % (bugid))
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py (225723 => 225724)
--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py 2017-12-09 10:41:32 UTC (rev 225723)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py 2017-12-09 16:58:36 UTC (rev 225724)
@@ -26,6 +26,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import print_function
import json
import logging
import optparse
@@ -205,7 +206,7 @@
verbose_args = ['--verbose'] if verbose else []
stderr = self._tool.executive.run_command([self._tool.path()] + verbose_args + args, cwd=self._tool.scm().checkout_root, return_stderr=True)
for line in stderr.splitlines():
- print >> sys.stderr, line
+ print(line, file=sys.stderr)
except ScriptError, e:
_log.error(e)
@@ -279,7 +280,7 @@
log_output = '\n'.join(result[2] for result in command_results).replace('\n\n', '\n')
for line in log_output.split('\n'):
if line:
- print >> sys.stderr, line # FIXME: Figure out how to log properly.
+ print(line, file=sys.stderr) # FIXME: Figure out how to log properly.
files_to_add = self._files_to_add(command_results)
if files_to_add:
Modified: trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py (225723 => 225724)
--- trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py 2017-12-09 10:41:32 UTC (rev 225723)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py 2017-12-09 16:58:36 UTC (rev 225724)
@@ -22,6 +22,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import print_function
import BaseHTTPServer
import SocketServer
import logging
@@ -94,7 +95,7 @@
_log.debug("calling %s, input='%s'", command, json_input)
return_code, output, error = self._run_webkit_patch(command, json_input)
- print >> sys.stderr, error
+ print(error, file=sys.stderr)
if return_code:
_log.error("rebaseline-json failed: %d, output='%s'" % (return_code, output))
else:
Modified: trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py (225723 => 225724)
--- trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py 2017-12-09 10:41:32 UTC (rev 225723)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py 2017-12-09 16:58:36 UTC (rev 225724)
@@ -26,6 +26,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import print_function
import json
import sys
import unittest
@@ -103,7 +104,7 @@
self.output = ['{"add": [], "delete": []}', '']
def run_command(args, cwd=None, input=None, **kwargs):
- print >> sys.stderr, "MOCK run_command: %s, cwd=%s, input=%s" % (args, cwd, input)
+ print("MOCK run_command: %s, cwd=%s, input=%s" % (args, cwd, input), file=sys.stderr)
return self.output.pop(0)
server.tool.executive.run_command = run_command