Changeset 268896 in webkit
- Timestamp:
- Oct 22, 2020, 3:13:04 PM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 4 added
- 3 edited
-
ChangeLog (modified) (1 diff)
-
Scripts/webkitpy/autoinstalled (added)
-
Scripts/webkitpy/autoinstalled/__init__.py (added)
-
Scripts/webkitpy/autoinstalled/chromedriver.py (added)
-
Scripts/webkitpy/autoinstalled/geckodriver.py (added)
-
Scripts/webkitpy/benchmark_runner/utils.py (modified) (1 diff)
-
Scripts/webkitpy/thirdparty/__init__.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r268890 r268896 1 2020-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 1 24 2020-10-22 Aakash Jain <aakash_jain@apple.com> 2 25 -
trunk/Tools/Scripts/webkitpy/benchmark_runner/utils.py
r223226 r268896 53 53 def get_driver_binary_path(browser_name): 54 54 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 59 57 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 64 60 65 61 -
trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py
r268844 r268896 34 34 35 35 if sys.version_info > (3, 0): 36 from urllib.error import URLError37 36 from urllib.request import urlopen 38 37 else: 39 from urllib2 import URLError,urlopen38 from urllib2 import urlopen 40 39 41 from collections import namedtuple42 from distutils import spawn43 40 from webkitpy.common.system.autoinstall import AutoInstaller 44 41 from webkitpy.common.system.filesystem import FileSystem … … 47 44 _THIRDPARTY_DIR = os.path.dirname(__file__) 48 45 _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"52 46 53 47 # Putting the autoinstall code into webkitpy/thirdparty/__init__.py … … 98 92 elif '.twisted_15_5_0' in fullname: 99 93 self._install_twisted_15_5_0() 100 elif '.chromedriver' in fullname:101 self.install_chromedriver()102 elif '.geckodriver' in fullname:103 self.install_geckodriver()104 94 105 95 # autoinstalled.buildbot is used by BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py … … 142 132 return True 143 133 144 def install_chromedriver(self):145 filename_postfix = get_driver_filename().chrome146 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().firefox153 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 160 134 def _install(self, url, url_subpath=None, target_name=None): 161 135 installer = AutoInstaller(target_dir=_AUTOINSTALLED_DIR) … … 185 159 for method in install_methods: 186 160 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 platform202 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.