Diff
Modified: trunk/Tools/ChangeLog (268895 => 268896)
--- trunk/Tools/ChangeLog 2020-10-22 22:06:51 UTC (rev 268895)
+++ trunk/Tools/ChangeLog 2020-10-22 22:13:04 UTC (rev 268896)
@@ -1,3 +1,26 @@
+2020-10-22 Jonathan Bedard <[email protected]>
+
+ [webkitpy] Use webkitcorepy's autoinstaller for chrome and gecko drivers
+ https://bugs.webkit.org/show_bug.cgi?id=218059
+ <rdar://problem/70551255>
+
+ Rubber-stamped by Aakash Jain.
+
+ * Scripts/webkitpy/autoinstalled: Added.
+ * Scripts/webkitpy/autoinstalled/__init__.py: Added.
+ * Scripts/webkitpy/autoinstalled/chromedriver.py: Added.
+ (ChromeDriverPackage): Special listing rules for the chrome driver.
+ * Scripts/webkitpy/autoinstalled/geckodriver.py: Added.
+ (GeckoDriverPackage): Special listing rules for the GeckoDriver.
+ * Scripts/webkitpy/benchmark_runner/utils.py:
+ (get_driver_binary_path):
+ * Scripts/webkitpy/thirdparty/__init__.py:
+ (AutoinstallImportHook.find_module): Remove Chrome and Gecko drivers.
+ (AutoinstallImportHook.install_chromedriver): Deleted.
+ (AutoinstallImportHook.install_geckodriver): Deleted.
+ (get_driver_filename): Deleted.
+ (get_os_info): Deleted.
+
2020-10-22 Aakash Jain <[email protected]>
report-non-inclusive-language should also report total for all the non-inclusive terms
Added: trunk/Tools/Scripts/webkitpy/autoinstalled/__init__.py (0 => 268896)
--- trunk/Tools/Scripts/webkitpy/autoinstalled/__init__.py (rev 0)
+++ trunk/Tools/Scripts/webkitpy/autoinstalled/__init__.py 2020-10-22 22:13:04 UTC (rev 268896)
@@ -0,0 +1,21 @@
+# Copyright (C) 2020 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Added: trunk/Tools/Scripts/webkitpy/autoinstalled/chromedriver.py (0 => 268896)
--- trunk/Tools/Scripts/webkitpy/autoinstalled/chromedriver.py (rev 0)
+++ trunk/Tools/Scripts/webkitpy/autoinstalled/chromedriver.py 2020-10-22 22:13:04 UTC (rev 268896)
@@ -0,0 +1,66 @@
+# Copyright (C) 2020 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import platform
+import requests
+
+from webkitscmpy import Package, Version
+
+
+class ChromeDriverPackage(Package):
+ URL = ''
+
+ def __init__(self, version=None):
+ super(ChromeDriverPackage, self).__init__('chromedriver', version=version)
+
+ def archives(self):
+ if self.version is not None:
+ try:
+ response = requests.get(self.URL + 'LATEST_RELEASE')
+ except requests.RequestException:
+ return []
+
+ if response.status_code != 200:
+ return []
+ version = Version.from_string(response.text.rstrip())
+ else:
+ version = self.version
+
+ os_name = platform.system()
+ if os_name == 'Linux':
+ os = 'linux{}'.format('64' if platform.machine()[-2:] == '64' else '')
+ elif os_name == 'Darwin':
+ os = 'mac64'
+ else:
+ return []
+
+ return [Package.Archive(
+ self.name,
+ link='{}{}/chromedriver_{}.zip'.format(self.URL, version, os),
+ version=version,
+ extension='zip',
+ )]
+
+
+package = ChromeDriverPackage(version=Version(86, 0, 4240, 22))
+package.install()
+executable = package.location
Added: trunk/Tools/Scripts/webkitpy/autoinstalled/geckodriver.py (0 => 268896)
--- trunk/Tools/Scripts/webkitpy/autoinstalled/geckodriver.py (rev 0)
+++ trunk/Tools/Scripts/webkitpy/autoinstalled/geckodriver.py 2020-10-22 22:13:04 UTC (rev 268896)
@@ -0,0 +1,85 @@
+# Copyright (C) 2020 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import platform
+import requests
+
+from webkitscmpy import Package, Version
+
+
+class GeckoDriverPackage(Package):
+ URL = ''
+
+ def __init__(self, version=None):
+ super(GeckoDriverPackage, self).__init__('geckodriver', version=version)
+
+ def archives(self):
+ try:
+ response = requests.get(self.URL)
+ except requests.RequestException:
+ return []
+
+ if response.status_code != 200:
+ return []
+
+ os_name = platform.system()
+ if os_name == 'Darwin':
+ os = 'macos'
+ else:
+ os = '{}{}'.format(os_name, platform.machine()[-2:])
+
+ archives = []
+ for candidate in reversed(response.json()):
+ try:
+ version = Version.from_string(candidate.get('tag_name').split('v')[-1])
+ except ValueError:
+ continue
+
+ for asset in candidate.get('assets', []):
+ url = ""
+ if not url:
+ continue
+ if os not in url:
+ continue
+
+ extension = 'zip' if url.endswith('.zip') else 'tar.gz'
+ if not url.endswith(extension):
+ continue
+
+ if self.version and version not in self.version:
+ continue
+
+ archives.append(
+ Package.Archive(
+ self.name,
+ link=url,
+ version=version,
+ extension=extension,
+ )
+ )
+
+ return archives
+
+
+package = GeckoDriverPackage(version=Version(0, 27, 0))
+package.install()
+executable = package.location
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/utils.py (268895 => 268896)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/utils.py 2020-10-22 22:06:51 UTC (rev 268895)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/utils.py 2020-10-22 22:13:04 UTC (rev 268896)
@@ -52,15 +52,11 @@
@memoized
def get_driver_binary_path(browser_name):
if browser_name.startswith('chrome'):
- import webkitpy.thirdparty.autoinstalled.chromedriver
- driver_init_file = webkitpy.thirdparty.autoinstalled.chromedriver.__file__
- driver_executable = os.path.join(os.path.dirname(os.path.realpath(driver_init_file)), 'chromedriver')
- return driver_executable
+ from webkitpy.autoinstalled import chromedriver
+ return chromedriver.executable
elif browser_name.startswith('firefox'):
- import webkitpy.thirdparty.autoinstalled.geckodriver
- driver_init_file = webkitpy.thirdparty.autoinstalled.geckodriver.__file__
- driver_executable = os.path.join(os.path.dirname(os.path.realpath(driver_init_file)), 'geckodriver')
- return driver_executable
+ from webkitpy.autoinstalled import geckodriver
+ return geckodriver.executable
def write_defaults(domain, key, value):
Modified: trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py (268895 => 268896)
--- trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py 2020-10-22 22:06:51 UTC (rev 268895)
+++ trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py 2020-10-22 22:13:04 UTC (rev 268896)
@@ -33,13 +33,10 @@
import sys
if sys.version_info > (3, 0):
- from urllib.error import URLError
from urllib.request import urlopen
else:
- from urllib2 import URLError, urlopen
+ from urllib2 import urlopen
-from collections import namedtuple
-from distutils import spawn
from webkitpy.common.system.autoinstall import AutoInstaller
from webkitpy.common.system.filesystem import FileSystem
from webkitcorepy import AutoInstall
@@ -47,9 +44,6 @@
_THIRDPARTY_DIR = os.path.dirname(__file__)
_AUTOINSTALLED_DIR = os.path.join(_THIRDPARTY_DIR, "autoinstalled")
-CHROME_DRIVER_URL = "http://chromedriver.storage.googleapis.com/"
-FIREFOX_RELEASES_URL = "https://api.github.com/repos/mozilla/geckodriver/releases"
-
# Putting the autoinstall code into webkitpy/thirdparty/__init__.py
# ensures that no autoinstalling occurs until a caller imports from
# webkitpy.thirdparty. This is useful if the caller wants to configure
@@ -97,10 +91,6 @@
self._install_buildbot()
elif '.twisted_15_5_0' in fullname:
self._install_twisted_15_5_0()
- elif '.chromedriver' in fullname:
- self.install_chromedriver()
- elif '.geckodriver' in fullname:
- self.install_geckodriver()
# autoinstalled.buildbot is used by BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py
# and should ideally match the version of BuildBot used at build.webkit.org.
@@ -141,22 +131,6 @@
return False
return True
- def install_chromedriver(self):
- filename_postfix = get_driver_filename().chrome
- if filename_postfix != "unsupported":
- version = urlopen(CHROME_DRIVER_URL + 'LATEST_RELEASE').read().strip()
- full_chrome_url = "{base_url}{version}/chromedriver_{os}.zip".format(base_url=CHROME_DRIVER_URL, version=version, os=filename_postfix)
- self.install_binary(full_chrome_url, 'chromedriver')
-
- def install_geckodriver(self):
- filename_postfix = get_driver_filename().firefox
- if filename_postfix != "unsupported":
- firefox_releases_blob = urlopen(FIREFOX_RELEASES_URL)
- firefox_releases_line_separated = json.dumps(json.load(firefox_releases_blob), indent=0).strip()
- all_firefox_release_urls = "\n".join(re.findall(r'.*browser_download_url.*', firefox_releases_line_separated))
- full_firefox_url = re.findall(r'.*%s.*' % filename_postfix, all_firefox_release_urls)[0].split('"')[3]
- self.install_binary(full_firefox_url, 'geckodriver')
-
def _install(self, url, url_subpath=None, target_name=None):
installer = AutoInstaller(target_dir=_AUTOINSTALLED_DIR)
return installer.install(url="" url_subpath=url_subpath, target_name=target_name)
@@ -184,21 +158,3 @@
install_methods = [method for method in dir(_hook.__class__) if method.startswith('_install_')]
for method in install_methods:
getattr(_hook, method)()
-
-def get_driver_filename():
- os_name, os_type = get_os_info()
- chrome_os, filefox_os = 'unsupported', 'unsupported'
- if os_name == 'Linux' and os_type == '64':
- chrome_os, firefox_os = 'linux64', 'linux64'
- elif os_name == 'Linux':
- chrome_os, firefox_os = 'linux32', 'linux32'
- elif os_name == 'Darwin':
- chrome_os, firefox_os = 'mac64', 'macos'
- DriverFilenameForBrowser = namedtuple('DriverFilenameForBrowser', ['chrome', 'firefox'])
- return DriverFilenameForBrowser(chrome_os, firefox_os)
-
-def get_os_info():
- import platform
- os_name = platform.system()
- os_type = platform.machine()[-2:]
- return (os_name, os_type)