[python] Modernize "except" usage for python3 compatibility
authorannulen@yandex.ru <annulen@yandex.ru@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 10 Dec 2017 21:11:18 +0000 (21:11 +0000)
committerannulen@yandex.ru <annulen@yandex.ru@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 10 Dec 2017 21:11:18 +0000 (21:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180612

Reviewed by Michael Catanzaro.

Source/JavaScriptCore:

* inspector/scripts/generate-inspector-protocol-bindings.py:

Tools:

* BuildSlaveSupport/build.webkit.org-config/committer_auth.py:
(CommitterAuth.auth_json):
(CommitterAuth.authenticate):
(CommitterAuth.is_webkit_committer):
(CommitterAuth.is_webkit_trac_user):
* BuildSlaveSupport/wait-for-SVN-server.py:
(getLatestSVNRevision):
* QueueStatusServer/handlers/updatebase.py:
(UpdateBase._int_from_request):
* Scripts/webkitpy/bindings/main.py:
(BindingsTests.generate_from_idl):
(BindingsTests.generate_supplemental_dependency):
(BindingsTests.detect_changes):
* Scripts/webkitpy/codegen/main.py:
(BuiltinsGeneratorTests.generate_from_js_builtins):
(BuiltinsGeneratorTests.detect_changes):
* Scripts/webkitpy/common/checkout/changelog.py:
(ChangeLog.parse_latest_entry_from_file):
* Scripts/webkitpy/common/checkout/checkout.py:
(Checkout.bug_id_for_this_commit):
* Scripts/webkitpy/common/checkout/scm/git.py:
(Git.in_working_directory):
(Git.clone):
(Git._string_to_int_or_none):
(Git._commit_on_branch):
* Scripts/webkitpy/common/checkout/scm/svn.py:
(SVN.revisions_changing_file):
* Scripts/webkitpy/common/config/committers.py:
(CommitterList.load_json):
* Scripts/webkitpy/common/message_pool.py:
(_Worker.run):
* Scripts/webkitpy/common/net/buildbot/buildbot.py:
(Builder.force_build.predicate):
(Builder._fetch_revision_to_build_map):
(BuildBot._fetch_build_dictionary):
* Scripts/webkitpy/common/net/credentials.py:
(Credentials._credentials_from_git):
* Scripts/webkitpy/common/net/networktransaction.py:
(NetworkTransaction.run):
* Scripts/webkitpy/common/net/networktransaction_unittest.py:
(NetworkTransactionTest.test_exception):
(NetworkTransactionTest.test_timeout):
* Scripts/webkitpy/common/net/statusserver.py:
(StatusServer._fetch_url):
* Scripts/webkitpy/common/net/unittestresults.py:
(UnitTestResults.results_from_string):
* Scripts/webkitpy/common/prettypatch.py:
(PrettyPatch.check_pretty_patch):
(PrettyPatch.pretty_patch_text):
* Scripts/webkitpy/common/prettypatch_unittest.py:
(PrettyPatchTest.check_ruby):
* Scripts/webkitpy/common/system/autoinstall.py:
(AutoInstaller._extract_tar):
(AutoInstaller._unzip):
(AutoInstaller._replace_domain_with_next_mirror):
(AutoInstaller._download_to_stream):
(AutoInstaller.install):
* Scripts/webkitpy/common/system/crashlogs.py:
(CrashLogs._find_newest_log_darwin):
(CrashLogs._find_newest_log_win):
(CrashLogs._find_all_logs_darwin):
* Scripts/webkitpy/common/system/executive.py:
(Executive.kill_process):
(Executive.running_pids):
* Scripts/webkitpy/common/system/filesystem.py:
(FileSystem.maybe_make_directory):
(FileSystem.remove):
* Scripts/webkitpy/common/system/user.py:
(User._wait_on_list_response):
(User.edit):
(User.page):
(User.can_open_url):
* Scripts/webkitpy/common/system/workspace.py:
(Workspace.create_zip):
* Scripts/webkitpy/common/watchlist/watchlistparser.py:
(WatchListParser._parse_definition_section):
* Scripts/webkitpy/common/webkitunittest.py:
(TestCase._assertRaisesRegexp):
* Scripts/webkitpy/inspector/main.py:
(InspectorGeneratorTests.generate_from_json):
(InspectorGeneratorTests.detect_changes):
* Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py:
(LayoutTestFinder._read_test_names_from_file):
* Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py:
(LayoutTestRunner.run_tests):
* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager.upload_results):
* Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
(JSONResultsGenerator.upload_json_files):
(JSONResultsGenerator._get_archived_json_results):
* Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
(MiscTests.test_parse_warning):
(SemanticTests.test_bad_bugid):
* Scripts/webkitpy/layout_tests/models/test_run_results.py:
(summarize_results):
* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(main):
* Scripts/webkitpy/layout_tests/servers/http_server.py:
(Lighttpd._remove_stale_logs):
* Scripts/webkitpy/layout_tests/servers/http_server_base.py:
(HttpServerBase._is_running_on_port):
(HttpServerBase._check_that_all_ports_are_available):
* Scripts/webkitpy/layout_tests/servers/http_server_integrationtest.py:
(BaseTest.assert_servers_are_down):
(BaseTest.assert_servers_are_up):
(BaseTest.integration_test_server__fails):
(BaseTest.maybe_make_dir):
* Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py:
(run_server):
* Scripts/webkitpy/layout_tests/servers/web_platform_test_launcher.py:
* Scripts/webkitpy/layout_tests/servers/websocket_server.py:
(PyWebSocket.is_running):
(PyWebSocket._remove_stale_logs):
* Scripts/webkitpy/performance_tests/perftestsrunner.py:
(_merge_slave_config_json):
(_merge_outputs_if_needed):
(_upload_json):
* Scripts/webkitpy/port/base.py:
(Port._build_driver):
(Port._build_image_diff):
(Port._symbols_string):
* Scripts/webkitpy/port/leakdetector.py:
(LeakDetector.count_total_bytes_and_unique_leaks):
(LeakDetector.check_for_leaks):
* Scripts/webkitpy/port/leakdetector_valgrind.py:
(LeakDetectorValgrind._parse_leaks_output):
* Scripts/webkitpy/port/mac.py:
(MacPort.reset_preferences):
(MacPort.stop_helper):
* Scripts/webkitpy/port/port_testcase.py:
(PortTestCase.assert_servers_are_down):
(PortTestCase.assert_servers_are_up):
(PortTestCase.integration_test_http_server__fails):
(PortTestCase.integration_test_websocket_server__fails):
* Scripts/webkitpy/port/server_process.py:
(ServerProcess.write):
(ServerProcess._wait_for_data_and_update_buffers_using_select):
(ServerProcess._non_blocking_read_win32):
* Scripts/webkitpy/port/win.py:
(WinPort._runtime_feature_list):
* Scripts/webkitpy/port/xvfbdriver.py:
(XvfbDriver._xvfb_read_display_id):
* Scripts/webkitpy/style/checkers/jsonchecker.py:
(JSONChecker.check):
* Scripts/webkitpy/style/checkers/xml.py:
(XMLChecker.check):
* Scripts/webkitpy/style/filereader.py:
(TextFileReader.process_file):
* Scripts/webkitpy/style/filereader_unittest.py:
(TextFileReaderTest.test_process_file__does_not_exist):
* Scripts/webkitpy/style/optparser.py:
(ArgumentParser.parse):
* Scripts/webkitpy/tool/bot/irc_command.py:
(CreateBug.execute):
(Rollout.execute):
* Scripts/webkitpy/tool/bot/ircbot.py:
(IRCBot.process_message):
* Scripts/webkitpy/tool/bot/layouttestresultsreader.py:
(LayoutTestResultsReader._read_file_contents):
* Scripts/webkitpy/tool/bot/patchanalysistask.py:
(PatchAnalysisTask._run_command):
* Scripts/webkitpy/tool/bot/queueengine.py:
(QueueEngine.run):
* Scripts/webkitpy/tool/commands/abstractsequencedcommand.py:
(AbstractSequencedCommand.execute):
* Scripts/webkitpy/tool/commands/download.py:
(AbstractPatchSequencingCommand._prepare_to_process):
* Scripts/webkitpy/tool/commands/earlywarningsystem.py:
(AbstractEarlyWarningSystem.review_patch):
* Scripts/webkitpy/tool/commands/queries.py:
(FailureReason._blame_line_for_revision):
* Scripts/webkitpy/tool/commands/queues.py:
(AbstractQueue._cc_watchers):
(AbstractQueue.run_webkit_patch):
(CommitQueue.process_work_item):
(StyleQueue.review_patch):
* Scripts/webkitpy/tool/commands/rebaseline.py:
(AbstractParallelRebaselineCommand._run_webkit_patch):
* Scripts/webkitpy/tool/commands/stepsequence.py:
(StepSequence.run_and_handle_errors):
* Scripts/webkitpy/tool/commands/suggestnominations.py:
(SuggestNominations._count_recent_patches):
* Scripts/webkitpy/tool/multicommandtool.py:
(MultiCommandTool.main):
* Scripts/webkitpy/tool/servers/rebaselineserver.py:
(_rebaseline_test):
(_move_test_baselines):
* Scripts/webkitpy/tool/steps/addsvnmimetypeforpng_unittest.py:
(AddSvnMimetypeForPngTest.test_run):
* Scripts/webkitpy/tool/steps/checkstyle.py:
(CheckStyle.run):
* Scripts/webkitpy/tool/steps/commit.py:
(Commit._check_test_expectations):
(Commit.run):
* Scripts/webkitpy/tool/steps/confirmdiff.py:
(ConfirmDiff._show_pretty_diff):
* Scripts/webkitpy/tool/steps/haslanded.py:
(HasLanded.diff_diff):
* Scripts/webkitpy/tool/steps/preparechangelog.py:
(PrepareChangeLog.run):
* Scripts/webkitpy/tool/steps/promptforbugortitle.py:
(PromptForBugOrTitle.run):
* Scripts/webkitpy/tool/steps/sortxcodeprojectfiles.py:
(SortXcodeProjectFiles.run):
* Scripts/webkitpy/webdriver_tests/webdriver_w3c_web_server.py:
(WebDriverW3CWebServer._wait_for_server.check_port):
* TestResultServer/model/datastorefile.py:
(DataStoreFile.save_data):
* jhbuild/jhbuildutils.py:
(enter_jhbuild_environment_if_available):

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

84 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
Tools/BuildSlaveSupport/build.webkit.org-config/committer_auth.py
Tools/BuildSlaveSupport/wait-for-SVN-server.py
Tools/ChangeLog
Tools/QueueStatusServer/handlers/updatebase.py
Tools/Scripts/webkitpy/bindings/main.py
Tools/Scripts/webkitpy/codegen/main.py
Tools/Scripts/webkitpy/common/checkout/changelog.py
Tools/Scripts/webkitpy/common/checkout/checkout.py
Tools/Scripts/webkitpy/common/checkout/scm/git.py
Tools/Scripts/webkitpy/common/checkout/scm/svn.py
Tools/Scripts/webkitpy/common/config/committers.py
Tools/Scripts/webkitpy/common/message_pool.py
Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py
Tools/Scripts/webkitpy/common/net/credentials.py
Tools/Scripts/webkitpy/common/net/networktransaction.py
Tools/Scripts/webkitpy/common/net/networktransaction_unittest.py
Tools/Scripts/webkitpy/common/net/statusserver.py
Tools/Scripts/webkitpy/common/net/unittestresults.py
Tools/Scripts/webkitpy/common/prettypatch.py
Tools/Scripts/webkitpy/common/prettypatch_unittest.py
Tools/Scripts/webkitpy/common/system/autoinstall.py
Tools/Scripts/webkitpy/common/system/crashlogs.py
Tools/Scripts/webkitpy/common/system/executive.py
Tools/Scripts/webkitpy/common/system/filesystem.py
Tools/Scripts/webkitpy/common/system/user.py
Tools/Scripts/webkitpy/common/system/workspace.py
Tools/Scripts/webkitpy/common/watchlist/watchlistparser.py
Tools/Scripts/webkitpy/common/webkitunittest.py
Tools/Scripts/webkitpy/inspector/main.py
Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py
Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py
Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py
Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
Tools/Scripts/webkitpy/layout_tests/servers/http_server.py
Tools/Scripts/webkitpy/layout_tests/servers/http_server_base.py
Tools/Scripts/webkitpy/layout_tests/servers/http_server_integrationtest.py
Tools/Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py
Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_launcher.py
Tools/Scripts/webkitpy/layout_tests/servers/websocket_server.py
Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py
Tools/Scripts/webkitpy/port/base.py
Tools/Scripts/webkitpy/port/leakdetector.py
Tools/Scripts/webkitpy/port/leakdetector_valgrind.py
Tools/Scripts/webkitpy/port/mac.py
Tools/Scripts/webkitpy/port/port_testcase.py
Tools/Scripts/webkitpy/port/server_process.py
Tools/Scripts/webkitpy/port/win.py
Tools/Scripts/webkitpy/port/xvfbdriver.py
Tools/Scripts/webkitpy/style/checkers/jsonchecker.py
Tools/Scripts/webkitpy/style/checkers/xml.py
Tools/Scripts/webkitpy/style/filereader.py
Tools/Scripts/webkitpy/style/filereader_unittest.py
Tools/Scripts/webkitpy/style/optparser.py
Tools/Scripts/webkitpy/tool/bot/irc_command.py
Tools/Scripts/webkitpy/tool/bot/ircbot.py
Tools/Scripts/webkitpy/tool/bot/layouttestresultsreader.py
Tools/Scripts/webkitpy/tool/bot/patchanalysistask.py
Tools/Scripts/webkitpy/tool/bot/queueengine.py
Tools/Scripts/webkitpy/tool/commands/abstractsequencedcommand.py
Tools/Scripts/webkitpy/tool/commands/download.py
Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py
Tools/Scripts/webkitpy/tool/commands/queries.py
Tools/Scripts/webkitpy/tool/commands/queues.py
Tools/Scripts/webkitpy/tool/commands/rebaseline.py
Tools/Scripts/webkitpy/tool/commands/stepsequence.py
Tools/Scripts/webkitpy/tool/commands/suggestnominations.py
Tools/Scripts/webkitpy/tool/multicommandtool.py
Tools/Scripts/webkitpy/tool/servers/rebaselineserver.py
Tools/Scripts/webkitpy/tool/steps/addsvnmimetypeforpng_unittest.py
Tools/Scripts/webkitpy/tool/steps/checkstyle.py
Tools/Scripts/webkitpy/tool/steps/commit.py
Tools/Scripts/webkitpy/tool/steps/confirmdiff.py
Tools/Scripts/webkitpy/tool/steps/haslanded.py
Tools/Scripts/webkitpy/tool/steps/preparechangelog.py
Tools/Scripts/webkitpy/tool/steps/promptforbugortitle.py
Tools/Scripts/webkitpy/tool/steps/sortxcodeprojectfiles.py
Tools/Scripts/webkitpy/webdriver_tests/webdriver_w3c_web_server.py
Tools/TestResultServer/model/datastorefile.py
Tools/jhbuild/jhbuildutils.py

index 3d07f7c..bb22149 100644 (file)
@@ -1,3 +1,12 @@
+2017-12-10  Konstantin Tokarev  <annulen@yandex.ru>
+
+        [python] Modernize "except" usage for python3 compatibility
+        https://bugs.webkit.org/show_bug.cgi?id=180612
+
+        Reviewed by Michael Catanzaro.
+
+        * inspector/scripts/generate-inspector-protocol-bindings.py:
+
 2017-12-05  Filip Pizlo  <fpizlo@apple.com>
 
         InferredType should not use UnconditionalFinalizer
index 448ab7a..182135e 100755 (executable)
@@ -48,7 +48,7 @@ try:
 
 # When copying generator files to JavaScriptCore's private headers on Mac,
 # the codegen/ module directory is flattened. So, import directly.
-except ImportError, e:
+except ImportError as e:
     # log.error(e) # Uncomment this to debug early import errors.
     import models
     from models import *
index 9ec357a..2cd2b13 100644 (file)
@@ -44,9 +44,9 @@ class CommitterAuth(buildbot.status.web.auth.AuthBase):
         try:
             with self.open_auth_json_file() as f:
                 return json.load(f)
-        except IOError, e:
+        except IOError as e:
             raise Error('Error opening auth.json file: {0}'.format(e.strerror))
-        except ValueError, e:
+        except ValueError as e:
             raise Error('Error parsing auth.json file: {0}'.format(e.message))
 
     def auth_json_filename(self):
@@ -55,7 +55,7 @@ class CommitterAuth(buildbot.status.web.auth.AuthBase):
     def authenticate(self, username, password):
         try:
             return self.is_webkit_committer(username) and self.is_webkit_trac_user(username, password)
-        except Error, e:
+        except Error as e:
             self.err = e.args[0]
             return False
 
@@ -67,14 +67,14 @@ class CommitterAuth(buildbot.status.web.auth.AuthBase):
             return True
         except ConfigParser.Error:
             raise Error('Error parsing WebKit committers file')
-        except IOError, e:
+        except IOError as e:
             raise Error('Error opening WebKit committers file: {0}'.format(e.strerror))
 
     def is_webkit_trac_user(self, username, password):
         try:
             with self.open_trac_credentials_file() as f:
                 htdigest = HTDigestParser(f)
-        except IOError, e:
+        except IOError as e:
             raise Error('Error opening Trac credentials file: {0}'.format(e.strerror))
 
         if not htdigest.entries():
index a550bb0..7bf42f9 100755 (executable)
@@ -39,7 +39,7 @@ def getLatestSVNRevision(SVNServer):
         doc = xml.dom.minidom.parseString(response)
         el = doc.getElementsByTagName("logentry")[0]
         return el.getAttribute("revision")
-    except xml.parsers.expat.ExpatError, e:
+    except xml.parsers.expat.ExpatError as e:
         print("FAILED TO PARSE 'svn log' XML:")
         print(str(e))
         print("----")
index 18bb360..2037472 100644 (file)
@@ -1,3 +1,221 @@
+2017-12-10  Konstantin Tokarev  <annulen@yandex.ru>
+
+        [python] Modernize "except" usage for python3 compatibility
+        https://bugs.webkit.org/show_bug.cgi?id=180612
+
+        Reviewed by Michael Catanzaro.
+
+        * BuildSlaveSupport/build.webkit.org-config/committer_auth.py:
+        (CommitterAuth.auth_json):
+        (CommitterAuth.authenticate):
+        (CommitterAuth.is_webkit_committer):
+        (CommitterAuth.is_webkit_trac_user):
+        * BuildSlaveSupport/wait-for-SVN-server.py:
+        (getLatestSVNRevision):
+        * QueueStatusServer/handlers/updatebase.py:
+        (UpdateBase._int_from_request):
+        * Scripts/webkitpy/bindings/main.py:
+        (BindingsTests.generate_from_idl):
+        (BindingsTests.generate_supplemental_dependency):
+        (BindingsTests.detect_changes):
+        * Scripts/webkitpy/codegen/main.py:
+        (BuiltinsGeneratorTests.generate_from_js_builtins):
+        (BuiltinsGeneratorTests.detect_changes):
+        * Scripts/webkitpy/common/checkout/changelog.py:
+        (ChangeLog.parse_latest_entry_from_file):
+        * Scripts/webkitpy/common/checkout/checkout.py:
+        (Checkout.bug_id_for_this_commit):
+        * Scripts/webkitpy/common/checkout/scm/git.py:
+        (Git.in_working_directory):
+        (Git.clone):
+        (Git._string_to_int_or_none):
+        (Git._commit_on_branch):
+        * Scripts/webkitpy/common/checkout/scm/svn.py:
+        (SVN.revisions_changing_file):
+        * Scripts/webkitpy/common/config/committers.py:
+        (CommitterList.load_json):
+        * Scripts/webkitpy/common/message_pool.py:
+        (_Worker.run):
+        * Scripts/webkitpy/common/net/buildbot/buildbot.py:
+        (Builder.force_build.predicate):
+        (Builder._fetch_revision_to_build_map):
+        (BuildBot._fetch_build_dictionary):
+        * Scripts/webkitpy/common/net/credentials.py:
+        (Credentials._credentials_from_git):
+        * Scripts/webkitpy/common/net/networktransaction.py:
+        (NetworkTransaction.run):
+        * Scripts/webkitpy/common/net/networktransaction_unittest.py:
+        (NetworkTransactionTest.test_exception):
+        (NetworkTransactionTest.test_timeout):
+        * Scripts/webkitpy/common/net/statusserver.py:
+        (StatusServer._fetch_url):
+        * Scripts/webkitpy/common/net/unittestresults.py:
+        (UnitTestResults.results_from_string):
+        * Scripts/webkitpy/common/prettypatch.py:
+        (PrettyPatch.check_pretty_patch):
+        (PrettyPatch.pretty_patch_text):
+        * Scripts/webkitpy/common/prettypatch_unittest.py:
+        (PrettyPatchTest.check_ruby):
+        * Scripts/webkitpy/common/system/autoinstall.py:
+        (AutoInstaller._extract_tar):
+        (AutoInstaller._unzip):
+        (AutoInstaller._replace_domain_with_next_mirror):
+        (AutoInstaller._download_to_stream):
+        (AutoInstaller.install):
+        * Scripts/webkitpy/common/system/crashlogs.py:
+        (CrashLogs._find_newest_log_darwin):
+        (CrashLogs._find_newest_log_win):
+        (CrashLogs._find_all_logs_darwin):
+        * Scripts/webkitpy/common/system/executive.py:
+        (Executive.kill_process):
+        (Executive.running_pids):
+        * Scripts/webkitpy/common/system/filesystem.py:
+        (FileSystem.maybe_make_directory):
+        (FileSystem.remove):
+        * Scripts/webkitpy/common/system/user.py:
+        (User._wait_on_list_response):
+        (User.edit):
+        (User.page):
+        (User.can_open_url):
+        * Scripts/webkitpy/common/system/workspace.py:
+        (Workspace.create_zip):
+        * Scripts/webkitpy/common/watchlist/watchlistparser.py:
+        (WatchListParser._parse_definition_section):
+        * Scripts/webkitpy/common/webkitunittest.py:
+        (TestCase._assertRaisesRegexp):
+        * Scripts/webkitpy/inspector/main.py:
+        (InspectorGeneratorTests.generate_from_json):
+        (InspectorGeneratorTests.detect_changes):
+        * Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py:
+        (LayoutTestFinder._read_test_names_from_file):
+        * Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py:
+        (LayoutTestRunner.run_tests):
+        * Scripts/webkitpy/layout_tests/controllers/manager.py:
+        (Manager.upload_results):
+        * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
+        (JSONResultsGenerator.upload_json_files):
+        (JSONResultsGenerator._get_archived_json_results):
+        * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
+        (MiscTests.test_parse_warning):
+        (SemanticTests.test_bad_bugid):
+        * Scripts/webkitpy/layout_tests/models/test_run_results.py:
+        (summarize_results):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        (main):
+        * Scripts/webkitpy/layout_tests/servers/http_server.py:
+        (Lighttpd._remove_stale_logs):
+        * Scripts/webkitpy/layout_tests/servers/http_server_base.py:
+        (HttpServerBase._is_running_on_port):
+        (HttpServerBase._check_that_all_ports_are_available):
+        * Scripts/webkitpy/layout_tests/servers/http_server_integrationtest.py:
+        (BaseTest.assert_servers_are_down):
+        (BaseTest.assert_servers_are_up):
+        (BaseTest.integration_test_server__fails):
+        (BaseTest.maybe_make_dir):
+        * Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py:
+        (run_server):
+        * Scripts/webkitpy/layout_tests/servers/web_platform_test_launcher.py:
+        * Scripts/webkitpy/layout_tests/servers/websocket_server.py:
+        (PyWebSocket.is_running):
+        (PyWebSocket._remove_stale_logs):
+        * Scripts/webkitpy/performance_tests/perftestsrunner.py:
+        (_merge_slave_config_json):
+        (_merge_outputs_if_needed):
+        (_upload_json):
+        * Scripts/webkitpy/port/base.py:
+        (Port._build_driver):
+        (Port._build_image_diff):
+        (Port._symbols_string):
+        * Scripts/webkitpy/port/leakdetector.py:
+        (LeakDetector.count_total_bytes_and_unique_leaks):
+        (LeakDetector.check_for_leaks):
+        * Scripts/webkitpy/port/leakdetector_valgrind.py:
+        (LeakDetectorValgrind._parse_leaks_output):
+        * Scripts/webkitpy/port/mac.py:
+        (MacPort.reset_preferences):
+        (MacPort.stop_helper):
+        * Scripts/webkitpy/port/port_testcase.py:
+        (PortTestCase.assert_servers_are_down):
+        (PortTestCase.assert_servers_are_up):
+        (PortTestCase.integration_test_http_server__fails):
+        (PortTestCase.integration_test_websocket_server__fails):
+        * Scripts/webkitpy/port/server_process.py:
+        (ServerProcess.write):
+        (ServerProcess._wait_for_data_and_update_buffers_using_select):
+        (ServerProcess._non_blocking_read_win32):
+        * Scripts/webkitpy/port/win.py:
+        (WinPort._runtime_feature_list):
+        * Scripts/webkitpy/port/xvfbdriver.py:
+        (XvfbDriver._xvfb_read_display_id):
+        * Scripts/webkitpy/style/checkers/jsonchecker.py:
+        (JSONChecker.check):
+        * Scripts/webkitpy/style/checkers/xml.py:
+        (XMLChecker.check):
+        * Scripts/webkitpy/style/filereader.py:
+        (TextFileReader.process_file):
+        * Scripts/webkitpy/style/filereader_unittest.py:
+        (TextFileReaderTest.test_process_file__does_not_exist):
+        * Scripts/webkitpy/style/optparser.py:
+        (ArgumentParser.parse):
+        * Scripts/webkitpy/tool/bot/irc_command.py:
+        (CreateBug.execute):
+        (Rollout.execute):
+        * Scripts/webkitpy/tool/bot/ircbot.py:
+        (IRCBot.process_message):
+        * Scripts/webkitpy/tool/bot/layouttestresultsreader.py:
+        (LayoutTestResultsReader._read_file_contents):
+        * Scripts/webkitpy/tool/bot/patchanalysistask.py:
+        (PatchAnalysisTask._run_command):
+        * Scripts/webkitpy/tool/bot/queueengine.py:
+        (QueueEngine.run):
+        * Scripts/webkitpy/tool/commands/abstractsequencedcommand.py:
+        (AbstractSequencedCommand.execute):
+        * Scripts/webkitpy/tool/commands/download.py:
+        (AbstractPatchSequencingCommand._prepare_to_process):
+        * Scripts/webkitpy/tool/commands/earlywarningsystem.py:
+        (AbstractEarlyWarningSystem.review_patch):
+        * Scripts/webkitpy/tool/commands/queries.py:
+        (FailureReason._blame_line_for_revision):
+        * Scripts/webkitpy/tool/commands/queues.py:
+        (AbstractQueue._cc_watchers):
+        (AbstractQueue.run_webkit_patch):
+        (CommitQueue.process_work_item):
+        (StyleQueue.review_patch):
+        * Scripts/webkitpy/tool/commands/rebaseline.py:
+        (AbstractParallelRebaselineCommand._run_webkit_patch):
+        * Scripts/webkitpy/tool/commands/stepsequence.py:
+        (StepSequence.run_and_handle_errors):
+        * Scripts/webkitpy/tool/commands/suggestnominations.py:
+        (SuggestNominations._count_recent_patches):
+        * Scripts/webkitpy/tool/multicommandtool.py:
+        (MultiCommandTool.main):
+        * Scripts/webkitpy/tool/servers/rebaselineserver.py:
+        (_rebaseline_test):
+        (_move_test_baselines):
+        * Scripts/webkitpy/tool/steps/addsvnmimetypeforpng_unittest.py:
+        (AddSvnMimetypeForPngTest.test_run):
+        * Scripts/webkitpy/tool/steps/checkstyle.py:
+        (CheckStyle.run):
+        * Scripts/webkitpy/tool/steps/commit.py:
+        (Commit._check_test_expectations):
+        (Commit.run):
+        * Scripts/webkitpy/tool/steps/confirmdiff.py:
+        (ConfirmDiff._show_pretty_diff):
+        * Scripts/webkitpy/tool/steps/haslanded.py:
+        (HasLanded.diff_diff):
+        * Scripts/webkitpy/tool/steps/preparechangelog.py:
+        (PrepareChangeLog.run):
+        * Scripts/webkitpy/tool/steps/promptforbugortitle.py:
+        (PromptForBugOrTitle.run):
+        * Scripts/webkitpy/tool/steps/sortxcodeprojectfiles.py:
+        (SortXcodeProjectFiles.run):
+        * Scripts/webkitpy/webdriver_tests/webdriver_w3c_web_server.py:
+        (WebDriverW3CWebServer._wait_for_server.check_port):
+        * TestResultServer/model/datastorefile.py:
+        (DataStoreFile.save_data):
+        * jhbuild/jhbuildutils.py:
+        (enter_jhbuild_environment_if_available):
+
 2017-12-09  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         Fix WTF::Hasher tuple expansion with variadic args
index b087e83..5268542 100644 (file)
@@ -36,6 +36,6 @@ class UpdateBase(webapp.RequestHandler):
         try:
             int_value = int(string_value)
             return int_value
-        except ValueError, TypeError:
+        except ValueError as TypeError:
             pass
         return None
index 1bd2a76..3940687 100644 (file)
@@ -65,7 +65,7 @@ class BindingsTests:
             output = self.executive.run_command(cmd)
             if output:
                 print(output)
-        except ScriptError, e:
+        except ScriptError as e:
             print(e.output)
             exit_code = e.exit_code
         return exit_code
@@ -95,7 +95,7 @@ class BindingsTests:
             output = self.executive.run_command(cmd)
             if output:
                 print(output)
-        except ScriptError, e:
+        except ScriptError as e:
             print(e.output)
             exit_code = e.exit_code
         os.remove(idl_files_list[1])
@@ -113,7 +113,7 @@ class BindingsTests:
             exit_code = 0
             try:
                 output = self.executive.run_command(cmd)
-            except ScriptError, e:
+            except ScriptError as e:
                 output = e.output
                 exit_code = e.exit_code
 
index c202ce1..d6e7b6b 100644 (file)
@@ -57,7 +57,7 @@ class BuiltinsGeneratorTests:
             stderr_output = self.executive.run_command(cmd)
             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:
+        except ScriptError as e:
             print(e.output)
             exit_code = e.exit_code
         return exit_code
@@ -80,7 +80,7 @@ class BuiltinsGeneratorTests:
             exit_code = 0
             try:
                 output = self.executive.run_command(cmd)
-            except ScriptError, e:
+            except ScriptError as e:
                 output = e.output
                 exit_code = e.exit_code
 
index cda30c4..41ca0ff 100644 (file)
@@ -308,7 +308,7 @@ class ChangeLog(object):
     def parse_latest_entry_from_file(cls, changelog_file):
         try:
             return next(cls.parse_entries_from_file(changelog_file))
-        except StopIteration, e:
+        except StopIteration as e:
             return None
 
     svn_blame_regexp = re.compile(r'^(\s*(?P<revision>\d+) [^ ]+)\s*(?P<line>.*?\n)')
index f628c47..d1d6099 100644 (file)
@@ -149,7 +149,7 @@ class Checkout(object):
     def bug_id_for_this_commit(self, git_commit, changed_files=None):
         try:
             return parse_bug_id_from_changelog(self.commit_message_for_this_commit(git_commit, changed_files).message())
-        except ScriptError, e:
+        except ScriptError as e:
             pass  # We might not have ChangeLogs.
 
     def apply_patch(self, patch):
index cad57ab..791a842 100644 (file)
@@ -111,7 +111,7 @@ class Git(SCM, SVNRepository):
         try:
             executive = executive or Executive()
             return executive.run_command([cls.executable_name, 'rev-parse', '--is-inside-work-tree'], cwd=path, error_handler=Executive.ignore_error).rstrip() == "true"
-        except OSError, e:
+        except OSError as e:
             # The Windows bots seem to through a WindowsError when git isn't installed.
             return False
 
@@ -120,7 +120,7 @@ class Git(SCM, SVNRepository):
         try:
             executive = executive or Executive()
             return executive.run_command([cls.executable_name, 'clone', '-v', url, directory], error_handler=Executive.ignore_error)
-        except OSError, e:
+        except OSError as e:
             return False
 
     def find_checkout_root(self, path):
@@ -359,7 +359,7 @@ class Git(SCM, SVNRepository):
     def _string_to_int_or_none(self, string):
         try:
             return int(string)
-        except ValueError, e:
+        except ValueError as e:
             return None
 
     @memoized
@@ -472,7 +472,7 @@ class Git(SCM, SVNRepository):
 
             self._run_git(['commit', '-m', message])
             output = self.push_local_commits_to_server(username=username, password=password)
-        except Exception, e:
+        except Exception as e:
             _log.warning("COMMIT FAILED: " + str(e))
             output = "Commit failed."
             commit_succeeded = False
index 5e90e28..3cf3336 100644 (file)
@@ -243,7 +243,7 @@ class SVN(SCM, SVNRepository):
         log_command = ['log', '--quiet', '--limit=%s' % limit, path]
         try:
             log_output = self._run_svn(log_command, cwd=self.checkout_root)
-        except ScriptError, e:
+        except ScriptError as e:
             return []
         for line in log_output.splitlines():
             match = re.search('^r(?P<revision>\d+) ', line)
index 66a0a65..ed927ba 100644 (file)
@@ -194,7 +194,7 @@ class CommitterList(object):
         json_path = filesystem.join(filesystem.dirname(filesystem.path_to_module('webkitpy.common.config')), 'contributors.json')
         try:
             contributors = json.loads(filesystem.read_text_file(json_path))
-        except ValueError, e:
+        except ValueError as e:
             sys.exit('contributors.json is malformed: ' + str(e))
 
         self._contributors = []
index b639520..7523c4b 100644 (file)
@@ -263,9 +263,9 @@ class _Worker(multiprocessing.Process):
             _log.debug("%s exiting" % self.name)
         except Queue.Empty:
             assert False, '%s: ran out of messages in worker queue.' % self.name
-        except KeyboardInterrupt, e:
+        except KeyboardInterrupt as e:
             self._raise(sys.exc_info())
-        except Exception, e:
+        except Exception as e:
             self._raise(sys.exc_info())
         finally:
             try:
index 9f0566c..614d3e4 100644 (file)
@@ -128,7 +128,7 @@ class Builder(object):
         def predicate(form):
             try:
                 return form.find_control("username")
-            except Exception, e:
+            except Exception as e:
                 return False
 
         if not self._browser:
@@ -161,7 +161,7 @@ class Builder(object):
             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:
+        except urllib2.HTTPError as error:
             if error.code != 404:
                 raise
             _log.debug("Revision/build list failed to load.")
@@ -364,11 +364,11 @@ class BuildBot(object):
         json_url = "%s/json/builders/%s/builds/%s?filter=1" % (self.buildbot_url, urllib.quote(builder.name()), build_number)
         try:
             return json.load(urllib2.urlopen(json_url))
-        except urllib2.URLError, err:
+        except urllib2.URLError as err:
             build_url = Build.build_url(builder, build_number)
             _log.error("Error fetching data for %s build %s (%s, json: %s): %s" % (builder.name(), build_number, build_url, json_url, err))
             return None
-        except ValueError, err:
+        except ValueError as err:
             build_url = Build.build_url(builder, build_number)
             _log.error("Error decoding json data from %s: %s" % (build_url, err))
             return None
index 4a579cb..a8929fa 100644 (file)
@@ -59,7 +59,7 @@ class Credentials(object):
                 return (None, None)
             return (Git.read_git_config(self.git_prefix + "username"),
                     Git.read_git_config(self.git_prefix + "password"))
-        except OSError, e:
+        except OSError as e:
             # Catch and ignore OSError exceptions such as "no such file
             # or directory" (OSError errno 2), which imply that the Git
             # command cannot be found/is not installed.
index 60acaab..86daee1 100644 (file)
@@ -51,7 +51,7 @@ class NetworkTransaction(object):
         while True:
             try:
                 return request()
-            except urllib2.HTTPError, e:
+            except urllib2.HTTPError as e:
                 if self._convert_404_to_None and e.code == 404:
                     return None
                 self._check_for_timeout()
index 6caab82..1bb4676 100644 (file)
@@ -49,7 +49,7 @@ class NetworkTransactionTest(LoggingTestCase):
         try:
             transaction.run(lambda: self._raise_exception())
             did_throw_exception = False
-        except Exception, e:
+        except Exception as e:
             did_process_exception = True
             self.assertEqual(e, self.exception)
         self.assertTrue(did_throw_exception)
@@ -88,7 +88,7 @@ class NetworkTransactionTest(LoggingTestCase):
         try:
             transaction.run(lambda: self._raise_500_error())
             did_throw_exception = False
-        except NetworkTimeout, e:
+        except NetworkTimeout as e:
             did_process_exception = True
         self.assertTrue(did_throw_exception)
         self.assertTrue(did_process_exception)
index 2037aff..c07ab65 100644 (file)
@@ -167,7 +167,7 @@ class StatusServer:
         # FIXME: This should use NetworkTransaction's 404 handling instead.
         try:
             return urllib2.urlopen(url, timeout=300).read()
-        except urllib2.HTTPError, e:
+        except urllib2.HTTPError as e:
             if e.code == 404:
                 return None
             raise e
index b616c09..f05a822 100644 (file)
@@ -46,6 +46,6 @@ class UnitTestResults(object):
                     classname = testcase.getAttribute('classname')
                     failures.append("%s.%s" % (classname, testname))
             return failures
-        except xml.parsers.expat.ExpatError, e:
+        except xml.parsers.expat.ExpatError as e:
             _log.error("XML error %s parsing unit test output" % str(e))
             return None
index dbc5cea..5768ceb 100644 (file)
@@ -81,7 +81,7 @@ class PrettyPatch(object):
         """Checks whether we can use the PrettyPatch ruby script."""
         try:
             _ = self._executive.run_command(['ruby', '--version'])
-        except OSError, e:
+        except OSError as e:
             if e.errno in [errno.ENOENT, errno.EACCES, errno.ECHILD]:
                 if logging:
                     _log.warning("Ruby is not installed; can't generate pretty patches.")
@@ -107,12 +107,12 @@ class PrettyPatch(object):
             # Diffs are treated as binary (we pass decode_output=False) as they
             # may contain multiple files of conflicting encodings.
             return self._executive.run_command(command, decode_output=False)
-        except OSError, e:
+        except OSError as e:
             # If the system is missing ruby log the error and stop trying.
             self.ppatch_available = False
             _log.error("Failed to run PrettyPatch (%s): %s" % (command, e))
             return self.pretty_patch_error_html
-        except ScriptError, e:
+        except ScriptError as e:
             # If ruby failed to run for some reason, log the command
             # output and stop trying.
             self.ppatch_available = False
index 0a0a77f..94399d6 100644 (file)
@@ -39,7 +39,7 @@ class PrettyPatchTest(unittest.TestCase):
         executive = Executive()
         try:
             result = executive.run_command(['ruby', '--version'])
-        except OSError, e:
+        except OSError as e:
             return False
         return True
 
index 84ca7b0..84d4064 100644 (file)
@@ -218,7 +218,7 @@ class AutoInstaller(object):
 
         try:
             tar_file = tarfile.open(path)
-        except tarfile.ReadError, err:
+        except tarfile.ReadError as err:
             # Append existing Error message to new Error.
             message = ("Could not open tar file: %s\n"
                        " The file probably does not have the correct format.\n"
@@ -268,7 +268,7 @@ class AutoInstaller(object):
 
         try:
             zip_file = zipfile.ZipFile(path, "r")
-        except zipfile.BadZipfile, err:
+        except zipfile.BadZipfile as err:
             message = ("Could not open zip file: %s\n"
                        " --> Inner message: %s"
                        % (path, err))
@@ -344,7 +344,7 @@ class AutoInstaller(object):
                 if regex.match(parsed_url[1]):
                     parsed_url[1] = addresses.next()
                     new_url = urlparse.urlunparse(parsed_url)
-        except StopIteration, e:
+        except StopIteration as e:
             _log.info('Ran out of mirrors.')
 
         return new_url
@@ -356,7 +356,7 @@ class AutoInstaller(object):
             try:
                 netstream = urllib2.urlopen(url, timeout=30)
                 break
-            except IOError, err:
+            except IOError as err:
                 # Try multiple times
                 if failures < 2:
                     _log.warning("Failed to download %s, %s retrying" % (
@@ -508,7 +508,7 @@ class AutoInstaller(object):
                           url=url,
                           url_subpath=url_subpath,
                           files_to_remove=files_to_remove)
-        except Exception, err:
+        except Exception as err:
             # Append existing Error message to new Error.
             message = ("Error auto-installing the %s package to:\n"
                        ' "%s"\n'
index 812d9ac..75da66c 100644 (file)
@@ -86,10 +86,10 @@ class CrashLogs(object):
                     parsed_name, parsed_pid, log_contents = self._parse_darwin_crash_log(path)
                     if parsed_name == process_name and (pid is None or parsed_pid == pid):
                         return errors + log_contents
-            except IOError, e:
+            except IOError as e:
                 if include_errors:
                     errors += "ERROR: Failed to read '%s': %s\n" % (path, str(e))
-            except OSError, e:
+            except OSError as e:
                 if include_errors:
                     errors += "ERROR: Failed to read '%s': %s\n" % (path, str(e))
 
@@ -119,15 +119,15 @@ class CrashLogs(object):
                     # Note: This output comes from a program that shows PID in hex:
                     if int(match.group('pid'), 16) == pid:
                         return errors + log_file
-            except IOError, e:
+            except IOError as e:
                 print("IOError %s" % str(e))
                 if include_errors:
                     errors += u"ERROR: Failed to read '%s': %s\n" % (path, str(e))
-            except OSError, e:
+            except OSError as e:
                 print("OSError %s" % str(e))
                 if include_errors:
                     errors += u"ERROR: Failed to read '%s': %s\n" % (path, str(e))
-            except UnicodeDecodeError, e:
+            except UnicodeDecodeError as e:
                 print("UnicodeDecodeError %s" % str(e))
                 if include_errors:
                     errors += u"ERROR: Failed to decode '%s' as ascii: %s\n" % (path, str(e))
@@ -174,10 +174,10 @@ class CrashLogs(object):
                         unique_name = result_name + '-' + str(count)
                         count += 1
                     crash_logs[unique_name] = errors + log_contents
-            except IOError, e:
+            except IOError as e:
                 if include_errors:
                     errors += "ERROR: Failed to read '%s': %s\n" % (path, str(e))
-            except OSError, e:
+            except OSError as e:
                 if include_errors:
                     errors += "ERROR: Failed to read '%s': %s\n" % (path, str(e))
 
index a29ccc4..a2ab985 100644 (file)
@@ -189,7 +189,7 @@ class Executive(AbstractExecutive):
                 # already exited, and forcefully kill it if SIGTERM wasn't enough.
                 os.kill(pid, signal.SIGTERM)
                 os.kill(pid, signal.SIGKILL)
-            except OSError, e:
+            except OSError as e:
                 if e.errno == errno.EAGAIN:
                     if retries_left <= 0:
                         _log.warn("Failed to kill pid %s.  Too many EAGAIN errors." % pid)
@@ -279,7 +279,7 @@ class Executive(AbstractExecutive):
                     if process_name_filter(process_name):
                         running_pids.append(int(pid))
                         self.pid_to_system_pid[int(pid)] = int(winpid)
-                except ValueError, e:
+                except ValueError as e:
                     pass
         else:
             ps_process = self.popen(['ps', '-eo', 'pid,comm'], stdout=self.PIPE, stderr=self.PIPE)
@@ -291,7 +291,7 @@ class Executive(AbstractExecutive):
                     pid, process_name = line.strip().split(' ', 1)
                     if process_name_filter(process_name):
                         running_pids.append(int(pid))
-                except ValueError, e:
+                except ValueError as e:
                     pass
 
         return sorted(running_pids)
index 9ff97c9..1438735 100644 (file)
@@ -199,7 +199,7 @@ class FileSystem(object):
         """Create the specified directory if it doesn't already exist."""
         try:
             os.makedirs(self.join(*path))
-        except OSError, e:
+        except OSError as e:
             if e.errno != errno.EEXIST:
                 raise
 
@@ -287,7 +287,7 @@ class FileSystem(object):
             try:
                 osremove(path)
                 return True
-            except exceptions.WindowsError, e:
+            except exceptions.WindowsError as e:
                 time.sleep(sleep_interval)
                 retry_timeout_sec -= sleep_interval
                 if retry_timeout_sec < 0:
index 4400c02..e513ecb 100644 (file)
@@ -102,14 +102,14 @@ class User(object):
                             indices += range(int(parts[0]) - 1, int(parts[1]))
                         else:
                             indices.append(int(value) - 1)
-                except ValueError, err:
+                except ValueError as err:
                     continue
 
                 return [list_items[i] for i in indices]
             else:
                 try:
                     result = int(cls.prompt("Enter a number: ", raw_input=raw_input)) - 1
-                except ValueError, err:
+                except ValueError as err:
                     continue
                 return list_items[result]
 
@@ -128,7 +128,7 @@ class User(object):
         # Note: Not thread safe: http://bugs.python.org/issue2320
         try:
             subprocess.call(args + files)
-        except OSError, e:
+        except OSError as e:
             _log.warn("There was a problem editing the ChangeLog using editor '%s': %s." % (editor, e))
 
     def _warn_if_application_is_xcode(self, edit_application):
@@ -153,7 +153,7 @@ class User(object):
             # Note: Not thread safe: http://bugs.python.org/issue2320
             child_process = subprocess.Popen([pager], stdin=subprocess.PIPE)
             child_process.communicate(input=message)
-        except IOError, e:
+        except IOError as e:
             pass
 
     def confirm(self, message=None, default=DEFAULT_YES, raw_input=raw_input):
@@ -169,7 +169,7 @@ class User(object):
         try:
             webbrowser.get()
             return True
-        except webbrowser.Error, e:
+        except webbrowser.Error as e:
             return False
 
     def open_url(self, url):
index 1d92aca..3135869 100644 (file)
@@ -66,7 +66,7 @@ class Workspace(object):
         # So, for now we depend on the environment having "zip" installed (likely fails on Win32)
         try:
             self._executive.run_command(['zip', '-9', '-r', zip_path, '.'], cwd=source_path)
-        except ScriptError, e:
+        except ScriptError as e:
             _log.error("Workspace.create_zip failed in %s:\n%s" % (source_path, e.message_with_output()))
             return None
 
index b6e305f..a1b3e7f 100644 (file)
@@ -111,7 +111,7 @@ class WatchListParser(object):
 
                 try:
                     compiled_regex = re.compile(definition[pattern_type])
-                except Exception, e:
+                except Exception as e:
                     self._log_error('The regex "%s" is invalid due to "%s".' % (definition[pattern_type], str(e)))
                     continue
 
index 1902e71..bcd1e69 100644 (file)
@@ -37,7 +37,7 @@ class TestCase(unittest.TestCase):
         try:
             callable(*args)
             self.assertTrue(False, 'No assert raised.')
-        except Exception, exception:
+        except Exception as exception:
             self.assertTrue(issubclass(exception.__class__, expected_exception),
                             'Exception type was unexpected.')
             self.assertTrue(re.match(regex_message, exception.__str__()),
index a71a393..1462d80 100644 (file)
@@ -53,7 +53,7 @@ class InspectorGeneratorTests:
             stderr_output = self.executive.run_command(cmd)
             if stderr_output:
                 self.write_error_file(json_file, output_directory, stderr_output)
-        except ScriptError, e:
+        except ScriptError as e:
             print(e.output)
             exit_code = e.exit_code
         return exit_code
@@ -76,7 +76,7 @@ class InspectorGeneratorTests:
             exit_code = 0
             try:
                 output = self.executive.run_command(cmd)
-            except ScriptError, e:
+            except ScriptError as e:
                 output = e.output
                 exit_code = e.exit_code
 
index 64fd667..8a6f9f7 100644 (file)
@@ -99,7 +99,7 @@ class LayoutTestFinder(object):
                     line = self._strip_comments(line)
                     if line:
                         tests.append(line)
-            except IOError, e:
+            except IOError as e:
                 if e.errno == errno.ENOENT:
                     _log.critical('')
                     _log.critical('--test-list file "%s" not found' % file)
index 2609a6d..05f9051 100644 (file)
@@ -121,14 +121,14 @@ class LayoutTestRunner(object):
         try:
             with message_pool.get(self, self._worker_factory, num_workers, self._port.worker_startup_delay_secs(), self._port.host) as pool:
                 pool.run(('test_list', shard.name, shard.test_inputs) for shard in all_shards)
-        except TestRunInterruptedException, e:
+        except TestRunInterruptedException as e:
             _log.warning(e.reason)
             run_results.interrupted = True
         except KeyboardInterrupt:
             self._printer.flush()
             self._printer.writeln('Interrupted, exiting ...')
             run_results.keyboard_interrupted = True
-        except Exception, e:
+        except Exception as e:
             _log.debug('%s("%s") raised, exiting' % (e.__class__.__name__, str(e)))
             raise
 
index b69a005..99825de 100644 (file)
@@ -504,7 +504,7 @@ class Manager(object):
                 response_text = response.read()
                 try:
                     response_json = json.loads(response_text)
-                except ValueError, error:
+                except ValueError as error:
                     _log.error("JSON upload failed; failed to parse the response: %s", response_text)
                     continue
 
@@ -513,7 +513,7 @@ class Manager(object):
                     continue
 
                 _log.info("JSON uploaded.")
-            except Exception, error:
+            except Exception as error:
                 _log.error("Upload failed: %s" % error)
                 continue
 
index 1ed3512..76918e0 100644 (file)
@@ -328,7 +328,7 @@ class JSONResultsGenerator(object):
                         _log.debug("JSON upload failed, %d: '%s'" % (response.code, response.read()))
                 else:
                     _log.error("JSON upload failed; no response returned")
-            except Exception, err:
+            except Exception as err:
                 _log.error("Upload failed: %s" % err)
                 continue
 
@@ -419,12 +419,12 @@ class JSONResultsGenerator(object):
             results_file = urllib2.urlopen(results_file_url)
             info = results_file.info()
             old_results = results_file.read()
-        except urllib2.HTTPError, http_error:
+        except urllib2.HTTPError as http_error:
             # A non-4xx status code means the bot is hosed for some reason
             # and we can't grab the results.json file off of it.
             if (http_error.code < 400 and http_error.code >= 500):
                 error = http_error
-        except urllib2.URLError, url_error:
+        except urllib2.URLError as url_error:
             error = url_error
 
         if old_results:
index 639005b..e1050f0 100644 (file)
@@ -168,7 +168,7 @@ class MiscTests(Base):
                 "Bug(rniwa) non-existent-test.html [ Failure ]\n"
                 "Bug(rniwa) disabled-test.html-disabled [ ImageOnlyFailure ]", is_lint_mode=True)
             self.assertFalse(True, "ParseError wasn't raised")
-        except ParseError, e:
+        except ParseError as e:
             warnings = ("expectations:1 Unrecognized modifier 'foo' failures/expected/text.html\n"
                         "expectations:2 Path does not exist. non-existent-test.html")
             self.assertEqual(str(e), warnings)
@@ -369,7 +369,7 @@ class SemanticTests(Base):
         try:
             self.parse_exp('BUG1234 failures/expected/text.html [ Failure ]', is_lint_mode=True)
             self.fail('should have raised an error about a bad bug identifier')
-        except ParseError, exp:
+        except ParseError as exp:
             self.assertEqual(len(exp.warnings), 1)
 
     def test_missing_bugid(self):
index 8987020..5021a2f 100644 (file)
@@ -304,7 +304,7 @@ def summarize_results(port_obj, expectations, initial_results, retry_results, en
         if port_obj.get_option("builder_name"):
             port_obj.host.initialize_scm()
             results['revision'] = port_obj.host.scm().head_svn_revision()
-    except Exception, e:
+    except Exception as e:
         _log.warn("Failed to determine svn revision for checkout (cwd: %s, webkit_base: %s), leaving 'revision' key blank in full_results.json.\n%s" % (port_obj._filesystem.getcwd(), port_obj.path_from_webkit_base(), e))
         # Handle cases where we're running outside of version control.
         import traceback
index 5d67d97..c69d8b3 100755 (executable)
@@ -69,7 +69,7 @@ def main(argv, stdout, stderr):
 
     try:
         port = host.port_factory.get(options.platform, options)
-    except NotImplementedError, e:
+    except NotImplementedError as e:
         # FIXME: is this the best way to handle unsupported port names?
         print(str(e), file=stderr)
         return EXCEPTIONAL_EXIT_STATUS
index 4ea6384..0e47680 100644 (file)
@@ -193,7 +193,7 @@ class Lighttpd(http_server_base.HttpServerBase):
         for log_prefix in ('access.log-', 'error.log-'):
             try:
                 self._remove_log_files(self._output_dir, log_prefix)
-            except OSError, e:
+            except OSError as e:
                 _log.warning('Failed to remove old %s %s files' % (self._name, log_prefix))
 
     def _spawn_process(self):
index 9d9d8ba..19acd7b 100644 (file)
@@ -210,7 +210,7 @@ class HttpServerBase(object):
         try:
             s.connect(('localhost', port))
             _log.debug("Server running on %d" % port)
-        except IOError, e:
+        except IOError as e:
             if e.errno not in (errno.ECONNREFUSED, errno.ECONNRESET):
                 raise
             _log.debug("Server NOT running on %d: %s" % (port, e))
@@ -226,7 +226,7 @@ class HttpServerBase(object):
             port = mapping['port']
             try:
                 s.bind(('localhost', port))
-            except IOError, e:
+            except IOError as e:
                 if e.errno in (errno.EALREADY, errno.EADDRINUSE):
                     raise ServerError('Port %d is already in use.' % port)
                 elif sys.platform.startswith('win') and e.errno in (errno.WSAEACCES,):  # pylint: disable=E1101
index 70f48b5..6c9fc2b 100644 (file)
@@ -54,7 +54,7 @@ class BaseTest(unittest.TestCase):
                 test_socket = socket.socket()
                 test_socket.connect((self.HOST, port))
                 self.fail()
-            except IOError, e:
+            except IOError as e:
                 self.assertTrue(e.errno in (errno.ECONNREFUSED, errno.ECONNRESET))
             finally:
                 test_socket.close()
@@ -65,7 +65,7 @@ class BaseTest(unittest.TestCase):
             try:
                 test_socket = socket.socket()
                 test_socket.connect((self.HOST, port))
-            except IOError, e:
+            except IOError as e:
                 self.fail('failed to connect to %s:%d' % (self.HOST, port))
             finally:
                 test_socket.close()
@@ -95,7 +95,7 @@ class BaseTest(unittest.TestCase):
             try:
                 try:
                     test_socket.bind((self.HOST, port_number))
-                except socket.error, e:
+                except socket.error as e:
                     if e.errno in (errno.EADDRINUSE, errno.EALREADY):
                         self.fail('could not bind to port %d: %s' % (port_number, str(e)))
                     raise
@@ -110,7 +110,7 @@ class BaseTest(unittest.TestCase):
     def maybe_make_dir(self, *comps):
         try:
             os.makedirs(os.path.join(*comps))
-        except OSError, e:
+        except OSError as e:
             if e.errno != errno.EEXIST:
                 raise
 
index 6b05d9b..4e7e945 100755 (executable)
@@ -64,7 +64,7 @@ def run_server(options, args, stdout, stderr):
 
     try:
         port = host.port_factory.get(options.platform, options)
-    except NotImplementedError, e:
+    except NotImplementedError as e:
         print(str(e), file=stderr)
         return EXCEPTIONAL_EXIT_STATUS
 
index a5cf44e..74d8651 100755 (executable)
@@ -15,7 +15,7 @@ try:
     import tools.serve.serve as WebPlatformTestServer
     sys.path.insert(0, os.path.join(os.getcwd(), "tools", "wptserve", "wptserve"))
     import stash
-except ImportError, e:
+except ImportError as e:
     logger.critical("Import of wpt serve module failed.\n"
         "Please check that the file serve.py is present in the web-platform-tests folder.\n"
         "Please also check that __init__.py files in the web-platform-tests/tools folder and subfolders are also present.")
index 349b5be..4d4f5b7 100644 (file)
@@ -112,7 +112,7 @@ class PyWebSocket(http_server.Lighttpd):
         s = socket.socket()
         try:
             s.connect(('localhost', self._port))
-        except IOError, e:
+        except IOError as e:
             if e.errno not in (errno.ECONNREFUSED, errno.ECONNRESET):
                 raise
             return False
@@ -172,7 +172,7 @@ class PyWebSocket(http_server.Lighttpd):
     def _remove_stale_logs(self):
         try:
             self._remove_log_files(self._output_dir, self._log_prefix)
-        except OSError, e:
+        except OSError as e:
             _log.warning('Failed to remove stale %s log files: %s' % (self._name, str(e)))
 
     def _spawn_process(self):
index 87e34d4..b79fe3e 100644 (file)
@@ -327,7 +327,7 @@ class PerfTestsRunner(object):
             for key in slave_config:
                 contents['builder' + key.capitalize()] = slave_config[key]
             return contents
-        except Exception, error:
+        except Exception as error:
             _log.error("Failed to merge slave configuration JSON file %s: %s" % (slave_config_json_path, error))
         return None
 
@@ -337,7 +337,7 @@ class PerfTestsRunner(object):
         try:
             existing_outputs = json.loads(self._host.filesystem.read_text_file(output_json_path))
             return existing_outputs + [output]
-        except Exception, error:
+        except Exception as error:
             _log.error("Failed to merge output JSON file %s: %s" % (output_json_path, error))
         return None
 
@@ -349,7 +349,7 @@ class PerfTestsRunner(object):
         uploader = file_uploader(url, 120)
         try:
             response = uploader.upload_single_text_file(self._host.filesystem, 'application/json', json_path)
-        except Exception, error:
+        except Exception as error:
             _log.error("Failed to upload JSON file to %s in 120s: %s" % (url, error))
             return False
 
index 62a9b78..3952c15 100644 (file)
@@ -1434,7 +1434,7 @@ class Port(object):
             self._run_script("build-dumprendertree", args=self._build_driver_flags(), env=env)
             if self.get_option('webkit_test_runner'):
                 self._run_script("build-webkittestrunner", args=self._build_driver_flags(), env=env)
-        except ScriptError, e:
+        except ScriptError as e:
             _log.error(e.message_with_output(output_limit=None))
             return False
         return True
@@ -1444,7 +1444,7 @@ class Port(object):
         env = environment.to_dictionary()
         try:
             self._run_script("build-imagediff", env=env)
-        except ScriptError, e:
+        except ScriptError as e:
             _log.error(e.message_with_output(output_limit=None))
             return False
         return True
@@ -1486,7 +1486,7 @@ class Port(object):
         for path_to_module in self._modules_to_search_for_symbols():
             try:
                 symbols += self._executive.run_command([self.nm_command(), path_to_module], error_handler=self._executive.ignore_error)
-            except OSError, e:
+            except OSError as e:
                 _log.warn("Failed to run nm: %s.  Can't determine supported features correctly." % e)
         return symbols
 
index 5a9b5f5..dc4ee53 100644 (file)
@@ -92,7 +92,7 @@ class LeakDetector(object):
         ] + leak_files
         try:
             parse_malloc_history_output = self._port._run_script("parse-malloc-history", args, include_configuration_arguments=False)
-        except ScriptError, e:
+        except ScriptError as e:
             _log.warn("Failed to parse leaks output: %s" % e.message_with_output())
             return
 
@@ -118,7 +118,7 @@ class LeakDetector(object):
             # thus we pass decode_output=False.  Without this code we've seen errors like:
             # "UnicodeDecodeError: 'utf8' codec can't decode byte 0x88 in position 779874: unexpected code byte"
             leaks_output = self._port._run_script("run-leaks", self._leaks_args(process_pid), include_configuration_arguments=False, decode_output=False)
-        except ScriptError, e:
+        except ScriptError as e:
             _log.warn("Failed to run leaks tool: %s" % e.message_with_output())
             return
 
index d0618a9..9513e2a 100644 (file)
@@ -220,7 +220,7 @@ class LeakDetectorValgrind(object):
     def _parse_leaks_output(self, leaks_output):
         try:
             parsed_string = parseString(leaks_output)
-        except ExpatError, e:
+        except ExpatError as e:
             parse_failed = True
             _log.error("could not parse %s: %s" % (leaks_output, e))
             return
index e10abe1..42fad97 100644 (file)
@@ -221,7 +221,7 @@ class MacPort(DarwinPort):
         for domain in ["DumpRenderTree", "WebKitTestRunner"]:
             try:
                 self._executive.run_command(["defaults", "delete", domain])
-            except ScriptError, e:
+            except ScriptError as e:
                 # 'defaults' returns 1 if the domain did not exist
                 if e.exit_code != 1:
                     raise e
@@ -233,7 +233,7 @@ class MacPort(DarwinPort):
                 self._helper.stdin.write("x\n")
                 self._helper.stdin.close()
                 self._helper.wait()
-            except IOError, e:
+            except IOError as e:
                 _log.debug("IOError raised while stopping helper: %s" % str(e))
             self._helper = None
 
index 9d29299..91087b7 100644 (file)
@@ -144,7 +144,7 @@ class PortTestCase(unittest.TestCase):
                 test_socket = socket.socket()
                 test_socket.connect((host, port))
                 self.fail()
-            except IOError, e:
+            except IOError as e:
                 self.assertTrue(e.errno in (errno.ECONNREFUSED, errno.ECONNRESET))
             finally:
                 test_socket.close()
@@ -154,7 +154,7 @@ class PortTestCase(unittest.TestCase):
             try:
                 test_socket = socket.socket()
                 test_socket.connect((host, port))
-            except IOError, e:
+            except IOError as e:
                 self.fail('failed to connect to %s:%d' % (host, port))
             finally:
                 test_socket.close()
@@ -186,14 +186,14 @@ class PortTestCase(unittest.TestCase):
             try:
                 try:
                     test_socket.bind(('localhost', port_number))
-                except socket.error, e:
+                except socket.error as e:
                     if e.errno in (errno.EADDRINUSE, errno.EALREADY):
                         self.fail('could not bind to port %d' % port_number)
                     raise
                 try:
                     port.start_http_server()
                     self.fail('should not have been able to start the server while bound to %d' % port_number)
-                except http_server_base.ServerError, e:
+                except http_server_base.ServerError as e:
                     pass
             finally:
                 port.stop_http_server()
@@ -360,7 +360,7 @@ class PortTestCase(unittest.TestCase):
                 try:
                     port.start_websocket_server()
                     self.fail('should not have been able to start the server while bound to %d' % port_number)
-                except http_server_base.ServerError, e:
+                except http_server_base.ServerError as e:
                     pass
             finally:
                 port.stop_websocket_server()
index e690ac4..118b7c0 100644 (file)
@@ -166,7 +166,7 @@ class ServerProcess(object):
             self._start()
         try:
             self._proc.stdin.write(bytes)
-        except IOError, e:
+        except IOError as e:
             self.stop(0.0)
             # stop() calls _reset(), so we have to set crashed to True after calling stop()
             # unless we already know that this is a timeout.
@@ -255,7 +255,7 @@ class ServerProcess(object):
         select_fds = (out_fd, err_fd)
         try:
             read_fds, _, _ = select.select(select_fds, [], select_fds, max(deadline - time.time(), 0))
-        except select.error, e:
+        except select.error as e:
             # We can ignore EINVAL since it's likely the process just crashed and we'll
             # figure that out the next time through the loop in _read().
             # We also ignore EINTR as we can resume reading the next time
@@ -283,7 +283,7 @@ class ServerProcess(object):
                     _log.debug('This test marked as a crash because of no data while reading stdout for the server process.')
                     self._crashed = True
                 self._error += data
-        except IOError, e:
+        except IOError as e:
             # We can ignore the IOErrors because we will detect if the subporcess crashed
             # the next time through the loop in _read()
             pass
@@ -314,7 +314,7 @@ class ServerProcess(object):
             if avail > 0:
                 _, buf = win32file.ReadFile(handle, avail, None)
                 return buf
-        except Exception, e:
+        except Exception as e:
             if e[0] not in (109, errno.ESHUTDOWN):  # 109 == win32 ERROR_BROKEN_PIPE
                 raise
         return None
index ae9781c..12b6e16 100644 (file)
@@ -139,7 +139,7 @@ class WinPort(ApplePort):
         supported_features_command = [self._path_to_driver(), '--print-supported-features']
         try:
             output = self._executive.run_command(supported_features_command, error_handler=Executive.ignore_error)
-        except OSError, e:
+        except OSError as e:
             _log.warn("Exception running driver: %s, %s.  Driver must be built before calling WebKitPort.test_expectations()." % (supported_features_command, e))
             return None
 
index 80d6748..a6f5ad1 100644 (file)
@@ -60,7 +60,7 @@ class XvfbDriver(Driver):
         while fd_set:
             try:
                 fd_list = select.select(fd_set, [], [])[0]
-            except select.error, e:
+            except select.error as e:
                 if e.args[0] == errno.EINTR:
                     continue
                 raise
index 61b059b..464df6b 100644 (file)
@@ -39,7 +39,7 @@ class JSONChecker(object):
     def check(self, lines):
         try:
             json.loads('\n'.join(lines) + '\n')
-        except ValueError, e:
+        except ValueError as e:
             self._handle_style_error(self.line_number_from_json_exception(e), 'json/syntax', 5, str(e))
 
     @staticmethod
index ff4a415..90e8bed 100644 (file)
@@ -41,5 +41,5 @@ class XMLChecker(object):
                 parser.Parse(line)
                 parser.Parse('\n')
             parser.Parse('', True)
-        except expat.ExpatError, error:
+        except expat.ExpatError as error:
             self._handle_style_error(error.lineno, 'xml/syntax', 5, expat.ErrorString(error.code))
index ab58e3e..15e9b2e 100644 (file)
@@ -129,7 +129,7 @@ class TextFileReader(object):
 
         try:
             lines = self._read_lines(file_path)
-        except IOError, err:
+        except IOError as err:
             message = ("Could not read file. Skipping: '%s'\n  %s" % (file_path, err))
             _log.warn(message)
             return
index de29f2b..0fb4639 100644 (file)
@@ -81,7 +81,7 @@ class TextFileReaderTest(LoggingTestCase):
     def test_process_file__does_not_exist(self):
         try:
             self._file_reader.process_file('does_not_exist.txt')
-        except IOError, err:
+        except IOError as err:
             self.assertEqual(str(err), "File does not exist")
         else:
             self.fail('No Exception raised.')
index 6679178..e3f9708 100644 (file)
@@ -455,7 +455,7 @@ class ArgumentParser(object):
 
         try:
             validate_filter_rules(filter_rules, self._all_categories)
-        except ValueError, err:
+        except ValueError as err:
             self._parse_error(err)
 
         options = CommandOptionValues(filter_rules=filter_rules,
index e02d82e..61fda1c 100644 (file)
@@ -85,7 +85,7 @@ class CreateBug(IRCCommand):
             bug_id = tool.bugs.create_bug(bug_title, bug_description, cc=requester_email, assignee=requester_email)
             bug_url = tool.bugs.bug_url_for_bug_id(bug_id)
             return "%s: Created bug: %s" % (nick, bug_url)
-        except Exception, e:
+        except Exception as e:
             return "%s: Failed to create bug:\n%s" % (nick, e)
 
 
@@ -241,7 +241,7 @@ class Rollout(IRCCommand):
             bug_id = sheriff.post_rollout_patch(svn_revision_list, complete_reason)
             bug_url = tool.bugs.bug_url_for_bug_id(bug_id)
             tool.irc().post("%s: Created rollout: %s" % (nicks_string, bug_url))
-        except ScriptError, e:
+        except ScriptError as e:
             tool.irc().post("%s: Failed to create rollout patch:" % nicks_string)
             diff_failure = self._check_diff_failure(e.output, tool)
             if diff_failure:
index 49744c9..bdeaf3b 100644 (file)
@@ -88,7 +88,7 @@ class IRCBot(object):
         except TerminateQueue:
             raise
         # This will catch everything else. SystemExit and KeyboardInterrupt are not subclasses of Exception, so we won't catch those.
-        except Exception, e:
+        except Exception as e:
             self._tool.irc().post("Exception executing command: %s" % e)
 
     def process_pending_messages(self):
index ce518ba..67cd2de 100644 (file)
@@ -49,7 +49,7 @@ class LayoutTestResultsReader(AbstractTestResultsReader):
     def _read_file_contents(self, path):
         try:
             return self._host.filesystem.read_text_file(path)
-        except IOError, e:  # File does not exist or can't be read.
+        except IOError as e:  # File does not exist or can't be read.
             return None
 
     # FIXME: This logic should move to the port object.
index 6cf7337..d53e34b 100644 (file)
@@ -100,7 +100,7 @@ class PatchAnalysisTask(object):
             self._delegate.run_command(command)
             self._delegate.command_passed(success_message, patch=self._patch)
             return True
-        except ScriptError, e:
+        except ScriptError as e:
             self._script_error = e
             self.failure_status_id = self._delegate.command_failed(failure_message, script_error=self._script_error, patch=self._patch)
             return False
index fa132da..8a245f2 100644 (file)
@@ -103,7 +103,7 @@ class QueueEngine:
                     if not self._delegate.process_work_item(work_item):
                         _log.warning("Unable to process work item.")
                         continue
-                except ScriptError, e:
+                except ScriptError as e:
                     self._open_work_log(work_item)
                     self._work_log.write(e.message_with_output())
                     # Use a special exit code to indicate that the error was already
@@ -112,13 +112,13 @@ class QueueEngine:
                         continue
                     message = "Unexpected failure when processing patch!  Please file a bug against webkit-patch.\n%s" % e.message_with_output()
                     self._delegate.handle_unexpected_error(work_item, message)
-            except TerminateQueue, e:
+            except TerminateQueue as e:
                 self._stopping("TerminateQueue exception received.")
                 return 0
-            except KeyboardInterrupt, e:
+            except KeyboardInterrupt as e:
                 self._stopping("User terminated queue.")
                 return 1
-            except Exception, e:
+            except Exception as e:
                 traceback.print_exc()
                 # Don't try tell the status bot, in case telling it causes an exception.
                 self._sleep("Exception while preparing queue")
index 8f420a9..d245489 100644 (file)
@@ -48,7 +48,7 @@ class AbstractSequencedCommand(Command):
     def execute(self, options, args, tool):
         try:
             state = self._prepare_state(options, args, tool)
-        except ScriptError, e:
+        except ScriptError as e:
             _log.error(e.message_with_output())
             self._exit(e.exit_code or 2)
 
index d92770e..3e46589 100644 (file)
@@ -200,7 +200,7 @@ class AbstractPatchSequencingCommand(AbstractPatchProcessingCommand):
     def _prepare_to_process(self, options, args, tool):
         try:
             self.state = self._prepare_state(options, args, tool)
-        except ScriptError, e:
+        except ScriptError as e:
             _log.error(e.message_with_output())
             self._exit(e.exit_code or 2)
         self._prepare_sequence.run_and_handle_errors(tool, options, self.state)
index 40a20d8..786f734 100644 (file)
@@ -108,13 +108,13 @@ class AbstractEarlyWarningSystem(AbstractReviewQueue, EarlyWarningSystemTaskDele
         except PatchIsNotValid as error:
             self._did_error(patch, "%s did not process patch. Reason: %s" % (self.name, error.failure_message))
             return False
-        except UnableToApplyPatch, e:
+        except UnableToApplyPatch as e:
             self._did_error(patch, "%s unable to apply patch." % self.name)
             return False
-        except PatchIsNotApplicable, e:
+        except PatchIsNotApplicable as e:
             self._did_skip(patch)
             return False
-        except ScriptError, e:
+        except ScriptError as e:
             self._post_reject_message_on_bug(self._tool, patch, task.failure_status_id, self._failing_tests_message(task, patch))
             results_archive = task.results_archive_from_patch_test_run(patch)
             if results_archive:
index 64c9cdf..fa41f97 100644 (file)
@@ -254,7 +254,7 @@ class FailureReason(Command):
     def _blame_line_for_revision(self, revision):
         try:
             commit_info = self._tool.checkout().commit_info_for_revision(revision)
-        except Exception, e:
+        except Exception as e:
             return "FAILED to fetch CommitInfo for r%s, exception: %s" % (revision, e)
         if not commit_info:
             return "FAILED to fetch CommitInfo for r%s, likely missing ChangeLog" % revision
index adca4dc..09624b4 100644 (file)
@@ -81,7 +81,7 @@ class AbstractQueue(Command, QueueEngineDelegate):
     def _cc_watchers(self, bug_id):
         try:
             self._tool.bugs.add_cc_to_bug(bug_id, self.watchers)
-        except Exception, e:
+        except Exception as e:
             traceback.print_exc()
             _log.error("Failed to CC watchers.")
 
@@ -103,7 +103,7 @@ class AbstractQueue(Command, QueueEngineDelegate):
             args_for_printing[0] = 'webkit-patch'  # Printing our path for each log is redundant.
             _log.info("Running: %s" % self._tool.executive.command_for_printing(args_for_printing))
             command_output = self._tool.executive.run_command(webkit_patch_args, cwd=self._tool.scm().checkout_root)
-        except ScriptError, e:
+        except ScriptError as e:
             # Make sure the whole output gets printed if the command failed.
             _log.error(e.message_with_output(output_limit=None))
             raise
@@ -347,7 +347,7 @@ class CommitQueue(PatchProcessingQueue, StepSequenceErrorHandler, CommitQueueTas
         except PatchIsNotValid as error:
             self._did_error(patch, "%s did not process patch. Reason: %s" % (self.name, error.failure_message))
             return False
-        except ScriptError, e:
+        except ScriptError as e:
             validator = CommitterValidator(self._tool)
             validator.reject_patch_from_commit_queue(patch.id(), self._error_message_for_bug(task, patch, e))
             results_archive = task.results_archive_from_patch_test_run(patch)
@@ -480,13 +480,13 @@ class StyleQueue(AbstractReviewQueue, StyleQueueTaskDelegate):
                 # Caller unlocks when review_patch returns True, so we only need to unlock on transient failure.
                 self._unlock_patch(patch)
             return style_check_succeeded
-        except UnableToApplyPatch, e:
+        except UnableToApplyPatch as e:
             self._did_error(patch, "%s unable to apply patch." % self.name)
             return False
         except PatchIsNotValid as error:
             self._did_error(patch, "%s did not process patch. Reason: %s" % (self.name, error.failure_message))
             return False
-        except ScriptError, e:
+        except ScriptError as e:
             output = re.sub(r'Failed to run .+ exit_code: 1', '', e.output)
             message = "Attachment %s did not pass %s:\n\n%s\n\nIf any of these errors are false positives, please file a bug against check-webkit-style." % (patch.id(), self.name, output)
             self._tool.bugs.post_comment_to_bug(patch.bug_id(), message, cc=self.watchers)
index 2b1e609..67f90c4 100644 (file)
@@ -207,7 +207,7 @@ class AbstractParallelRebaselineCommand(AbstractRebaseliningCommand):
             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(line, file=sys.stderr)
-        except ScriptError, e:
+        except ScriptError as e:
             _log.error(e)
 
     def _builders_to_fetch_from(self, builders_to_check):
index 3c7c683..0f0e9f7 100644 (file)
@@ -71,13 +71,13 @@ class StepSequence(object):
             state = {}
         try:
             self._run(tool, options, state)
-        except CheckoutNeedsUpdate, e:
+        except CheckoutNeedsUpdate as e:
             _log.info("Commit failed because the checkout is out of date. Please update and try again.")
             if options.parent_command:
                 command = tool.command_by_name(options.parent_command)
                 command.handle_checkout_needs_update(tool, state, options, e)
             QueueEngine.exit_after_handled_error(e)
-        except ScriptError, e:
+        except ScriptError as e:
             if not options.quiet:
                 _log.error(e.message_with_output())
             if options.parent_command:
index 0b81ac5..e1e46f2 100644 (file)
@@ -213,7 +213,7 @@ class SuggestNominations(AbstractCommitLogCommand):
         for commit_message in self._recent_commit_messages():
             try:
                 self._count_commit(self._parse_commit_message(commit_message), analysis)
-            except CommitLogError, exception:
+            except CommitLogError as exception:
                 continue
         return analysis['counters_by_email']
 
index 4790127..b65cee2 100644 (file)
@@ -304,7 +304,7 @@ class MultiCommandTool(object):
             try:
                 result = command.check_arguments_and_execute(options, args, self)
                 break
-            except TryAgain, e:
+            except TryAgain as e:
                 pass
 
         self.command_completed()
index a6123dc..d8c62fb 100644 (file)
@@ -117,7 +117,7 @@ def _rebaseline_test(test_file, baseline_target, baseline_move_to, test_config,
         try:
             scm.add(destination_path)
             log('    Updated %s' % destination_file)
-        except ScriptError, error:
+        except ScriptError as error:
             log('    Could not update %s in SCM, exit code %d' %
                 (destination_file, error.exit_code))
             return False
@@ -153,7 +153,7 @@ def _move_test_baselines(test_file, extensions_to_move, source_platform, destina
         try:
             test_config.scm.add(destination_path)
             log('    Moved %s' % file_name)
-        except ScriptError, error:
+        except ScriptError as error:
             log('    Could not update %s in SCM, exit code %d' %
                 (file_name, error.exit_code))
             return False
index 9fab6f4..6ec4a2f 100644 (file)
@@ -54,5 +54,5 @@ class AddSvnMimetypeForPngTest(unittest.TestCase):
         }
         try:
             capture.assert_outputs(self, step.run, [state])
-        except SystemExit, e:
+        except SystemExit as e:
             self.assertEqual(e.code, 1)
index 2833877..dd865c0 100644 (file)
@@ -64,7 +64,7 @@ class CheckStyle(AbstractStep):
 
         try:
             self._tool.executive.run_and_throw_if_fail(self._tool.deprecated_port().check_webkit_style_command() + args, cwd=self._tool.scm().checkout_root)
-        except ScriptError, e:
+        except ScriptError as e:
             if self._options.non_interactive:
                 # We need to re-raise the exception here to have the
                 # style-queue do the right thing.
index 87db783..9a5d83b 100644 (file)
@@ -61,7 +61,7 @@ class Commit(AbstractStep):
         args.extend(test_expectations_files)
         try:
             self._tool.executive.run_and_throw_if_fail(self._tool.deprecated_port().check_webkit_style_command() + args, cwd=self._tool.scm().checkout_root)
-        except ScriptError, e:
+        except ScriptError as e:
             if self._options.non_interactive:
                 raise
             if not self._tool.user.confirm("Are you sure you want to continue?", default="n"):
@@ -90,13 +90,13 @@ class Commit(AbstractStep):
                 _log.info("Committed r%s: <%s>" % (svn_revision, urls.view_revision_url(svn_revision)))
                 self._state["commit_text"] = commit_text
                 break
-            except AmbiguousCommitError, e:
+            except AmbiguousCommitError as e:
                 if self._tool.user.confirm(self._commit_warning(e)):
                     force_squash = True
                 else:
                     # This will correctly interrupt the rest of the commit process.
                     raise ScriptError(message="Did not commit")
-            except AuthenticationError, e:
+            except AuthenticationError as e:
                 if self._options.non_interactive:
                     raise ScriptError(message="Authentication required")
                 username = self._tool.user.prompt("%s login: " % e.server_host, repeat=5)
index 4cc9822..4989312 100644 (file)
@@ -58,9 +58,9 @@ class ConfirmDiff(AbstractStep):
             # We return the pretty_diff_file here because we need to keep the
             # file alive until the user has had a chance to confirm the diff.
             return pretty_diff_file
-        except ScriptError, e:
+        except ScriptError as e:
             _log.warning("PrettyPatch failed.  :(")
-        except OSError, e:
+        except OSError as e:
             _log.warning("PrettyPatch unavailable.")
 
     def run(self, state):
index b0692b3..e86e4a4 100644 (file)
@@ -82,7 +82,7 @@ class HasLanded(confirmdiff.ConfirmDiff):
         try:
             return executive.run_command(
                 ["interdiff", diff1_patch.name, diff2_patch.name], decode_output=False)
-        except ScriptError, e:
+        except ScriptError as e:
             _log.warning("Unable to find interdiff util (part of GNU difftools package) which is required.")
             raise
 
index 13a4439..2812a15 100644 (file)
@@ -121,7 +121,7 @@ class PrepareChangeLog(AbstractStep):
 
         try:
             output = self._tool.executive.run_and_throw_if_fail(args, self._options.quiet, cwd=self._tool.scm().checkout_root)
-        except ScriptError, e:
+        except ScriptError as e:
             _log.error("Unable to prepare ChangeLogs.")
             sys.exit(1)
 
index 3114891..d4d28c1 100644 (file)
@@ -39,7 +39,7 @@ class PromptForBugOrTitle(AbstractStep):
         # Otherwise we assume it's a bug subject.
         try:
             state["bug_id"] = int(user_response)
-        except ValueError, TypeError:
+        except ValueError as TypeError:
             state["bug_title"] = user_response
             # FIXME: This is kind of a lame description.
             state["bug_description"] = user_response
index 5c026cc..c57590c 100644 (file)
@@ -53,6 +53,6 @@ class SortXcodeProjectFiles(AbstractStep):
                 try:
                     output = self._tool.executive.run_and_throw_if_fail(args, self._options.quiet, cwd=self._tool.scm().checkout_root)
                     self.did_modify_checkout(state)
-                except ScriptError, e:
+                except ScriptError as e:
                     _log.error("Unable to sort modified xcode projects.")
                     sys.exit(1)
index 5515b00..c97ea67 100644 (file)
@@ -61,7 +61,7 @@ class WebDriverW3CWebServer(object):
             s = socket.socket()
             try:
                 s.connect((host, port))
-            except IOError, e:
+            except IOError as e:
                 if e.errno not in (errno.ECONNREFUSED, errno.ECONNRESET):
                     raise
                 return False
index ac28d64..e3e9222 100755 (executable)
@@ -107,7 +107,7 @@ class DataStoreFile(db.Model):
             data_entry.data = db.Blob(data[start: start + MAX_ENTRY_LEN])
             try:
                 data_entry.put()
-            except Exception, err:
+            except Exception as err:
                 logging.error("Failed to save data store entry: %s", err)
                 if keys:
                     self.delete_data(keys)
index 16a4797..fd4faea 100644 (file)
@@ -51,7 +51,7 @@ def enter_jhbuild_environment_if_available(platform):
         from jhbuild.errors import FatalError
         gettext.install('jhbuild', localedir=os.path.join(source_path, 'mo'), unicode=True)
         config = jhbuild.config.Config(get_config_file_for_platform(platform), [])
-    except FatalError, exception:
+    except FatalError as exception:
         sys.stderr.write('Could not load jhbuild config file: %s\n' % exception.args[0])
         return False