Update twisted version in webkitpy.thirdparty.autoinstalled module.
authordewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Nov 2016 01:17:58 +0000 (01:17 +0000)
committerdewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Nov 2016 01:17:58 +0000 (01:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=154667

Reviewed by Ryosuke Niwa.

Use twisted_15_5_0 for the twisted module used by run-benchmark because there is a bug in twisted 12.1.0 which sometimes stops the test.
Installing twisted was introduced in https://bugs.webkit.org/show_bug.cgi?id=147082 for run-benchmark script.
Since buildbot relies on twisted 12.1.0 and has not been verified the compatibility on twisted 15.5.0, it would be more secure to use an individual version for run-benchmark script.

* Scripts/webkitpy/benchmark_runner/http_server_driver/http_server/twisted_http_server.py:
* Scripts/webkitpy/thirdparty/__init__.py:
(AutoinstallImportHook.find_module):
(AutoinstallImportHook._install_twisted_15_5_0):
(AutoinstallImportHook._install_twisted): Deleted.

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

Tools/ChangeLog
Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/http_server/twisted_http_server.py
Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py
Tools/Scripts/webkitpy/thirdparty/__init__.py

index 33bfcf4..7e096c2 100644 (file)
@@ -1,3 +1,20 @@
+2016-10-31  Dewei Zhu  <dewei_zhu@apple.com>
+
+        Update twisted version in webkitpy.thirdparty.autoinstalled module.
+        https://bugs.webkit.org/show_bug.cgi?id=154667
+
+        Reviewed by Ryosuke Niwa.
+
+        Use twisted_15_5_0 for the twisted module used by run-benchmark because there is a bug in twisted 12.1.0 which sometimes stops the test.
+        Installing twisted was introduced in https://bugs.webkit.org/show_bug.cgi?id=147082 for run-benchmark script.
+        Since buildbot relies on twisted 12.1.0 and has not been verified the compatibility on twisted 15.5.0, it would be more secure to use an individual version for run-benchmark script.
+
+        * Scripts/webkitpy/benchmark_runner/http_server_driver/http_server/twisted_http_server.py:
+        * Scripts/webkitpy/thirdparty/__init__.py:
+        (AutoinstallImportHook.find_module):
+        (AutoinstallImportHook._install_twisted_15_5_0):
+        (AutoinstallImportHook._install_twisted): Deleted.
+
 2016-10-31  Ryosuke Niwa  <rniwa@webkit.org>
 
         Enable custom elements by default everywhere
index 420a752..ed42763 100644 (file)
@@ -4,12 +4,14 @@ import argparse
 import logging
 import os
 import sys
+from pkg_resources import require, VersionConflict, DistributionNotFound
 
 try:
+    require("Twisted>=15.5.0")
     import twisted
-except ImportError:
+except (ImportError, VersionConflict, DistributionNotFound):
     sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../..')))
-    from webkitpy.thirdparty.autoinstalled.twisted import twisted
+    from webkitpy.thirdparty.autoinstalled.twisted_15_5_0 import twisted
 
 from twisted.web import static, server
 from twisted.web.resource import Resource
index 091c8ec..26d88fd 100644 (file)
@@ -37,18 +37,16 @@ class SimpleHTTPServerDriver(HTTPServerDriver):
         try:
             import psutil
             for attempt in xrange(max_attempt):
-                try:
-                    self._server_port = psutil.Process(self._server_process.pid).connections()[0][3][1]
-                    if self._server_port:
-                        _log.info('HTTP Server is serving at port: %d', self._server_port)
-                        break
-                except IndexError:
-                    pass
+                connections = psutil.Process(self._server_process.pid).connections()
+                if connections and connections[0].laddr and connections[0].laddr[1] and connections[0].status == 'LISTEN':
+                    self._server_port = connections[0].laddr[1]
+                    _log.info('HTTP Server is serving at port: %d', self._server_port)
+                    break
                 _log.info('Server port is not found this time, retry after %f seconds' % interval)
                 time.sleep(interval)
                 interval *= 2
             else:
-                raise Exception("Cannot listen to server, max tries exceeded")
+                raise Exception("Server is not listening on port, max tries exceeded. HTTP server may be installing dependent modules.")
         except ImportError:
             for attempt in xrange(max_attempt):
                 try:
index b58168e..82455f1 100644 (file)
@@ -91,8 +91,8 @@ class AutoinstallImportHook(object):
             self._install_buildbot()
         elif '.keyring' in fullname:
             self._install_keyring()
-        elif '.twisted' in fullname:
-            self._install_twisted()
+        elif '.twisted_15_5_0' in fullname:
+            self._install_twisted_15_5_0()
 
     def _install_mechanize(self):
         self._install("http://pypi.python.org/packages/source/m/mechanize/mechanize-0.2.5.tar.gz",
@@ -150,10 +150,10 @@ class AutoinstallImportHook(object):
     def _install_eliza(self):
         self._install(url="http://www.adambarth.com/webkit/eliza", target_name="eliza.py")
 
-    def _install_twisted(self):
-        twisted_dir = self._fs.join(_AUTOINSTALLED_DIR, "twisted")
+    def _install_twisted_15_5_0(self):
+        twisted_dir = self._fs.join(_AUTOINSTALLED_DIR, "twisted_15_5_0")
         installer = AutoInstaller(prepend_to_search_path=True, target_dir=twisted_dir)
-        installer.install(url="https://pypi.python.org/packages/source/T/Twisted/Twisted-12.1.0.tar.bz2#md5=f396f1d6f5321e869c2f89b2196a9eb5", url_subpath="Twisted-12.1.0/twisted")
+        installer.install(url="https://pypi.python.org/packages/source/T/Twisted/Twisted-15.5.0.tar.bz2#md5=0831d7c90d0020062de0f7287530a285", url_subpath="Twisted-15.5.0/twisted")
         installer.install(url="https://pypi.python.org/packages/source/z/zope.interface/zope.interface-4.1.3.tar.gz#md5=9ae3d24c0c7415deb249dd1a132f0f79", url_subpath="zope.interface-4.1.3/src/zope")
 
     def _install(self, url, url_subpath=None, target_name=None):