Install twisted package for http server when necessary.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Aug 2015 00:46:43 +0000 (00:46 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Aug 2015 00:46:43 +0000 (00:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147082

Patch by Dewei Zhu <dewei_zhu@apple.com> on 2015-08-04
Reviewed by Ryosuke Niwa.

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

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

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

index f1fba76..b75c57f 100644 (file)
@@ -1,3 +1,15 @@
+2015-08-04  Dewei Zhu  <dewei_zhu@apple.com>
+
+        Install twisted package for http server when necessary.
+        https://bugs.webkit.org/show_bug.cgi?id=147082
+
+        Reviewed by Ryosuke Niwa.
+
+        * Scripts/webkitpy/benchmark_runner/http_server_driver/http_server/twisted_http_server.py:
+        * Scripts/webkitpy/thirdparty/__init__.py:
+        (AutoinstallImportHook.find_module):
+        (AutoinstallImportHook._install_twisted):
+
 2015-08-04  Brent Fulgham  <bfulgham@apple.com>
 
         [Win] Update Apple Windows build for VS2015
index b634209..ae43eca 100644 (file)
@@ -2,8 +2,15 @@
 
 import argparse
 import logging
+import os
 import sys
 
+try:
+    import twisted
+except ImportError:
+    sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../..')))
+    from webkitpy.thirdparty.autoinstalled.twisted import twisted
+
 from twisted.web import static, server
 from twisted.web.resource import Resource
 from twisted.internet import reactor
@@ -27,12 +34,12 @@ class ServerControl(Resource):
 
 
 if __name__ == '__main__':
-    parser = argparse.ArgumentParser(description='python TwistedHTTPServer.py webRoot')
-    parser.add_argument('webRoot')
+    parser = argparse.ArgumentParser(description='python twisted_http_server.py web_root')
+    parser.add_argument('web_root')
     args = parser.parse_args()
-    webRoot = static.File(args.webRoot)
+    web_root = static.File(args.web_root)
     serverControl = ServerControl()
-    webRoot.putChild('shutdown', serverControl)
-    webRoot.putChild('report', serverControl)
-    reactor.listenTCP(0, server.Site(webRoot))
+    web_root.putChild('shutdown', serverControl)
+    web_root.putChild('report', serverControl)
+    reactor.listenTCP(0, server.Site(web_root))
     reactor.run()
index c3baf71..f43c3ac 100644 (file)
@@ -91,6 +91,8 @@ class AutoinstallImportHook(object):
             self._install_buildbot()
         elif '.keyring' in fullname:
             self._install_keyring()
+        elif '.twisted' in fullname:
+            self._install_twisted()
 
     def _install_mechanize(self):
         self._install("http://pypi.python.org/packages/source/m/mechanize/mechanize-0.2.5.tar.gz",
@@ -148,6 +150,11 @@ 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")
+        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")
+
     def _install(self, url, url_subpath=None, target_name=None):
         installer = AutoInstaller(target_dir=_AUTOINSTALLED_DIR)
         installer.install(url=url, url_subpath=url_subpath, target_name=target_name)