[python] Replace print operator with print() function for python3 compatibility
authorannulen@yandex.ru <annulen@yandex.ru@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Dec 2017 21:56:09 +0000 (21:56 +0000)
committerannulen@yandex.ru <annulen@yandex.ru@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Dec 2017 21:56:09 +0000 (21:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180592

Reviewed by Michael Catanzaro.

PerformanceTests:

* JSBench/harness.py:

Source/JavaScriptCore:

* Scripts/generateYarrUnicodePropertyTables.py:
(openOrExit):
(verifyUCDFilesExist):
(Aliases.parsePropertyAliasesFile):
(Aliases.parsePropertyValueAliasesFile):
* Scripts/make-js-file-arrays.py:
(main):
* generate-bytecode-files:

Source/WebCore/PAL:

* AVFoundationSupport.py:

Tools:

* BuildSlaveSupport/wait-for-SVN-server.py:
(getLatestSVNRevision):
(waitForSVNRevision):
* Scripts/download-latest-github-release.py:
(find_latest_release):
(main):
* Scripts/update-wasm-gcc-torture.py:
(update_lkgr):
(untar_torture):
(list_js_files):
(waterfall_known_failures):
* Scripts/update-webkit-wincairo-libs.py:
* Scripts/webkitpy/benchmark_runner/benchmark_runner.py:
(BenchmarkRunner.show_results):
* Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py:
(SimpleHTTPServerDriver.fetch_result):
* Scripts/webkitpy/benchmark_runner/run_benchmark.py:
(list_benchmark_plans):
* Scripts/webkitpy/bindings/main.py:
(BindingsTests.generate_from_idl):
(BindingsTests.generate_supplemental_dependency):
(BindingsTests.detect_changes):
(BindingsTests.run_tests):
(BindingsTests.main):
* Scripts/webkitpy/codegen/main.py:
(BuiltinsGeneratorTests.generate_from_js_builtins):
(BuiltinsGeneratorTests.detect_changes):
(BuiltinsGeneratorTests.single_builtin_test):
(BuiltinsGeneratorTests.run_test):
(BuiltinsGeneratorTests.run_tests):
(BuiltinsGeneratorTests.main):
* Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py:
(MockBugzilla.fetch_attachment):
* Scripts/webkitpy/common/net/buildbot/buildbot.py:
(Builder._fetch_revision_to_build_map):
* Scripts/webkitpy/common/system/crashlogs.py:
(CrashLogs._find_newest_log_win):
* Scripts/webkitpy/common/system/outputcapture_unittest.py:
(OutputCaptureTest.test_output_capture_scope):
* Scripts/webkitpy/common/system/profiler.py:
(GooglePProf.profile_after_exit):
(Perf.profile_after_exit):
* Scripts/webkitpy/common/system/user.py:
(User.prompt_with_multiple_lists):
(User.prompt_with_list):
(User._warn_if_application_is_xcode):
(User.edit_changelog):
* Scripts/webkitpy/inspector/main.py:
(InspectorGeneratorTests.generate_from_json):
(InspectorGeneratorTests.detect_changes):
(InspectorGeneratorTests.run_tests):
(InspectorGeneratorTests.main):
* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager._print_expectation_line_for_test):
(Manager._print_expectations_for_subset):
(Manager._print_expectations_for_subset.if):
* Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py:
(run_server):
* Scripts/webkitpy/port/config_standalone.py:
(main):
* Scripts/webkitpy/port/darwin_testcase.py:
(DarwinTest.test_spindump.logging_run_command):
(DarwinTest.test_sample_process.logging_run_command):
* Scripts/webkitpy/port/ios.py:
(IOSPort.clean_up_test_run):
* Scripts/webkitpy/port/ios_device_unittest.py:
(IOSDeviceTest.test_spindump.logging_run_command):
(IOSDeviceTest.test_sample_process.logging_run_command):
* Scripts/webkitpy/port/ios_simulator_unittest.py:
(IOSSimulatorTest.test_xcrun.throwing_run_command):
* Scripts/webkitpy/port/leakdetector_unittest.py:
(test_count_total_bytes_and_unique_leaks.mock_run_script):
* Scripts/webkitpy/port/mac_unittest.py:
(MacTest.test_xcrun.throwing_run_command):
* Scripts/webkitpy/style/checkers/contributors.py:
(ContributorsChecker.check):
* Scripts/webkitpy/tool/commands/abstractlocalservercommand.py:
(AbstractLocalServerCommand.execute):
* Scripts/webkitpy/tool/commands/adduserstogroups.py:
(AddUsersToGroups.execute):
* Scripts/webkitpy/tool/commands/analyzechangelog.py:
(AnalyzeChangeLog._generate_jsons):
(AnalyzeChangeLog.execute):
(ChangeLogAnalyzer._set_filename):
(ChangeLogAnalyzer.analyze):
* Scripts/webkitpy/tool/commands/bugfortest.py:
(BugForTest.execute):
* Scripts/webkitpy/tool/commands/bugsearch.py:
(execute):
* Scripts/webkitpy/tool/commands/findusers.py:
(FindUsers.execute):
* Scripts/webkitpy/tool/commands/gardenomatic.py:
(GardenOMatic.execute):
* Scripts/webkitpy/tool/commands/rebaseline.py:
(RebaselineTest.execute):
* Scripts/webkitpy/tool/commands/rebaselineserver.py:
(RebaselineServer._prepare_config):
* Scripts/webkitpy/tool/commands/setupgitclone.py:
(SetupGitClone.execute):
(SetupGitClone._get_username_and_email):
* Scripts/webkitpy/tool/commands/suggestnominations.py:
(SuggestNominations._print_nominations):
(SuggestNominations._print_counts):
* Scripts/webkitpy/tool/commands/upload.py:
(CommitMessageForCurrentDiff.execute):
(CreateBug.prompt_for_bug_title_and_comment):
* Scripts/webkitpy/tool/multicommandtool.py:
(HelpCommand.execute):
* Scripts/webkitpy/tool/servers/gardeningserver_unittest.py:
(TestGardeningHTTPRequestHandler._serve_text):
(TestGardeningHTTPRequestHandler._serve_json):
* Scripts/webkitpy/tool/steps/addsvnmimetypeforpng.py:
(AddSvnMimetypeForPng.run):
* Scripts/webkitpy/tool/steps/suggestreviewers.py:
(SuggestReviewers.run):
* Scripts/webkitpy/w3c/test_importer.py:
(TestImporter.update_tests_options):
* Scripts/webkitpy/webdriver_tests/webdriver_test_runner_selenium.py:
(WebDriverTestRunnerSelenium.run):
* TestResultServer/model/jsonresults_unittest.py:
* gtk/ycm_extra_conf.py:
(FlagsForFile):
* lldb/lldb_webkit.py:
(btjs):

LayoutTests:

* html5lib/generate-test-wrappers.py:
(_remove_stale_tests):
* http/tests/websocket/tests/hybi/bad-handshake-crash_wsh.py:
(web_socket_do_extra_handshake):
* http/tests/websocket/tests/hybi/handshake-fail-by-more-accept-header_wsh.py:
(web_socket_do_extra_handshake):
* http/tests/websocket/tests/hybi/handshake-fail-by-no-connection-header_wsh.py:
(web_socket_do_extra_handshake):
* http/tests/websocket/tests/hybi/handshake-fail-by-no-cr_wsh.py:
(web_socket_do_extra_handshake):
* http/tests/websocket/tests/hybi/handshake-fail-by-no-upgrade-header_wsh.py:
(web_socket_do_extra_handshake):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225698 268f45cc-cd09-0410-ab3c-d52691b4dbfc

63 files changed:
LayoutTests/ChangeLog
LayoutTests/html5lib/generate-test-wrappers.py
LayoutTests/http/tests/websocket/tests/hybi/bad-handshake-crash_wsh.py
LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-more-accept-header_wsh.py
LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-connection-header_wsh.py
LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-cr_wsh.py
LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-upgrade-header_wsh.py
PerformanceTests/ChangeLog
PerformanceTests/JSBench/harness.py
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Scripts/generateYarrUnicodePropertyTables.py
Source/JavaScriptCore/Scripts/make-js-file-arrays.py
Source/JavaScriptCore/generate-bytecode-files
Source/WebCore/PAL/AVFoundationSupport.py
Source/WebCore/PAL/ChangeLog
Tools/BuildSlaveSupport/wait-for-SVN-server.py
Tools/ChangeLog
Tools/Scripts/download-latest-github-release.py
Tools/Scripts/update-wasm-gcc-torture.py
Tools/Scripts/update-webkit-wincairo-libs.py
Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py
Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py
Tools/Scripts/webkitpy/benchmark_runner/run_benchmark.py
Tools/Scripts/webkitpy/bindings/main.py
Tools/Scripts/webkitpy/codegen/main.py
Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py
Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py
Tools/Scripts/webkitpy/common/system/crashlogs.py
Tools/Scripts/webkitpy/common/system/outputcapture_unittest.py
Tools/Scripts/webkitpy/common/system/profiler.py
Tools/Scripts/webkitpy/common/system/user.py
Tools/Scripts/webkitpy/inspector/main.py
Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
Tools/Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py
Tools/Scripts/webkitpy/port/config_standalone.py
Tools/Scripts/webkitpy/port/darwin_testcase.py
Tools/Scripts/webkitpy/port/ios.py
Tools/Scripts/webkitpy/port/ios_device_unittest.py
Tools/Scripts/webkitpy/port/ios_simulator_unittest.py
Tools/Scripts/webkitpy/port/leakdetector_unittest.py
Tools/Scripts/webkitpy/port/mac_unittest.py
Tools/Scripts/webkitpy/style/checkers/contributors.py
Tools/Scripts/webkitpy/tool/commands/abstractlocalservercommand.py
Tools/Scripts/webkitpy/tool/commands/adduserstogroups.py
Tools/Scripts/webkitpy/tool/commands/analyzechangelog.py
Tools/Scripts/webkitpy/tool/commands/bugfortest.py
Tools/Scripts/webkitpy/tool/commands/bugsearch.py
Tools/Scripts/webkitpy/tool/commands/findusers.py
Tools/Scripts/webkitpy/tool/commands/gardenomatic.py
Tools/Scripts/webkitpy/tool/commands/rebaseline.py
Tools/Scripts/webkitpy/tool/commands/rebaselineserver.py
Tools/Scripts/webkitpy/tool/commands/setupgitclone.py
Tools/Scripts/webkitpy/tool/commands/suggestnominations.py
Tools/Scripts/webkitpy/tool/commands/upload.py
Tools/Scripts/webkitpy/tool/multicommandtool.py
Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py
Tools/Scripts/webkitpy/tool/steps/addsvnmimetypeforpng.py
Tools/Scripts/webkitpy/tool/steps/suggestreviewers.py
Tools/Scripts/webkitpy/w3c/test_importer.py
Tools/Scripts/webkitpy/webdriver_tests/webdriver_test_runner_selenium.py
Tools/TestResultServer/model/jsonresults_unittest.py
Tools/gtk/ycm_extra_conf.py
Tools/lldb/lldb_webkit.py

index 0bcdc05..3d09714 100644 (file)
@@ -1,3 +1,23 @@
+2017-12-08  Konstantin Tokarev  <annulen@yandex.ru>
+
+        [python] Replace print operator with print() function for python3 compatibility
+        https://bugs.webkit.org/show_bug.cgi?id=180592
+
+        Reviewed by Michael Catanzaro.
+
+        * html5lib/generate-test-wrappers.py:
+        (_remove_stale_tests):
+        * http/tests/websocket/tests/hybi/bad-handshake-crash_wsh.py:
+        (web_socket_do_extra_handshake):
+        * http/tests/websocket/tests/hybi/handshake-fail-by-more-accept-header_wsh.py:
+        (web_socket_do_extra_handshake):
+        * http/tests/websocket/tests/hybi/handshake-fail-by-no-connection-header_wsh.py:
+        (web_socket_do_extra_handshake):
+        * http/tests/websocket/tests/hybi/handshake-fail-by-no-cr_wsh.py:
+        (web_socket_do_extra_handshake):
+        * http/tests/websocket/tests/hybi/handshake-fail-by-no-upgrade-header_wsh.py:
+        (web_socket_do_extra_handshake):
+
 2017-12-08  Ms2ger  <Ms2ger@igalia.com>
 
         [GTK] Rebaseline tables/mozilla/bugs/bug32205-5.html.
index 3bde237..7ae0a18 100755 (executable)
@@ -75,14 +75,14 @@ var test_files = [ '%(test_path)s' ]
             name = self._last_path_component_removing_suffix(path, self.HARNESS_SUFFIX)
             name = self._test_name_from_harness_name(name)
             if name not in test_names:
-                print "Removing %s, %s no longer exists." % (path, self._input_path(name))
+                print("Removing %s, %s no longer exists." % (path, self._input_path(name)))
                 os.remove(path)
 
         for path in self._files_in_directory_with_suffix(self.OUTPUT_DIRECTORY, self.EXPECTAION_SUFFIX):
             name = self._last_path_component_removing_suffix(path, self.EXPECTAION_SUFFIX)
             name = self._test_name_from_harness_name(name)
             if name not in test_names:
-                print "Removing %s, %s no longer exists." % (path, self._input_path(name))
+                print("Removing %s, %s no longer exists." % (path, self._input_path(name)))
                 os.remove(path)
 
     def _input_path(self, test_name):
index f3a2feb..6ff1228 100644 (file)
@@ -10,7 +10,7 @@ def web_socket_do_extra_handshake(request):
     msg += "\xa5:\r\n"
     msg += "\r\n"
     request.connection.write(msg)
-    print msg
+    print(msg)
     raise handshake.AbortedByUserException("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
 
 
index 684459b..26cd080 100644 (file)
@@ -10,7 +10,7 @@ def web_socket_do_extra_handshake(request):
     msg += 'Sec-WebSocket-Accept: XXXXthisiswrongXXXX\r\n' 
     msg += '\r\n'
     request.connection.write(msg)
-    print msg
+    print(msg)
     raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
 
 
index 1b022f5..e54429a 100644 (file)
@@ -9,7 +9,7 @@ def web_socket_do_extra_handshake(request):
     msg += 'Sec-WebSocket-Accept: %s\r\n' % compute_accept(request.headers_in['Sec-WebSocket-Key'])[0]
     msg += '\r\n'
     request.connection.write(msg)
-    print msg
+    print(msg)
     raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
 
 
index 6cb34c2..73f990b 100644 (file)
@@ -9,7 +9,7 @@ def web_socket_do_extra_handshake(request):
     msg += 'Sec-WebSocket-Accept: %s\r\n' % compute_accept(request.headers_in['Sec-WebSocket-Key'])[0]
     msg += '\r\n'
     request.connection.write(msg)
-    print msg
+    print(msg)
     raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
 
 
index 97ce128..01abf76 100644 (file)
@@ -9,7 +9,7 @@ def web_socket_do_extra_handshake(request):
     msg += 'Sec-WebSocket-Accept: %s\r\n' % compute_accept(request.headers_in['Sec-WebSocket-Key'])[0]
     msg += '\r\n'
     request.connection.write(msg)
-    print msg
+    print(msg)
     raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
 
 
index cd99ff4..2a19511 100644 (file)
@@ -1,3 +1,12 @@
+2017-12-08  Konstantin Tokarev  <annulen@yandex.ru>
+
+        [python] Replace print operator with print() function for python3 compatibility
+        https://bugs.webkit.org/show_bug.cgi?id=180592
+
+        Reviewed by Michael Catanzaro.
+
+        * JSBench/harness.py:
+
 2017-12-01  Filip Pizlo  <fpizlo@apple.com>
 
         GC constraint solving should be parallel
index a1b594a..fd30cc8 100644 (file)
@@ -45,7 +45,7 @@ keepruns = 20
 keepfrom = runcount - keepruns
 
 if len(sys.argv) != 2:
-    print "Use: python harness.py <JS executable>"
+    print("Use: python harness.py <JS executable>")
     exit(1)
 js = sys.argv[1]
 
@@ -169,35 +169,35 @@ totals["sm"] *= 100
 totals["semm"] *= 100
 totals["cim"] *= 100
 
-print "Final results:"
-print u"  %(mean)fms \u00b1 %(cim)f%% (lower is better)" % totals
-print "  Standard deviation = %(sm)f%% of mean" % totals
-print "  Standard error = %(semm)f%% of mean" % totals
-print "  %(runs)d runs" % {"runs": runcount}
-print ""
+print("Final results:")
+print(u"  %(mean)fms \u00b1 %(cim)f%% (lower is better)" % totals)
+print("  Standard deviation = %(sm)f%% of mean" % totals)
+print("  Standard error = %(semm)f%% of mean" % totals)
+print("  %(runs)d runs" % {"runs": runcount})
+print("")
 
-print "Result breakdown:"
+print("Result breakdown:")
 for benchmark in benchmarks:
-    print "  %(benchmark)s:" % {"benchmark": benchmark}
+    print("  %(benchmark)s:" % {"benchmark": benchmark})
     
     bmodes = modes["*"]
     if benchmark in modes:
         bmodes = modes[benchmark]
 
     for mode in bmodes:
-        print u"  %(mode)s: %(mean)fms \u00b1 %(cim)f%% (stddev=%(sm)f%%, stderr=%(semm)f%%)" % sresults[benchmark][mode]
-print ""
+        print(u"  %(mode)s: %(mean)fms \u00b1 %(cim)f%% (stddev=%(sm)f%%, stderr=%(semm)f%%)" % sresults[benchmark][mode])
+print("")
 
-print "Raw results:"
+print("Raw results:")
 for benchmark in benchmarks:
-    print "  %(benchmark)s:" % {"benchmark": benchmark}
+    print("  %(benchmark)s:" % {"benchmark": benchmark})
 
     bmodes = modes["*"]
     if benchmark in modes:
         bmodes = modes[benchmark]
 
     for mode in bmodes:
-        print "    %(mode)s: %(results)s" % {
+        print("    %(mode)s: %(results)s" % {
             "mode": mode,
             "results": results[benchmark][mode]
-        }
+        })
index f53e456..baf7031 100644 (file)
@@ -1,3 +1,19 @@
+2017-12-08  Konstantin Tokarev  <annulen@yandex.ru>
+
+        [python] Replace print operator with print() function for python3 compatibility
+        https://bugs.webkit.org/show_bug.cgi?id=180592
+
+        Reviewed by Michael Catanzaro.
+
+        * Scripts/generateYarrUnicodePropertyTables.py:
+        (openOrExit):
+        (verifyUCDFilesExist):
+        (Aliases.parsePropertyAliasesFile):
+        (Aliases.parsePropertyValueAliasesFile):
+        * Scripts/make-js-file-arrays.py:
+        (main):
+        * generate-bytecode-files:
+
 2017-12-08  Mark Lam  <mark.lam@apple.com>
 
         Need to unpoison native function pointers for CLoop.
index e9da644..722878d 100644 (file)
@@ -92,7 +92,7 @@ def openOrExit(path, mode):
     try:
         return open(path, mode)
     except IOError as e:
-        print "I/O error opening {0}, ({1}): {2}".format(path, e.errno, e.strerror)
+        print("I/O error opening {0}, ({1}): {2}".format(path, e.errno, e.strerror))
         exit(1)
 
 
@@ -111,7 +111,7 @@ def verifyUCDFilesExist():
     for file in RequiredUCDFiles:
         fullPath = os.path.join(UCDDirectoryPath, file)
         if not os.path.exists(fullPath):
-            print "Couldn't find UCD file {0} at {1}".format(file, fullPath)
+            print("Couldn't find UCD file {0} at {1}".format(file, fullPath))
             missingFileCount = missingFileCount + 1
     if missingFileCount:
         exit(1)
@@ -150,7 +150,7 @@ class Aliases:
                 aliases.append(otherAlias.strip())
 
             if fullName in self.globalNameToAliases:
-                print "Error, already an alias for {}".format(fullName)
+                print("Error, already an alias for {}".format(fullName))
             else:
                 self.globalNameToAliases[fullName] = aliases
 
@@ -183,7 +183,7 @@ class Aliases:
                 aliases.append(otherAlias.strip())
 
             if fullName in mapToModify:
-                print "Error, already an {} alias for {}".format(propertyType, fullName)
+                print("Error, already an {} alias for {}".format(propertyType, fullName))
             else:
                 mapToModify[fullName] = aliases
                 if reverseMapToModify != None:
index 6505664..705ea1f 100755 (executable)
@@ -46,11 +46,11 @@ def main():
     parser.add_option('-n', '--namespace', help='Namespace to use')
     (options, arguments) = parser.parse_args()
     if not options.namespace:
-        print 'Error: must provide a namespace'
+        print('Error: must provide a namespace')
         parser.print_usage()
         exit(-1)
     if len(arguments) < 3:
-        print 'Error: must provide at least 3 arguments'
+        print('Error: must provide at least 3 arguments')
         parser.print_usage()
         exit(-1)
 
index 9c80776..e1128f8 100644 (file)
@@ -91,7 +91,7 @@ def openOrExit(path, mode):
     try:
         return open(path, mode)
     except IOError as e:
-        print "I/O error opening {0}, ({1}): {2}".format(path, e.errno, e.strerror)
+        print("I/O error opening {0}, ({1}): {2}".format(path, e.errno, e.strerror))
         exit(1)
 
 def hashFile(file):
@@ -217,7 +217,7 @@ if __name__ == "__main__":
     try:
         bytecodeSections = json.load(bytecodeFile, encoding = "utf-8")
     except:
-        print "Unexpected error parsing {0}: {1}".format(bytecodeJSONFile, sys.exc_info())
+        print("Unexpected error parsing {0}: {1}".format(bytecodeJSONFile, sys.exc_info()))
 
     if bytecodeHFilename:
         bytecodeHFile.write(hFileHashString)
index 08b07e4..d52093c 100644 (file)
@@ -43,22 +43,22 @@ def fileContains(relativePath, regexp):
     return False
 
 
-print "/* Identifying AVFoundation Support */"
+print("/* Identifying AVFoundation Support */")
 if lookFor("/include/AVFoundationCF/AVCFBase.h"):
-    print "#define HAVE_AVCF 1"
+    print("#define HAVE_AVCF 1")
 if lookFor("/include/AVFoundationCF/AVCFPlayerItemLegibleOutput.h"):
-    print "#define HAVE_AVCF_LEGIBLE_OUTPUT 1"
+    print("#define HAVE_AVCF_LEGIBLE_OUTPUT 1")
 if lookFor("/include/AVFoundationCF/AVCFAssetResourceLoader.h"):
-    print "#define HAVE_AVFOUNDATION_LOADER_DELEGATE 1"
+    print("#define HAVE_AVFOUNDATION_LOADER_DELEGATE 1")
 if lookFor("/include/AVFoundationCF/AVCFAsset.h"):
     regexp = re.compile("AVCFURLAssetIsPlayableExtendedMIMEType")
     if fileContains("/include/AVFoundationCF/AVCFAsset.h", regexp):
-        print "#define HAVE_AVCFURL_PLAYABLE_MIMETYPE 1"
+        print("#define HAVE_AVCFURL_PLAYABLE_MIMETYPE 1")
 if lookFor("/include/QuartzCore/CACFLayer.h"):
     regexp = re.compile("CACFLayerSetContentsScale")
     if fileContains("/include/QuartzCore/CACFLayer.h", regexp):
-        print "#define HAVE_CACFLAYER_SETCONTENTSSCALE 1"
+        print("#define HAVE_CACFLAYER_SETCONTENTSSCALE 1")
 if lookFor("/include/AVFoundationCF/AVCFPlayerItemLegibleOutput.h"):
     regexp = re.compile("kAVCFPlayerItemLegibleOutput_CallbacksVersion_2")
     if fileContains("/include/AVFoundationCF/AVCFPlayerItemLegibleOutput.h", regexp):
-        print "#define HAVE_AVCFPLAYERITEM_CALLBACK_VERSION_2 1"
+        print("#define HAVE_AVCFPLAYERITEM_CALLBACK_VERSION_2 1")
index a46a6d0..8da05b1 100644 (file)
@@ -1,3 +1,12 @@
+2017-12-08  Konstantin Tokarev  <annulen@yandex.ru>
+
+        [python] Replace print operator with print() function for python3 compatibility
+        https://bugs.webkit.org/show_bug.cgi?id=180592
+
+        Reviewed by Michael Catanzaro.
+
+        * AVFoundationSupport.py:
+
 2017-12-08  Eric Carlson  <eric.carlson@apple.com>
 
         Move Logger from PAL to WTF so it can be used outside of WebCore
index bf57ffa..a550bb0 100755 (executable)
@@ -31,40 +31,40 @@ def getLatestSVNRevision(SVNServer):
     p = subprocess.Popen(["svn", "log", "--non-interactive", "--verbose", "--xml", "--limit=1", SVNServer], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
     response = p.communicate()[0]
     if p.returncode != 0:
-        print "Can't connect to host: %s, return code %s " % (SVNServer, p.returncode)
-        print "OUTPUT:"
-        print response
+        print("Can't connect to host: %s, return code %s " % (SVNServer, p.returncode))
+        print("OUTPUT:")
+        print(response)
         return -1
     try:
         doc = xml.dom.minidom.parseString(response)
         el = doc.getElementsByTagName("logentry")[0]
         return el.getAttribute("revision")
     except xml.parsers.expat.ExpatError, e:
-        print "FAILED TO PARSE 'svn log' XML:"
-        print str(e)
-        print "----"
-        print "RECEIVED TEXT:"
-        print response
+        print("FAILED TO PARSE 'svn log' XML:")
+        print(str(e))
+        print("----")
+        print("RECEIVED TEXT:")
+        print(response)
         sys.exit(1)
 
 
 def waitForSVNRevision(SVNServer, revision):
     if not revision or not revision.isdigit():
         latestRevision = int(getLatestSVNRevision(SVNServer))
-        print "Latest SVN revision on %s is r%d. Don't wait, because revision argument isn't a valid SVN revision." % (SVNServer, latestRevision)
+        print("Latest SVN revision on %s is r%d. Don't wait, because revision argument isn't a valid SVN revision." % (SVNServer, latestRevision))
         return
 
     revision = int(revision)
     while True:
         latestRevision = int(getLatestSVNRevision(SVNServer))
         if latestRevision == -1:
-            print "%s SVN server is unreachable. Sleeping for 60 seconds." % (SVNServer)
+            print("%s SVN server is unreachable. Sleeping for 60 seconds." % (SVNServer))
             time.sleep(60)
         elif latestRevision < revision:
-            print "Latest SVN revision on %s is r%d, but we are waiting for r%d. Sleeping for 5 seconds." % (SVNServer, latestRevision, revision)
+            print("Latest SVN revision on %s is r%d, but we are waiting for r%d. Sleeping for 5 seconds." % (SVNServer, latestRevision, revision))
             time.sleep(5)
         else:
-            print "Latest SVN revision on %s is r%d, which is newer or equal than r%d." % (SVNServer, latestRevision, revision)
+            print("Latest SVN revision on %s is r%d, which is newer or equal than r%d." % (SVNServer, latestRevision, revision))
             break
 
 
index fe228de..bc95060 100644 (file)
@@ -1,3 +1,135 @@
+2017-12-08  Konstantin Tokarev  <annulen@yandex.ru>
+
+        [python] Replace print operator with print() function for python3 compatibility
+        https://bugs.webkit.org/show_bug.cgi?id=180592
+
+        Reviewed by Michael Catanzaro.
+
+        * BuildSlaveSupport/wait-for-SVN-server.py:
+        (getLatestSVNRevision):
+        (waitForSVNRevision):
+        * Scripts/download-latest-github-release.py:
+        (find_latest_release):
+        (main):
+        * Scripts/update-wasm-gcc-torture.py:
+        (update_lkgr):
+        (untar_torture):
+        (list_js_files):
+        (waterfall_known_failures):
+        * Scripts/update-webkit-wincairo-libs.py:
+        * Scripts/webkitpy/benchmark_runner/benchmark_runner.py:
+        (BenchmarkRunner.show_results):
+        * Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py:
+        (SimpleHTTPServerDriver.fetch_result):
+        * Scripts/webkitpy/benchmark_runner/run_benchmark.py:
+        (list_benchmark_plans):
+        * Scripts/webkitpy/bindings/main.py:
+        (BindingsTests.generate_from_idl):
+        (BindingsTests.generate_supplemental_dependency):
+        (BindingsTests.detect_changes):
+        (BindingsTests.run_tests):
+        (BindingsTests.main):
+        * Scripts/webkitpy/codegen/main.py:
+        (BuiltinsGeneratorTests.generate_from_js_builtins):
+        (BuiltinsGeneratorTests.detect_changes):
+        (BuiltinsGeneratorTests.single_builtin_test):
+        (BuiltinsGeneratorTests.run_test):
+        (BuiltinsGeneratorTests.run_tests):
+        (BuiltinsGeneratorTests.main):
+        * Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py:
+        (MockBugzilla.fetch_attachment):
+        * Scripts/webkitpy/common/net/buildbot/buildbot.py:
+        (Builder._fetch_revision_to_build_map):
+        * Scripts/webkitpy/common/system/crashlogs.py:
+        (CrashLogs._find_newest_log_win):
+        * Scripts/webkitpy/common/system/outputcapture_unittest.py:
+        (OutputCaptureTest.test_output_capture_scope):
+        * Scripts/webkitpy/common/system/profiler.py:
+        (GooglePProf.profile_after_exit):
+        (Perf.profile_after_exit):
+        * Scripts/webkitpy/common/system/user.py:
+        (User.prompt_with_multiple_lists):
+        (User.prompt_with_list):
+        (User._warn_if_application_is_xcode):
+        (User.edit_changelog):
+        * Scripts/webkitpy/inspector/main.py:
+        (InspectorGeneratorTests.generate_from_json):
+        (InspectorGeneratorTests.detect_changes):
+        (InspectorGeneratorTests.run_tests):
+        (InspectorGeneratorTests.main):
+        * Scripts/webkitpy/layout_tests/controllers/manager.py:
+        (Manager._print_expectation_line_for_test):
+        (Manager._print_expectations_for_subset):
+        (Manager._print_expectations_for_subset.if):
+        * Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py:
+        (run_server):
+        * Scripts/webkitpy/port/config_standalone.py:
+        (main):
+        * Scripts/webkitpy/port/darwin_testcase.py:
+        (DarwinTest.test_spindump.logging_run_command):
+        (DarwinTest.test_sample_process.logging_run_command):
+        * Scripts/webkitpy/port/ios.py:
+        (IOSPort.clean_up_test_run):
+        * Scripts/webkitpy/port/ios_device_unittest.py:
+        (IOSDeviceTest.test_spindump.logging_run_command):
+        (IOSDeviceTest.test_sample_process.logging_run_command):
+        * Scripts/webkitpy/port/ios_simulator_unittest.py:
+        (IOSSimulatorTest.test_xcrun.throwing_run_command):
+        * Scripts/webkitpy/port/leakdetector_unittest.py:
+        (test_count_total_bytes_and_unique_leaks.mock_run_script):
+        * Scripts/webkitpy/port/mac_unittest.py:
+        (MacTest.test_xcrun.throwing_run_command):
+        * Scripts/webkitpy/style/checkers/contributors.py:
+        (ContributorsChecker.check):
+        * Scripts/webkitpy/tool/commands/abstractlocalservercommand.py:
+        (AbstractLocalServerCommand.execute):
+        * Scripts/webkitpy/tool/commands/adduserstogroups.py:
+        (AddUsersToGroups.execute):
+        * Scripts/webkitpy/tool/commands/analyzechangelog.py:
+        (AnalyzeChangeLog._generate_jsons):
+        (AnalyzeChangeLog.execute):
+        (ChangeLogAnalyzer._set_filename):
+        (ChangeLogAnalyzer.analyze):
+        * Scripts/webkitpy/tool/commands/bugfortest.py:
+        (BugForTest.execute):
+        * Scripts/webkitpy/tool/commands/bugsearch.py:
+        (execute):
+        * Scripts/webkitpy/tool/commands/findusers.py:
+        (FindUsers.execute):
+        * Scripts/webkitpy/tool/commands/gardenomatic.py:
+        (GardenOMatic.execute):
+        * Scripts/webkitpy/tool/commands/rebaseline.py:
+        (RebaselineTest.execute):
+        * Scripts/webkitpy/tool/commands/rebaselineserver.py:
+        (RebaselineServer._prepare_config):
+        * Scripts/webkitpy/tool/commands/setupgitclone.py:
+        (SetupGitClone.execute):
+        (SetupGitClone._get_username_and_email):
+        * Scripts/webkitpy/tool/commands/suggestnominations.py:
+        (SuggestNominations._print_nominations):
+        (SuggestNominations._print_counts):
+        * Scripts/webkitpy/tool/commands/upload.py:
+        (CommitMessageForCurrentDiff.execute):
+        (CreateBug.prompt_for_bug_title_and_comment):
+        * Scripts/webkitpy/tool/multicommandtool.py:
+        (HelpCommand.execute):
+        * Scripts/webkitpy/tool/servers/gardeningserver_unittest.py:
+        (TestGardeningHTTPRequestHandler._serve_text):
+        (TestGardeningHTTPRequestHandler._serve_json):
+        * Scripts/webkitpy/tool/steps/addsvnmimetypeforpng.py:
+        (AddSvnMimetypeForPng.run):
+        * Scripts/webkitpy/tool/steps/suggestreviewers.py:
+        (SuggestReviewers.run):
+        * Scripts/webkitpy/w3c/test_importer.py:
+        (TestImporter.update_tests_options):
+        * Scripts/webkitpy/webdriver_tests/webdriver_test_runner_selenium.py:
+        (WebDriverTestRunnerSelenium.run):
+        * TestResultServer/model/jsonresults_unittest.py:
+        * gtk/ycm_extra_conf.py:
+        (FlagsForFile):
+        * lldb/lldb_webkit.py:
+        (btjs):
+
 2017-12-08  Eric Carlson  <eric.carlson@apple.com>
 
         Move Logger from PAL to WTF so it can be used outside of WebCore
index f516c61..4536435 100755 (executable)
@@ -70,7 +70,7 @@ def find_latest_release(args):
     try:
         response = urllib2.urlopen(request)
     except urllib2.URLError as error:
-        print error
+        print(error)
         return None, None
 
     data = json.loads(response.read())
@@ -105,38 +105,38 @@ def main(argv):
     binary_path = os.path.join(args.output_dir, args.filename)
     version_info_path = binary_path + '.version'
 
-    print 'Updating {}...'.format(args.filename)
+    print('Updating {}...'.format(args.filename))
 
     existing_version_info = load_version_info(version_info_path)
     if existing_version_info:
-        print 'Found existing release:', existing_version_info['tag_name']
+        print('Found existing release:', existing_version_info['tag_name'])
     else:
-        print 'No existing release found.'
+        print('No existing release found.')
 
-    print 'Seeking latest release from {}...'.format(args.repo)
+    print('Seeking latest release from {}...'.format(args.repo))
     release_url, latest_version_info = find_latest_release(args)
 
     if not latest_version_info:
         if existing_version_info:
-            print 'Falling back to existing release!'
+            print('Falling back to existing release!')
             return Status.USING_EXISTING
 
-        print 'No release found!'
+        print('No release found!')
         return Status.COULD_NOT_FIND
 
-    print 'Found latest release:', latest_version_info['tag_name']
+    print('Found latest release:', latest_version_info['tag_name'])
 
     if latest_version_info == existing_version_info:
-        print 'Already up-to-date!'
+        print('Already up-to-date!')
         return Status.UP_TO_DATE
 
     if not os.path.exists(args.output_dir):
         os.makedirs(args.output_dir)
 
-    print 'Downloading to {}...'.format(os.path.abspath(args.output_dir))
+    print('Downloading to {}...'.format(os.path.abspath(args.output_dir)))
     download_release(release_url, binary_path)
     save_version_info(version_info_path, latest_version_info)
-    print 'Done!'
+    print('Done!')
 
     return Status.DOWNLOADED
 
index 9a3597b..3da5328 100755 (executable)
@@ -64,16 +64,16 @@ def parse_args():
 def update_lkgr(args):
     lkgr_url = LKGR_URL % args.platform
     if not args.lkgr:
-        print 'Downloading: %s' % lkgr_url
+        print('Downloading: %s' % lkgr_url)
         args.lkgr = json.loads(urllib2.urlopen(lkgr_url).read())['build']
-    print 'lkgr: %s' % args.lkgr
+    print('lkgr: %s' % args.lkgr)
 
 
 def untar_torture(args):
     torture_file = TORTURE_FILE % args.lkgr
     torture_url = TORTURE_URL % (args.platform, args.lkgr, torture_file)
     if not os.path.exists(torture_file):
-        print 'Downloading: %s' % torture_url
+        print('Downloading: %s' % torture_url)
         torture_download = urllib2.urlopen(torture_url)
         with open(torture_file, 'wb') as f:
             f.write(torture_download.read())
@@ -81,14 +81,14 @@ def untar_torture(args):
         if os.path.isdir(TORTURE_DIR):
             shutil.rmtree(TORTURE_DIR)
         with tarfile.open(torture_file, 'r') as torture_tar:
-            print 'Extracting: %s -> %s' % (torture_file, TORTURE_DIR)
+            print('Extracting: %s -> %s' % (torture_file, TORTURE_DIR))
             torture_tar.extractall()
     assert os.path.isdir(TORTURE_DIR)
 
 
 def list_js_files(args):
     js_files = sorted([os.path.basename(f) for f in glob.glob(os.path.join(TORTURE_DIR, '*.js'))])
-    print 'Found %s JavaScript tests' % len(js_files)
+    print('Found %s JavaScript tests' % len(js_files))
     assert len(js_files) > 1200
     return js_files
 
@@ -102,7 +102,7 @@ def waterfall_known_failures(args):
         subprocess.check_call(['git', 'checkout', args.waterfall_hash], cwd=WATERFALL_DIR)
     else:
         args.waterfall_hash = subprocess.check_output(['git', 'log', '-n1', '--pretty=format:%H'], cwd=WATERFALL_DIR).strip()
-    print 'Waterfall at: %s' % args.waterfall_hash
+    print('Waterfall at: %s' % args.waterfall_hash)
     known_failures = []
     with open(os.path.join(WATERFALL_DIR, WATERFALL_KNOWN_FAILURES)) as failures_file:
         for line in failures_file:
index d9b8b99..771c6e8 100644 (file)
@@ -37,7 +37,7 @@ result = download.main([repo, file])
 
 # Only unzip if required
 if result == download.Status.DOWNLOADED:
-    print 'Extracting release to {}...'.format(output)
+    print('Extracting release to {}...'.format(output))
     zip = zipfile.ZipFile(file, 'r')
     zip.extractall(output)
     zip.close()
index 442e9dc..2f10bc7 100644 (file)
@@ -156,4 +156,4 @@ class BenchmarkRunner(object):
     @classmethod
     def show_results(cls, results, scale_unit=True):
         results = BenchmarkResults(results)
-        print results.format(scale_unit)
+        print(results.format(scale_unit))
index 6b68094..937b71d 100644 (file)
@@ -79,7 +79,7 @@ class SimpleHTTPServerDriver(HTTPServerDriver):
 
     def fetch_result(self):
         (stdout, stderr) = self._server_process.communicate()
-        print stderr
+        print(stderr)
         return stdout
 
     def kill_server(self):
index b08c102..4f2ad1e 100755 (executable)
@@ -69,9 +69,9 @@ def run_benchmark_plan(args, plan):
 
 
 def list_benchmark_plans():
-    print "Available benchmark plans: "
+    print("Available benchmark plans: ")
     for plan in BenchmarkRunner.available_plans():
-        print "\t%s" % plan
+        print("\t%s" % plan)
 
 
 def start(args):
index 76404e3..1bd2a76 100644 (file)
@@ -64,9 +64,9 @@ class BindingsTests:
         try:
             output = self.executive.run_command(cmd)
             if output:
-                print output
+                print(output)
         except ScriptError, e:
-            print e.output
+            print(e.output)
             exit_code = e.exit_code
         return exit_code
 
@@ -94,9 +94,9 @@ class BindingsTests:
         try:
             output = self.executive.run_command(cmd)
             if output:
-                print output
+                print(output)
         except ScriptError, e:
-            print e.output
+            print(e.output)
             exit_code = e.exit_code
         os.remove(idl_files_list[1])
         return exit_code
@@ -118,13 +118,13 @@ class BindingsTests:
                 exit_code = e.exit_code
 
             if exit_code or output:
-                print 'FAIL: (%s) %s' % (generator, output_file)
-                print output
+                print('FAIL: (%s) %s' % (generator, output_file))
+                print(output)
                 changes_found = True
                 if self.json_file_name:
                     self.failures.append("(%s) %s" % (generator, output_file))
             elif self.verbose:
-                print 'PASS: (%s) %s' % (generator, output_file)
+                print('PASS: (%s) %s' % (generator, output_file))
         return changes_found
 
     def test_matches_patterns(self, test):
@@ -159,7 +159,7 @@ class BindingsTests:
                 passed = False
 
             if self.reset_results:
-                print "Reset results: (%s) %s" % (generator, input_file)
+                print("Reset results: (%s) %s" % (generator, input_file))
                 continue
 
             # Detect changes
@@ -182,7 +182,7 @@ class BindingsTests:
         dedicatedworkerglobalscope_constructors_file = tempfile.mkstemp()[1]
         serviceworkerglobalscope_constructors_file = tempfile.mkstemp()[1]
         if self.generate_supplemental_dependency(input_directory, supplemental_dependency_file, window_constructors_file, workerglobalscope_constructors_file, dedicatedworkerglobalscope_constructors_file, serviceworkerglobalscope_constructors_file):
-            print 'Failed to generate a supplemental dependency file.'
+            print('Failed to generate a supplemental dependency file.')
             os.remove(supplemental_dependency_file)
             os.remove(window_constructors_file)
             os.remove(workerglobalscope_constructors_file)
@@ -210,10 +210,10 @@ class BindingsTests:
             with open(self.json_file_name, 'w') as json_file:
                 json.dump(json_data, json_file)
 
-        print ''
+        print('')
         if all_tests_passed:
-            print 'All tests PASS!'
+            print('All tests PASS!')
             return 0
         else:
-            print 'Some tests FAIL! (To update the reference files, execute "run-bindings-tests --reset-results")'
+            print('Some tests FAIL! (To update the reference files, execute "run-bindings-tests --reset-results")')
             return -1
index 3b819df..c202ce1 100644 (file)
@@ -58,7 +58,7 @@ class BuiltinsGeneratorTests:
             if stderr_output:
                 self.write_error_file(framework_name + "JSBuiltins.h-error" if generate_wrappers else builtins_files[0], output_directory, stderr_output)
         except ScriptError, e:
-            print e.output
+            print(e.output)
             exit_code = e.exit_code
         return exit_code
 
@@ -85,17 +85,17 @@ class BuiltinsGeneratorTests:
                 exit_code = e.exit_code
 
             if exit_code or output:
-                print 'FAIL: %s' % output_file
-                print output
+                print('FAIL: %s' % output_file)
+                print(output)
                 changes_found = True
             else:
-                print 'PASS: %s' % output_file
+                print('PASS: %s' % output_file)
         return changes_found
 
     def single_builtin_test(self, test_name, test_files, work_directory):
         (framework_name, test_case, output_mode) = test_name.split('-')
         if not framework_name or not output_mode or not test_case:
-            print "Invalid test case name: should be Framework-TestCaseName-OutputMode.js"
+            print("Invalid test case name: should be Framework-TestCaseName-OutputMode.js")
             return False
 
         combined_outputs = output_mode == "Combined"
@@ -115,7 +115,7 @@ class BuiltinsGeneratorTests:
             passed = False
 
         if self.reset_results:
-            print "Reset results for test: %s" % (test_name)
+            print("Reset results for test: %s" % (test_name))
             return True
 
         # Detect changes
@@ -141,7 +141,7 @@ class BuiltinsGeneratorTests:
                 separately_generated_files.append(test_file)
 
             if self.reset_results:
-                print "Reset results for test: %s" % (input_file)
+                print("Reset results for test: %s" % (input_file))
                 continue
 
         if separately_generated_files:
@@ -161,10 +161,10 @@ class BuiltinsGeneratorTests:
         if not self.run_tests(input_directory, reference_directory):
             all_tests_passed = False
 
-        print ''
+        print('')
         if all_tests_passed:
-            print 'All tests PASS!'
+            print('All tests PASS!')
             return 0
         else:
-            print 'Some tests FAIL! (To update the reference files, execute "run-builtins-generator-tests --reset-results")'
+            print('Some tests FAIL! (To update the reference files, execute "run-builtins-generator-tests --reset-results")')
             return -1
index 2ee6807..fd889cd 100644 (file)
@@ -401,7 +401,7 @@ class MockBugzilla(object):
 
         attachment_dictionary = self.attachment_cache.get(attachment_id)
         if not attachment_dictionary:
-            print "MOCK: fetch_attachment: %s is not a known attachment id" % attachment_id
+            print("MOCK: fetch_attachment: %s is not a known attachment id" % attachment_id)
             return None
         bug = self.fetch_bug(attachment_dictionary["bug_id"])
         for attachment in bug.attachments(include_obsolete=True):
index 097a1fd..9f0566c 100644 (file)
@@ -158,8 +158,8 @@ class Builder(object):
             # FIXME: This method is horribly slow due to the huge network load.
             # FIXME: This is a poor way to do revision -> build mapping.
             # Better would be to ask buildbot through some sort of API.
-            print "Loading revision/build list from %s." % self.results_url()
-            print "This may take a while..."
+            print("Loading revision/build list from %s." % self.results_url())
+            print("This may take a while...")
             result_files = self._buildbot._fetch_twisted_directory_listing(self.results_url())
         except urllib2.HTTPError, error:
             if error.code != 404:
index fe2bfc2..812d9ac 100644 (file)
@@ -120,15 +120,15 @@ class CrashLogs(object):
                     if int(match.group('pid'), 16) == pid:
                         return errors + log_file
             except IOError, e:
-                print "IOError %s" % str(e)
+                print("IOError %s" % str(e))
                 if include_errors:
                     errors += u"ERROR: Failed to read '%s': %s\n" % (path, str(e))
             except OSError, e:
-                print "OSError %s" % str(e)
+                print("OSError %s" % str(e))
                 if include_errors:
                     errors += u"ERROR: Failed to read '%s': %s\n" % (path, str(e))
             except UnicodeDecodeError, e:
-                print "UnicodeDecodeError %s" % str(e)
+                print("UnicodeDecodeError %s" % str(e))
                 if include_errors:
                     errors += u"ERROR: Failed to decode '%s' as ascii: %s\n" % (path, str(e))
 
index 037a15d..e88309c 100644 (file)
@@ -61,11 +61,11 @@ class OutputCaptureTest(unittest.TestCase):
     def test_output_capture_scope(self):
         scope = OutputCaptureScope()
         with scope:
-            print 'STRING 1'
+            print('STRING 1')
         self.assertEqual(('STRING 1\n', '', ''), scope.captured_output)
 
         with scope:
-            print 'STRING 2'
+            print('STRING 2')
         self.assertEqual(('STRING 2\n', '', ''), scope.captured_output)
 
     def test_output_capture_scope_from_output_capture(self):
index 69ef205..5118e07 100644 (file)
@@ -116,17 +116,17 @@ class GooglePProf(SingleFileOutputProfiler):
     def profile_after_exit(self):
         # google-pprof doesn't check its arguments, so we have to.
         if not (self._host.filesystem.exists(self._output_path)):
-            print "Failed to gather profile, %s does not exist." % self._output_path
+            print("Failed to gather profile, %s does not exist." % self._output_path)
             return
 
         pprof_args = [self._pprof_path(), '--text', self._executable_path, self._output_path]
         profile_text = self._host.executive.run_command(pprof_args)
-        print "First 10 lines of pprof --text:"
-        print self._first_ten_lines_of_profile(profile_text)
-        print "http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html documents output."
-        print
-        print "To interact with the the full profile, including produce graphs:"
-        print ' '.join([self._pprof_path(), self._executable_path, self._output_path])
+        print("First 10 lines of pprof --text:")
+        print(self._first_ten_lines_of_profile(profile_text))
+        print("http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html documents output.")
+        print()
+        print("To interact with the the full profile, including produce graphs:")
+        print(' '.join([self._pprof_path(), self._executable_path, self._output_path]))
 
 
 class Perf(SingleFileOutputProfiler):
@@ -171,21 +171,21 @@ class Perf(SingleFileOutputProfiler):
         if exit_code is not 0:
             print "'perf record' failed, ",
             if exit_code:
-                print "exit code was %i." % exit_code
+                print("exit code was %i." % exit_code)
             else:
-                print "the profiled process with pid %i is still running." % self._watched_pid
+                print("the profiled process with pid %i is still running." % self._watched_pid)
             return
 
         perf_report_args = [self._perf_path(), 'report', '--call-graph', 'none', '--input', self._output_path]
         perf_report_output = self._host.executive.run_command(perf_report_args)
-        print "First 10 lines of 'perf report --call-graph=none':"
+        print("First 10 lines of 'perf report --call-graph=none':")
 
-        print " ".join(perf_report_args)
-        print "\n".join(self._first_ten_lines_of_profile(perf_report_output))
+        print(" ".join(perf_report_args))
+        print("\n".join(self._first_ten_lines_of_profile(perf_report_output)))
 
-        print "To view the full profile, run:"
-        print ' '.join([self._perf_path(), 'report', '-i', self._output_path])
-        print  # An extra line between tests looks nicer.
+        print("To view the full profile, run:")
+        print(' '.join([self._perf_path(), 'report', '-i', self._output_path]))
+        print()  # An extra line between tests looks nicer.
 
 
 class Sample(SingleFileOutputProfiler):
index b3e841e..4400c02 100644 (file)
@@ -77,12 +77,12 @@ class User(object):
     def prompt_with_multiple_lists(cls, list_title, subtitles, lists, can_choose_multiple=False, raw_input=raw_input):
         item_index = 0
         cumulated_list = []
-        print list_title
+        print(list_title)
         for i in range(len(subtitles)):
-            print "\n" + subtitles[i]
+            print("\n" + subtitles[i])
             for item in lists[i]:
                 item_index += 1
-                print "%2d. %s" % (item_index, item)
+                print("%2d. %s" % (item_index, item))
             cumulated_list += lists[i]
         return cls._wait_on_list_response(cumulated_list, can_choose_multiple, raw_input)
 
@@ -115,11 +115,11 @@ class User(object):
 
     @classmethod
     def prompt_with_list(cls, list_title, list_items, can_choose_multiple=False, raw_input=raw_input):
-        print list_title
+        print(list_title)
         i = 0
         for item in list_items:
             i += 1
-            print "%2d. %s" % (i, item)
+            print("%2d. %s" % (i, item))
         return cls._wait_on_list_response(list_items, can_choose_multiple, raw_input)
 
     def edit(self, files):
@@ -133,15 +133,15 @@ class User(object):
 
     def _warn_if_application_is_xcode(self, edit_application):
         if "Xcode" in edit_application:
-            print "Instead of using Xcode.app, consider using EDITOR=\"xed --wait\"."
+            print("Instead of using Xcode.app, consider using EDITOR=\"xed --wait\".")
 
     def edit_changelog(self, files):
         edit_application = os.environ.get("CHANGE_LOG_EDIT_APPLICATION")
         if edit_application and self._platforminfo.is_mac():
             # On Mac we support editing ChangeLogs using an application.
             args = shlex.split(edit_application)
-            print "Using editor in the CHANGE_LOG_EDIT_APPLICATION environment variable."
-            print "Please quit the editor application when done editing."
+            print("Using editor in the CHANGE_LOG_EDIT_APPLICATION environment variable.")
+            print("Please quit the editor application when done editing.")
             self._warn_if_application_is_xcode(edit_application)
             subprocess.call(["open", "-W", "-n", "-a"] + args + files)
             return
index 419f255..a71a393 100644 (file)
@@ -54,7 +54,7 @@ class InspectorGeneratorTests:
             if stderr_output:
                 self.write_error_file(json_file, output_directory, stderr_output)
         except ScriptError, e:
-            print e.output
+            print(e.output)
             exit_code = e.exit_code
         return exit_code
 
@@ -81,11 +81,11 @@ class InspectorGeneratorTests:
                 exit_code = e.exit_code
 
             if exit_code or output:
-                print 'FAIL: %s' % output_file
-                print output
+                print('FAIL: %s' % output_file)
+                print(output)
                 changes_found = True
             else:
-                print 'PASS: %s' % output_file
+                print('PASS: %s' % output_file)
         return changes_found
 
     def run_tests(self, platform, input_directory, reference_directory):
@@ -105,7 +105,7 @@ class InspectorGeneratorTests:
                 passed = False
 
             if self.reset_results:
-                print "Reset results for test: %s" % (input_file)
+                print("Reset results for test: %s" % (input_file))
                 continue
 
             # Detect changes
@@ -138,10 +138,10 @@ class InspectorGeneratorTests:
 
             all_tests_passed = all_tests_passed and self.run_tests(platform_name, input_directory, reference_directory)
 
-        print ''
+        print('')
         if all_tests_passed:
-            print 'All tests PASS!'
+            print('All tests PASS!')
             return 0
         else:
-            print 'Some tests FAIL! (To update the reference files, execute "run-inspector-generator-tests --reset-results")'
+            print('Some tests FAIL! (To update the reference files, execute "run-inspector-generator-tests --reset-results")')
             return -1
index e278b6e..b69a005 100644 (file)
@@ -540,18 +540,18 @@ class Manager(object):
 
     def _print_expectation_line_for_test(self, format_string, test):
         line = self._expectations.model().get_expectation_line(test)
-        print format_string.format(test, line.expected_behavior, self._expectations.readable_filename_and_line_number(line), line.original_string or '')
+        print(format_string.format(test, line.expected_behavior, self._expectations.readable_filename_and_line_number(line), line.original_string or ''))
     
     def _print_expectations_for_subset(self, device_class, test_col_width, tests_to_run, tests_to_skip={}):
         format_string = '{{:{width}}} {{}} {{}} {{}}'.format(width=test_col_width)
         if tests_to_skip:
-            print ''
-            print 'Tests to skip ({})'.format(len(tests_to_skip))
+            print('')
+            print('Tests to skip ({})'.format(len(tests_to_skip)))
             for test in sorted(tests_to_skip):
                 self._print_expectation_line_for_test(format_string, test)
 
-        print ''
-        print 'Tests to run{} ({})'.format(' for ' + device_class if device_class else '', len(tests_to_run))
+        print('')
+        print('Tests to run{} ({})'.format(' for ' + device_class if device_class else '', len(tests_to_run)))
         for test in sorted(tests_to_run):
             self._print_expectation_line_for_test(format_string, test)
 
index 19f8bc7..314e37e 100755 (executable)
@@ -68,24 +68,24 @@ def run_server(options, args, stdout, stderr):
         return EXCEPTIONAL_EXIT_STATUS
 
     if options.web_platform_test_server:
-        print "Starting web-platform-tests server on <%s> and <%s>" % (web_platform_test_server.base_http_url(port), web_platform_test_server.base_https_url(port))
-        print "WebKit http/wpt tests are accessible at <%s>" % (web_platform_test_server.base_http_url(port) + "WebKit/")
+        print("Starting web-platform-tests server on <%s> and <%s>" % (web_platform_test_server.base_http_url(port), web_platform_test_server.base_https_url(port)))
+        print("WebKit http/wpt tests are accessible at <%s>" % (web_platform_test_server.base_http_url(port) + "WebKit/"))
         port.start_web_platform_test_server()
 
     if options.httpd_server:
         # FIXME(154294): somehow retrieve the actual ports and interfaces bound by the httpd server
         http_port = options.http_port if options.http_port is not None else "8000"
         if options.http_all_interfaces is not None:
-            print "Starting httpd on port %s (all interfaces)" % http_port
+            print("Starting httpd on port %s (all interfaces)" % http_port)
         else:
-            print "Starting httpd on <http://127.0.0.1:%s>" % http_port
+            print("Starting httpd on <http://127.0.0.1:%s>" % http_port)
 
         additionalDirs = {additional_dir[0]: additional_dir[1] for additional_dir in options.additional_dirs}
         port.start_http_server(additionalDirs)
         port.start_websocket_server()
 
     if options.url:
-        print "Opening %s" % options.url
+        print("Opening %s" % options.url)
         subprocess.Popen(['open', options.url], stdout=subprocess.PIPE)
 
     try:
index 274a07b..db2d4b8 100644 (file)
@@ -63,7 +63,7 @@ def main(argv=None):
         fs = filesystem.FileSystem()
 
     c = config.Config(e, fs)
-    print c.default_configuration()
+    print(c.default_configuration())
 
 if __name__ == '__main__':
     main()
index 60ae94b..a3ee006 100644 (file)
@@ -100,7 +100,7 @@ class DarwinTest(port_testcase.PortTestCase):
     def test_spindump(self):
 
         def logging_run_command(args):
-            print args
+            print(args)
 
         port = self.make_port()
         port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-spindump.txt'] = 'Spindump file'
@@ -115,7 +115,7 @@ class DarwinTest(port_testcase.PortTestCase):
         def logging_run_command(args):
             if args[0] == '/usr/bin/sudo':
                 return 1
-            print args
+            print(args)
             return 0
 
         port = self.make_port()
index 3d113e9..03a583b 100644 (file)
@@ -190,7 +190,7 @@ class IOSPort(DarwinPort):
         if len(exception_list) == 1:
             raise
         elif len(exception_list) > 1:
-            print '\n'
+            print('\n')
             for exception in exception_list:
                 _log.error('{} raised: {}'.format(exception[0].__class__.__name__, exception[0]))
                 _log.error(exception[1])
index ff2fdf9..48225cf 100644 (file)
@@ -50,7 +50,7 @@ class IOSDeviceTest(ios_testcase.IOSTest):
 
     def test_spindump(self):
         def logging_run_command(args):
-            print args
+            print(args)
 
         port = self.make_port()
         port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-spindump.txt'] = 'Spindump file'
@@ -64,7 +64,7 @@ class IOSDeviceTest(ios_testcase.IOSTest):
         def logging_run_command(args):
             if args[0] == '/usr/sbin/spindump':
                 return 1
-            print args
+            print(args)
             return 0
 
         port = self.make_port()
index 45b4744..2d9c525 100644 (file)
@@ -81,7 +81,7 @@ class IOSSimulatorTest(ios_testcase.IOSTest):
 
     def test_xcrun(self):
         def throwing_run_command(args):
-            print args
+            print(args)
             raise ScriptError("MOCK script error")
 
         port = self.make_port()
index ca3e61c..fb08183 100644 (file)
@@ -127,7 +127,7 @@ Binary Images:
         detector = self._make_detector()
 
         def mock_run_script(name, args, include_configuration_arguments=False):
-            print "MOCK _run_script: %s %s" % (name, args)
+            print("MOCK _run_script: %s %s" % (name, args))
             return """1 calls for 16 bytes: -[NSURLRequest mutableCopyWithZone:] | +[NSObject(NSObject) allocWithZone:] | _internal_class_createInstanceFromZone | calloc | malloc_zone_calloc
 
 147 calls for 9,408 bytes: _CFRuntimeCreateInstance | _ZN3WTF24StringWrapperCFAllocatorL8allocateElmPv StringImplCF.cpp:67 | WTF::fastMalloc(unsigned long) FastMalloc.cpp:268 | malloc | malloc_zone_malloc 
index fd2a25b..a88190e 100644 (file)
@@ -136,7 +136,7 @@ class MacTest(darwin_testcase.DarwinTest):
 
     def test_xcrun(self):
         def throwing_run_command(args):
-            print args
+            print(args)
             raise ScriptError("MOCK script error")
 
         port = self.make_port()
index fc55f3d..e76d544 100644 (file)
@@ -45,7 +45,7 @@ class ContributorsChecker(JSONChecker):
         diff = self._unidiff_output(actual, canonicalized)
         if diff:
             self._handle_style_error(0, 'json/syntax', 5, 'contributors.json differs from the canonical format. Use "validate-committer-lists --canonicalize" to reformat it.')
-            print diff
+            print(diff)
 
     def _unidiff_output(self, expected, actual):
         expected = expected.splitlines(1)
index 25a36ce..953f87b 100644 (file)
@@ -46,8 +46,8 @@ class AbstractLocalServerCommand(Command):
         config = self._prepare_config(options, args, tool)
 
         server_url = "http://localhost:%d%s" % (options.httpd_port, self.launch_path)
-        print "Starting server at %s" % server_url
-        print "Use the 'Exit' link in the UI, %squitquitquit or Ctrl-C to stop" % server_url
+        print("Starting server at %s" % server_url)
+        print("Use the 'Exit' link in the UI, %squitquitquit or Ctrl-C to stop" % server_url)
 
         if options.show_results:
             # FIXME: This seems racy.
index 25e719f..3482709 100644 (file)
@@ -44,22 +44,22 @@ class AddUsersToGroups(Command):
         # FIXME: We could lookup what groups the current user is able to grant from bugzilla.
         groups = tool.user.prompt_with_list(list_title, self.known_groups, can_choose_multiple=True)
         if not groups:
-            print "No groups specified."
+            print("No groups specified.")
             return
 
         login_userid_pairs = tool.bugs.queries.fetch_login_userid_pairs_matching_substring(search_string)
         if not login_userid_pairs:
-            print "No users found matching '%s'" % search_string
+            print("No users found matching '%s'" % search_string)
             return
 
-        print "Found %s users matching %s:" % (len(login_userid_pairs), search_string)
+        print("Found %s users matching %s:" % (len(login_userid_pairs), search_string))
         for (login, user_id) in login_userid_pairs:
-            print "%s (%s)" % (login, user_id)
+            print("%s (%s)" % (login, user_id))
 
         confirm_message = "Are you sure you want add %s users to groups %s?  (This action cannot be undone using webkit-patch.)" % (len(login_userid_pairs), groups)
         if not tool.user.confirm(confirm_message):
             return
 
         for (login, user_id) in login_userid_pairs:
-            print "Adding %s to %s" % (login, groups)
+            print("Adding %s to %s" % (login, groups))
             tool.bugs.add_user_to_groups(user_id, groups)
index 1a1e810..e7e56b0 100644 (file)
@@ -60,30 +60,30 @@ class AnalyzeChangeLog(Command):
     @staticmethod
     def _generate_jsons(filesystem, jsons, output_dir):
         for filename in jsons:
-            print '    Generating', filename
+            print('    Generating', filename)
             filesystem.write_text_file(filesystem.join(output_dir, filename), json.dumps(jsons[filename], indent=2))
 
     def execute(self, options, args, tool):
         filesystem = self._tool.filesystem
         if len(args) < 1 or not filesystem.exists(args[0]):
-            print "Need the directory name to look for changelog as the first argument"
+            print("Need the directory name to look for changelog as the first argument")
             return
         changelog_dir = filesystem.abspath(args[0])
 
         if len(args) < 2 or not filesystem.exists(args[1]):
-            print "Need the output directory name as the second argument"
+            print("Need the output directory name as the second argument")
             return
         output_dir = args[1]
 
         startTime = time.time()
 
-        print 'Enumerating ChangeLog files...'
+        print('Enumerating ChangeLog files...')
         changelogs = AnalyzeChangeLog._enumerate_changelogs(filesystem, changelog_dir, options.changelog_count)
 
         analyzer = ChangeLogAnalyzer(tool, changelogs)
         analyzer.analyze()
 
-        print 'Generating json files...'
+        print('Generating json files...')
         json_files = {
             'summary.json': analyzer.summary(),
             'contributors.json': analyzer.contributors_statistics(),
@@ -91,11 +91,11 @@ class AnalyzeChangeLog(Command):
         }
         AnalyzeChangeLog._generate_jsons(filesystem, json_files, output_dir)
         commands_dir = filesystem.dirname(filesystem.path_to_module(self.__module__))
-        print commands_dir
+        print(commands_dir)
         filesystem.copyfile(filesystem.join(commands_dir, 'data/summary.html'), filesystem.join(output_dir, 'summary.html'))
 
         tick = time.time() - startTime
-        print 'Finished in %02dm:%02ds' % (int(tick / 60), int(tick % 60))
+        print('Finished in %02dm:%02ds' % (int(tick / 60), int(tick % 60)))
 
 
 class ChangeLogAnalyzer(object):
@@ -132,7 +132,7 @@ class ChangeLogAnalyzer(object):
 
     def _set_filename(self, filename):
         if self._filename:
-            print
+            print()
         self._filename = filename
 
     def analyze(self):
@@ -142,7 +142,7 @@ class ChangeLogAnalyzer(object):
                 self._print_status('Parsing entries...')
                 number_of_parsed_entries = self._analyze_entries(ChangeLog.parse_entries_from_file(changelog), path)
             self._print_status('Done (%d entries)' % number_of_parsed_entries)
-        print
+        print()
         self._summary['contributors'] = len(self._contributors_statistics)
         self._summary['contributors_with_reviews'] = sum([1 for contributor in self._contributors_statistics.values() if contributor['reviews']['total']])
         self._summary['contributors_without_reviews'] = self._summary['contributors'] - self._summary['contributors_with_reviews']
index f6f8411..830968a 100644 (file)
@@ -43,6 +43,6 @@ class BugForTest(Command):
         bug = reporter._lookup_bug_for_flaky_test(search_string)
         if bug:
             bug = reporter._follow_duplicate_chain(bug)
-            print "%5s %s" % (bug.id(), bug.title())
+            print("%5s %s" % (bug.id(), bug.title()))
         else:
-            print "No bugs found matching '%s'" % search_string
+            print("No bugs found matching '%s'" % search_string)
index 1f3af7a..14d49f5 100644 (file)
@@ -44,6 +44,6 @@ documentation on the query format."""
         search_string = args[0]
         bugs = tool.bugs.queries.fetch_bugs_matching_quicksearch(search_string)
         for bug in bugs:
-            print "%5s %s" % (bug.id(), bug.title())
+            print("%5s %s" % (bug.id(), bug.title()))
         if not bugs:
-            print "No bugs found matching '%s'" % search_string
+            print("No bugs found matching '%s'" % search_string)
index 8302e37..920d0b8 100644 (file)
@@ -39,4 +39,4 @@ class FindUsers(Command):
         search_string = args[0]
         users = CommitterList().contributors_by_search_string(search_string)
         for user in users:
-            print user
+            print(user)
index e976285..b2af098 100644 (file)
@@ -39,8 +39,8 @@ class GardenOMatic(AbstractRebaseliningCommand):
             ]))
 
     def execute(self, options, args, tool):
-        print "This command runs a local HTTP server that changes your working copy"
-        print "based on the actions you take in the web-based UI."
+        print("This command runs a local HTTP server that changes your working copy")
+        print("based on the actions you take in the web-based UI.")
 
         args = {}
         if options.platform:
@@ -55,5 +55,5 @@ class GardenOMatic(AbstractRebaseliningCommand):
         httpd = GardeningHTTPServer(httpd_port=8127, config={'tool': tool, 'options': options})
         self._tool.user.open_url(httpd.url(args))
 
-        print "Local HTTP server started."
+        print("Local HTTP server started.")
         httpd.serve_forever()
index f8e109d..eedb083 100644 (file)
@@ -194,7 +194,7 @@ class RebaselineTest(AbstractRebaseliningCommand):
 
     def execute(self, options, args, tool):
         self._rebaseline_test_and_update_expectations(options)
-        print json.dumps(self._scm_changes)
+        print(json.dumps(self._scm_changes))
 
 
 class AbstractParallelRebaselineCommand(AbstractRebaseliningCommand):
index 32acb9f..2cf8015 100644 (file)
@@ -79,7 +79,7 @@ class RebaselineServer(AbstractLocalServerCommand):
         host = Host()
         filesystem = host.filesystem
 
-        print 'Parsing full_results.json...'
+        print('Parsing full_results.json...')
         results_json_path = filesystem.join(results_directory, 'full_results.json')
         results_json = json_results_generator.load_json(filesystem, results_json_path)
 
@@ -88,7 +88,7 @@ class RebaselineServer(AbstractLocalServerCommand):
         platforms = filesystem.listdir(filesystem.join(layout_tests_directory, 'platform'))
         self._test_config = TestConfig(port, layout_tests_directory, results_directory, platforms, scm, host)
 
-        print 'Gathering current baselines...'
+        print('Gathering current baselines...')
         self._gather_baselines(results_json)
 
         return {
index 258df00..51f8e13 100644 (file)
@@ -37,11 +37,11 @@ class SetupGitClone(Command):
 
     def execute(self, options, args, tool):
         if not isinstance(tool.scm(), Git):
-            print "This command only works inside a Git checkout."
+            print("This command only works inside a Git checkout.")
             return
 
         if tool.scm().has_working_directory_changes():
-            print "There are local changes; aborting the command."
+            print("There are local changes; aborting the command.")
             return
 
         username, email = self._get_username_and_email(tool)
@@ -72,9 +72,9 @@ class SetupGitClone(Command):
 
         if tool.user.confirm("Do you want to append the git branch name to every build? (e.g. WebKitBuild/mybranch/; y/n)"):
             run_git(["config", "core.webKitBranchBuild", "true"])
-            print "You can override this option via git config branch.$branchName.webKitBranchBuild (true|false)"
+            print("You can override this option via git config branch.$branchName.webKitBranchBuild (true|false)")
 
-        print "Done"
+        print("Done")
 
     def _get_username_and_email(self, tool):
         try:
@@ -95,5 +95,5 @@ class SetupGitClone(Command):
         except ScriptError as error:
             # VCSUtils prints useful error messages on failure, we shouldn't hide these
             if error.output:
-                print error.output
+                print(error.output)
             raise
index 6afbbbb..0b81ac5 100644 (file)
@@ -255,11 +255,11 @@ class SuggestNominations(AbstractCommitLogCommand):
         for nomination in sorted(nominations, nomination_cmp):
             # This is a little bit of a hack, but its convienent to just pass the nomination dictionary to the formating operator.
             nomination['roles_string'] = grammar.join_with_separators(nomination['roles']).upper()
-            print "%(roles_string)s: %(author_name)s (%(author_email)s) has %(patch_count)s reviewed patches" % nomination
+            print("%(roles_string)s: %(author_name)s (%(author_email)s) has %(patch_count)s reviewed patches" % nomination)
             counter = counters_by_email[nomination['author_email']]
 
             if self.show_commits:
-                print counter['commits']
+                print(counter['commits'])
 
     def _print_counts(self, counters_by_email):
         def counter_cmp(a_tuple, b_tuple):
@@ -288,9 +288,9 @@ class SuggestNominations(AbstractCommitLogCommand):
             for alias in counter['emails']:
                 alias_list.append(alias)
             if alias_list:
-                print "CONTRIBUTOR: %s (%s) has %s %s" % (author_name, author_email, grammar.pluralize(patch_count, "reviewed patch"), "(aliases: " + ", ".join(alias_list) + ")")
+                print("CONTRIBUTOR: %s (%s) has %s %s" % (author_name, author_email, grammar.pluralize(patch_count, "reviewed patch"), "(aliases: " + ", ".join(alias_list) + ")"))
             else:
-                print "CONTRIBUTOR: %s (%s) has %s" % (author_name, author_email, grammar.pluralize(patch_count, "reviewed patch"))
+                print("CONTRIBUTOR: %s (%s) has %s" % (author_name, author_email, grammar.pluralize(patch_count, "reviewed patch")))
         return
 
     def execute(self, options, args, tool):
index 4eb7772..933db2d 100644 (file)
@@ -61,7 +61,7 @@ class CommitMessageForCurrentDiff(Command):
     def execute(self, options, args, tool):
         # This command is a useful test to make sure commit_message_for_this_commit
         # always returns the right value regardless of the current working directory.
-        print "%s" % tool.checkout().commit_message_for_this_commit(options.git_commit).message()
+        print("%s" % tool.checkout().commit_message_for_this_commit(options.git_commit).message())
 
 
 class CleanPendingCommit(Command):
@@ -510,7 +510,7 @@ class CreateBug(Command):
     def prompt_for_bug_title_and_comment(self):
         bug_title = User.prompt("Bug title: ")
         # FIXME: User should provide a function for doing this multi-line prompt.
-        print "Bug comment (hit ^D on blank line to end):"
+        print("Bug comment (hit ^D on blank line to end):")
         lines = sys.stdin.readlines()
         try:
             sys.stdin.seek(0, os.SEEK_END)
index 2ade30d..4790127 100644 (file)
@@ -197,7 +197,7 @@ class HelpCommand(Command):
         if args:
             command = self._tool.command_by_name(args[0])
             if command:
-                print command.standalone_help()
+                print(command.standalone_help())
                 return 0
 
         self.show_all_commands = options.show_all_commands
index 25c3d86..c69fe31 100644 (file)
@@ -73,14 +73,14 @@ class TestGardeningHTTPRequestHandler(GardeningHTTPRequestHandler):
         return self.body if self.body else ''
 
     def _serve_text(self, text):
-        print "== Begin Response =="
-        print text
-        print "== End Response =="
+        print("== Begin Response ==")
+        print(text)
+        print("== End Response ==")
 
     def _serve_json(self, json_object):
-        print "== Begin JSON Response =="
-        print json.dumps(json_object)
-        print "== End JSON Response =="
+        print("== Begin JSON Response ==")
+        print(json.dumps(json_object))
+        print("== End JSON Response ==")
 
 
 class GardeningServerTest(unittest.TestCase):
index 0ef0fed..6a06558 100644 (file)
@@ -69,7 +69,7 @@ class AddSvnMimetypeForPng(AbstractStep):
             elif detection == "svn":
                 for filename in png_files:
                     if self._detector.exists(filename) and self._detector.propget('svn:mime-type', filename) != 'image/png':
-                        print "Adding image/png mime-type to %s" % filename
+                        print("Adding image/png mime-type to %s" % filename)
                         self._detector.propset('svn:mime-type', 'image/png', filename)
 
     def _check_pngs(self, changed_files):
index 40a2482..ddcb733 100644 (file)
@@ -43,8 +43,8 @@ class SuggestReviewers(AbstractStep):
             return
 
         reviewers = self._tool.checkout().suggested_reviewers(self._options.git_commit, self._changed_files(state))[:5]
-        print "The following reviewers have recently modified files in your patch:"
-        print ", ".join([reviewer.full_name for reviewer in reviewers])
+        print("The following reviewers have recently modified files in your patch:")
+        print(", ".join([reviewer.full_name for reviewer in reviewers]))
 
         if not state.get('bug_id'):
             return
index c1d1620..421e363 100644 (file)
@@ -529,7 +529,7 @@ class TestImporter(object):
         should_update = self.options.clean_destination_directory
         for full_path in self._slow_tests:
             w3c_test_path = self.filesystem.relpath(full_path, self.source_directory)
-            print w3c_test_path
+            print(w3c_test_path)
             # No need to mark tests as slow if they are in skipped directories
             if self._already_identified_as_resource_file(w3c_test_path):
                 continue
index 045c1e7..f209d92 100644 (file)
@@ -73,7 +73,7 @@ class WebDriverTestRunnerSelenium(object):
         timeout = self._port.get_option('timeout')
         for test in tests:
             test_name = os.path.relpath(test, self._tests_dir())
-            print test_name
+            print(test_name)
             harness_result, test_results = executor.run(test, timeout)
             result = WebDriverTestResult(test_name, *harness_result)
             if harness_result[0] == 'OK':
index ff0ed19..18ae5f4 100755 (executable)
@@ -30,7 +30,7 @@ try:
     import jsonresults
     from jsonresults import JsonResults
 except ImportError:
-    print "ERROR: Add the TestResultServer, google_appengine and yaml/lib directories to your PYTHONPATH"
+    print("ERROR: Add the TestResultServer, google_appengine and yaml/lib directories to your PYTHONPATH")
     raise
 
 from django.utils import simplejson
index df0fe3d..2b85cc6 100644 (file)
@@ -110,17 +110,17 @@ def FlagsForFile(filename, **kwargs):
 
     build_path = os.path.normpath(get_build_path())
     if not build_path:
-        print "Could not find WebKit build path."
+        print("Could not find WebKit build path.")
         return result
 
     database = ycm_core.CompilationDatabase(build_path)
     if not database:
-        print "Could not find compile_commands.json in %s, You might forget to add CMAKE_EXPORT_COMPILE_COMMANDS=ON to cmakeargs" % build_path
+        print("Could not find compile_commands.json in %s, You might forget to add CMAKE_EXPORT_COMPILE_COMMANDS=ON to cmakeargs" % build_path)
         return result
 
     compilation_info = database.GetCompilationInfoForFile(filename)
     if not compilation_info:
-        print "No compilation info."
+        print("No compilation info.")
         return result
 
     result['flags'] = transform_relative_paths_to_absolute_paths(list(compilation_info.compiler_flags_), compilation_info.compiler_working_dir_)
@@ -130,4 +130,4 @@ def FlagsForFile(filename, **kwargs):
 if __name__ == "__main__":
     import sys
     if len(sys.argv) >= 2:
-        print FlagsForFile(sys.argv[1])
+        print(FlagsForFile(sys.argv[1]))
index dd64ba7..e97ef9a 100644 (file)
@@ -130,7 +130,7 @@ def btjs(debugger, command, result, internal_dict):
         annotateJSFrames = False
 
     if not annotateJSFrames:
-        print "Warning: Can't find JSC::ExecState::describeFrame() in executable to annotate JavaScript frames"
+        print("Warning: Can't find JSC::ExecState::describeFrame() in executable to annotate JavaScript frames")
 
     backtraceDepth = thread.GetNumFrames()
 
@@ -141,7 +141,7 @@ def btjs(debugger, command, result, internal_dict):
             return
 
     threadFormat = '* thread #{num}: tid = {tid:#x}, {pcAddr:' + addressFormat + '}, queue = \'{queueName}, stop reason = {stopReason}'
-    print threadFormat.format(num=thread.GetIndexID(), tid=thread.GetThreadID(), pcAddr=thread.GetFrameAtIndex(0).GetPC(), queueName=thread.GetQueueName(), stopReason=thread.GetStopDescription(30))
+    print(threadFormat.format(num=thread.GetIndexID(), tid=thread.GetThreadID(), pcAddr=thread.GetFrameAtIndex(0).GetPC(), queueName=thread.GetQueueName(), stopReason=thread.GetStopDescription(30)))
 
     for frame in thread:
         if backtraceDepth < 1:
@@ -161,9 +161,9 @@ def btjs(debugger, command, result, internal_dict):
             if JSFrameDescription:
                 JSFrameDescription = string.strip(JSFrameDescription, '"')
                 frameFormat = '    frame #{num}: {addr:' + addressFormat + '} {desc}'
-                print frameFormat.format(num=frame.GetFrameID(), addr=frame.GetPC(), desc=JSFrameDescription)
+                print(frameFormat.format(num=frame.GetFrameID(), addr=frame.GetPC(), desc=JSFrameDescription))
                 continue
-        print '    %s' % frame
+        print('    %s' % frame)
 
 # FIXME: Provide support for the following types:
 # def WTFVector_SummaryProvider(valobj, dict):