Heap-use-after-free in WebCore::InlineFlowBox::deleteLine due to fullscreen issues.
[WebKit-https.git] / Tools / Scripts / webkitpy / thirdparty / __init__.py
1 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions
5 # are met:
6 # 1.  Redistributions of source code must retain the above copyright
7 #     notice, this list of conditions and the following disclaimer.
8 # 2.  Redistributions in binary form must reproduce the above copyright
9 #     notice, this list of conditions and the following disclaimer in the
10 #     documentation and/or other materials provided with the distribution.
11 #
12 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
13 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
14 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
16 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
20 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
21 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
23 # This module is required for Python to treat this directory as a package.
24
25 """Autoinstalls third-party code required by WebKit."""
26
27
28 import codecs
29 import os
30 import sys
31
32 from webkitpy.common.system.autoinstall import AutoInstaller
33 from webkitpy.common.system.filesystem import FileSystem
34
35 _THIRDPARTY_DIR = os.path.dirname(__file__)
36 _AUTOINSTALLED_DIR = os.path.join(_THIRDPARTY_DIR, "autoinstalled")
37
38 # Putting the autoinstall code into webkitpy/thirdparty/__init__.py
39 # ensures that no autoinstalling occurs until a caller imports from
40 # webkitpy.thirdparty.  This is useful if the caller wants to configure
41 # logging prior to executing autoinstall code.
42
43 # FIXME: If any of these servers is offline, webkit-patch breaks (and maybe
44 # other scripts do, too). See <http://webkit.org/b/42080>.
45
46 # We put auto-installed third-party modules in this directory--
47 #
48 #     webkitpy/thirdparty/autoinstalled
49 fs = FileSystem()
50 fs.maybe_make_directory(_AUTOINSTALLED_DIR)
51
52 init_path = fs.join(_AUTOINSTALLED_DIR, "__init__.py")
53 if not fs.exists(init_path):
54     fs.write_text_file(init_path, "")
55
56 readme_path = fs.join(_AUTOINSTALLED_DIR, "README")
57 if not fs.exists(readme_path):
58     fs.write_text_file(readme_path,
59         "This directory is auto-generated by WebKit and is "
60         "safe to delete.\nIt contains needed third-party Python "
61         "packages automatically downloaded from the web.")
62
63
64 class AutoinstallImportHook(object):
65     def __init__(self, filesystem=None):
66         self._fs = filesystem or FileSystem()
67
68     def find_module(self, fullname, path):
69         # This method will run before each import. See http://www.python.org/dev/peps/pep-0302/
70         if '.autoinstalled' not in fullname:
71             return
72
73         if '.mechanize' in fullname:
74             self._install_mechanize()
75         elif '.pep8' in fullname:
76             self._install_pep8()
77         elif '.coverage' in fullname:
78             self._install_coverage()
79         elif '.eliza' in fullname:
80             self._install_eliza()
81         elif '.irc' in fullname:
82             self._install_irc()
83         elif '.pywebsocket' in fullname:
84             self._install_pywebsocket()
85         elif '.buildbot' in fullname:
86             self._install_buildbot()
87         elif '.xmlrunner' in fullname:
88             self._install_xmlrunner()
89
90     def _install_mechanize(self):
91         self._install("http://pypi.python.org/packages/source/m/mechanize/mechanize-0.2.5.tar.gz",
92                       "mechanize-0.2.5/mechanize")
93
94     def _install_pep8(self):
95         self._install("http://pypi.python.org/packages/source/p/pep8/pep8-0.5.0.tar.gz#md5=512a818af9979290cd619cce8e9c2e2b",
96                       "pep8-0.5.0/pep8.py")
97
98     # autoinstalled.buildbot is used by BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py
99     # and should ideally match the version of BuildBot used at build.webkit.org.
100     def _install_buildbot(self):
101         # The buildbot package uses jinja2, for example, in buildbot/status/web/base.py.
102         # buildbot imports jinja2 directly (as though it were installed on the system),
103         # so the search path needs to include jinja2.  We put jinja2 in
104         # its own directory so that we can include it in the search path
105         # without including other modules as a side effect.
106         jinja_dir = self._fs.join(_AUTOINSTALLED_DIR, "jinja2")
107         installer = AutoInstaller(append_to_search_path=True, target_dir=jinja_dir)
108         installer.install(url="http://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.6.tar.gz#md5=1c49a8825c993bfdcf55bb36897d28a2",
109                           url_subpath="Jinja2-2.6/jinja2")
110
111         self._install("http://pypi.python.org/packages/source/b/buildbot/buildbot-0.8.4p2.tar.gz#md5=7597d945724c80c0ab476e833a1026cb", "buildbot-0.8.4p2/buildbot")
112
113     def _install_coverage(self):
114         installer = AutoInstaller(target_dir=_AUTOINSTALLED_DIR)
115         installer.install(url="http://pypi.python.org/packages/source/c/coverage/coverage-3.5.1.tar.gz#md5=410d4c8155a4dab222f2bc51212d4a24", url_subpath="coverage-3.5.1/coverage")
116
117     def _install_eliza(self):
118         installer = AutoInstaller(target_dir=_AUTOINSTALLED_DIR)
119         installer.install(url="http://www.adambarth.com/webkit/eliza",
120                           target_name="eliza.py")
121
122     def _install_irc(self):
123         # Since irclib and ircbot are two top-level packages, we need to import
124         # them separately.  We group them into an irc package for better
125         # organization purposes.
126         irc_dir = self._fs.join(_AUTOINSTALLED_DIR, "irc")
127         installer = AutoInstaller(target_dir=irc_dir)
128         installer.install(url="http://downloads.sourceforge.net/project/python-irclib/python-irclib/0.4.8/python-irclib-0.4.8.zip",
129                           url_subpath="irclib.py")
130         installer.install(url="http://downloads.sourceforge.net/project/python-irclib/python-irclib/0.4.8/python-irclib-0.4.8.zip",
131                           url_subpath="ircbot.py")
132
133     def _install_pywebsocket(self):
134         pywebsocket_dir = self._fs.join(_AUTOINSTALLED_DIR, "pywebsocket")
135         installer = AutoInstaller(target_dir=pywebsocket_dir)
136         installer.install(url="http://pywebsocket.googlecode.com/files/mod_pywebsocket-0.7.2.tar.gz",
137                           url_subpath="pywebsocket-0.7.2/src/mod_pywebsocket")
138
139     def _install_xmlrunner(self):
140         self._install("http://pypi.python.org/packages/source/u/unittest-xml-reporting/unittest-xml-reporting-1.0.3.tar.gz#md5=cebf83281b0753b5d42bad38c91fd4d6",
141                       "unittest-xml-reporting-1.0.3/src/xmlrunner")
142
143     def _install(self, url, url_subpath):
144         installer = AutoInstaller(target_dir=_AUTOINSTALLED_DIR)
145         installer.install(url=url, url_subpath=url_subpath)
146
147
148 sys.meta_path.append(AutoinstallImportHook())