⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 268896 in webkit


Ignore:
Timestamp:
Oct 22, 2020, 3:13:04 PM (6 years ago)
Author:
Jonathan Bedard
Message:

[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.

Location:
trunk/Tools
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r268890 r268896  
     12020-10-22  Jonathan Bedard  <jbedard@apple.com>
     2
     3        [webkitpy] Use webkitcorepy's autoinstaller for chrome and gecko drivers
     4        https://bugs.webkit.org/show_bug.cgi?id=218059
     5        <rdar://problem/70551255>
     6
     7        Rubber-stamped by Aakash Jain.
     8
     9        * Scripts/webkitpy/autoinstalled: Added.
     10        * Scripts/webkitpy/autoinstalled/__init__.py: Added.
     11        * Scripts/webkitpy/autoinstalled/chromedriver.py: Added.
     12        (ChromeDriverPackage): Special listing rules for the chrome driver.
     13        * Scripts/webkitpy/autoinstalled/geckodriver.py: Added.
     14        (GeckoDriverPackage): Special listing rules for the GeckoDriver.
     15        * Scripts/webkitpy/benchmark_runner/utils.py:
     16        (get_driver_binary_path):
     17        * Scripts/webkitpy/thirdparty/__init__.py:
     18        (AutoinstallImportHook.find_module): Remove Chrome and Gecko drivers.
     19        (AutoinstallImportHook.install_chromedriver): Deleted.
     20        (AutoinstallImportHook.install_geckodriver): Deleted.
     21        (get_driver_filename): Deleted.
     22        (get_os_info): Deleted.
     23
    1242020-10-22  Aakash Jain  <aakash_jain@apple.com>
    225
  • trunk/Tools/Scripts/webkitpy/benchmark_runner/utils.py

    r223226 r268896  
    5353def get_driver_binary_path(browser_name):
    5454    if browser_name.startswith('chrome'):
    55         import webkitpy.thirdparty.autoinstalled.chromedriver
    56         driver_init_file = webkitpy.thirdparty.autoinstalled.chromedriver.__file__
    57         driver_executable = os.path.join(os.path.dirname(os.path.realpath(driver_init_file)), 'chromedriver')
    58         return driver_executable
     55        from webkitpy.autoinstalled import chromedriver
     56        return chromedriver.executable
    5957    elif browser_name.startswith('firefox'):
    60         import webkitpy.thirdparty.autoinstalled.geckodriver
    61         driver_init_file = webkitpy.thirdparty.autoinstalled.geckodriver.__file__
    62         driver_executable = os.path.join(os.path.dirname(os.path.realpath(driver_init_file)), 'geckodriver')
    63         return driver_executable
     58        from webkitpy.autoinstalled import geckodriver
     59        return geckodriver.executable
    6460
    6561
  • trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py

    r268844 r268896  
    3434
    3535if sys.version_info > (3, 0):
    36     from urllib.error import URLError
    3736    from urllib.request import urlopen
    3837else:
    39     from urllib2 import URLError, urlopen
     38    from urllib2 import urlopen
    4039
    41 from collections import namedtuple
    42 from distutils import spawn
    4340from webkitpy.common.system.autoinstall import AutoInstaller
    4441from webkitpy.common.system.filesystem import FileSystem
     
    4744_THIRDPARTY_DIR = os.path.dirname(__file__)
    4845_AUTOINSTALLED_DIR = os.path.join(_THIRDPARTY_DIR, "autoinstalled")
    49 
    50 CHROME_DRIVER_URL = "http://chromedriver.storage.googleapis.com/"
    51 FIREFOX_RELEASES_URL = "https://api.github.com/repos/mozilla/geckodriver/releases"
    5246
    5347# Putting the autoinstall code into webkitpy/thirdparty/__init__.py
     
    9892        elif '.twisted_15_5_0' in fullname:
    9993            self._install_twisted_15_5_0()
    100         elif '.chromedriver' in fullname:
    101             self.install_chromedriver()
    102         elif '.geckodriver' in fullname:
    103             self.install_geckodriver()
    10494
    10595    # autoinstalled.buildbot is used by BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py
     
    142132        return True
    143133
    144     def install_chromedriver(self):
    145         filename_postfix = get_driver_filename().chrome
    146         if filename_postfix != "unsupported":
    147             version = urlopen(CHROME_DRIVER_URL + 'LATEST_RELEASE').read().strip()
    148             full_chrome_url = "{base_url}{version}/chromedriver_{os}.zip".format(base_url=CHROME_DRIVER_URL, version=version, os=filename_postfix)
    149             self.install_binary(full_chrome_url, 'chromedriver')
    150 
    151     def install_geckodriver(self):
    152         filename_postfix = get_driver_filename().firefox
    153         if filename_postfix != "unsupported":
    154             firefox_releases_blob = urlopen(FIREFOX_RELEASES_URL)
    155             firefox_releases_line_separated = json.dumps(json.load(firefox_releases_blob), indent=0).strip()
    156             all_firefox_release_urls = "\n".join(re.findall(r'.*browser_download_url.*', firefox_releases_line_separated))
    157             full_firefox_url = re.findall(r'.*%s.*' % filename_postfix, all_firefox_release_urls)[0].split('"')[3]
    158             self.install_binary(full_firefox_url, 'geckodriver')
    159 
    160134    def _install(self, url, url_subpath=None, target_name=None):
    161135        installer = AutoInstaller(target_dir=_AUTOINSTALLED_DIR)
     
    185159    for method in install_methods:
    186160        getattr(_hook, method)()
    187 
    188 def get_driver_filename():
    189     os_name, os_type = get_os_info()
    190     chrome_os, filefox_os = 'unsupported', 'unsupported'
    191     if os_name == 'Linux' and os_type == '64':
    192         chrome_os, firefox_os = 'linux64', 'linux64'
    193     elif os_name == 'Linux':
    194         chrome_os, firefox_os = 'linux32', 'linux32'
    195     elif os_name == 'Darwin':
    196         chrome_os, firefox_os = 'mac64', 'macos'
    197     DriverFilenameForBrowser = namedtuple('DriverFilenameForBrowser', ['chrome', 'firefox'])
    198     return DriverFilenameForBrowser(chrome_os, firefox_os)
    199 
    200 def get_os_info():
    201     import platform
    202     os_name = platform.system()
    203     os_type = platform.machine()[-2:]
    204     return (os_name, os_type)
Note: See TracChangeset for help on using the changeset viewer.