Skip to content

Commit

Permalink
This adds the ability to download latest Servo for wpt run
Browse files Browse the repository at this point in the history
Closes #9544
  • Loading branch information
kriti21 committed Mar 9, 2018
1 parent 5ca972e commit 12ff2fe
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 3 deletions.
50 changes: 48 additions & 2 deletions tools/wpt/browser.py
Expand Up @@ -431,8 +431,52 @@ class Servo(Browser):
product = "servo"
requirements = "requirements_servo.txt"

def platform_string(self):
platform = {
"Linux": "linux",
"Windows": "win",
"Darwin": "mac"
}.get(uname[0])

if platform is None:
raise ValueError("Unable to construct a valid Servo package for current platform")

if platform == "linux":
bits = "-%s" % uname[4]
extension = ".tar.gz"
elif platform == "win":
bits = "64" if uname[4] == "x86_64" else "32"
extension = ".msi"
else:
bits = ""
extension = ".dmg"

return "%s" % (platform)

def find_extension(self, platform):
if platform == "linux":
extension = ".tar.gz"
elif platform == "win":
extension = ".msi"
else:
extension = ".dmg"

return "%s" % (extension)

def install(self, dest=None):
raise NotImplementedError
"""Install latest Browser Engine."""
if dest is None:
dest = os.pwd

extension = self.find_extension(self.platform_string())
url = "https://download.servo.org/nightly/%s/servo-latest%s" % (self.platform_string(), extension)

untar(get(url).raw, dest)

path = find_executable("servo", dest)
st = os.stat(path)
os.chmod(path, st.st_mode | stat.S_IEXEC)
return path

def find_binary(self, path=None):
return find_executable("servo")
Expand All @@ -444,7 +488,9 @@ def install_webdriver(self):
raise NotImplementedError

def version(self, root):
return None
"""Retrieve the release version of the installed browser."""
output = call(self.binary, "--version")
return re.search(r"[0-9\.]+( [a-z]+)?$", output.strip()).group(0)


class Sauce(Browser):
Expand Down
3 changes: 2 additions & 1 deletion tools/wpt/run.py
Expand Up @@ -332,7 +332,8 @@ class Servo(BrowserSetup):
browser_cls = browser.Servo

def install(self, venv):
raise NotImplementedError
if self.prompt_install(self.name):
return self.browser.install(venv.path)

def setup_kwargs(self, kwargs):
if kwargs["binary"] is None:
Expand Down

0 comments on commit 12ff2fe

Please sign in to comment.