aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo
diff options
context:
space:
mode:
authorRavi Shankar <wafflespeanut@gmail.com>2016-12-15 12:40:37 +0530
committerRavi Shankar <wafflespeanut@gmail.com>2016-12-15 18:53:14 +0530
commit000d46490e0d964d3ace93e7dac6b4ceaf27cc33 (patch)
tree1051e512e6ec55cf6e98ed83f7bb682de6c49aa7 /python/servo
parent4d165dbf363bac3ef88dd404f3a3cd35ee2f37f0 (diff)
downloadservo-000d46490e0d964d3ace93e7dac6b4ceaf27cc33.tar.gz
servo-000d46490e0d964d3ace93e7dac6b4ceaf27cc33.zip
Warn when OSMesa library path cannot be set
Diffstat (limited to 'python/servo')
-rw-r--r--python/servo/command_base.py16
-rw-r--r--python/servo/testing_commands.py5
2 files changed, 12 insertions, 9 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index 0facab6061e..a6ad117adbe 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -54,13 +54,10 @@ def find_dep_path_newest(package, bin_path):
with cd(deps_path):
for c in glob(package + '-*'):
candidate_path = path.join(deps_path, c)
- candidate_output = path.join(candidate_path, "output")
- if path.exists(candidate_output):
- candidates.append((path.getmtime(candidate_output), candidate_path))
- candidates.sort(reverse=True)
+ if path.exists(path.join(candidate_path, "output")):
+ candidates.append(candidate_path)
if candidates:
- _, candidate_path = candidates[0]
- return candidate_path
+ return max(candidates, key=lambda c: path.getmtime(path.join(c, "output")))
return None
@@ -221,7 +218,10 @@ def is_linux():
def set_osmesa_env(bin_path, env):
"""Set proper LD_LIBRARY_PATH and DRIVE for software rendering on Linux and OSX"""
if is_linux():
- osmesa_path = path.join(find_dep_path_newest('osmesa-src', bin_path), "out", "lib", "gallium")
+ dep_path = find_dep_path_newest('osmesa-src', bin_path)
+ if not dep_path:
+ return None
+ osmesa_path = path.join(dep_path, "out", "lib", "gallium")
env["LD_LIBRARY_PATH"] = osmesa_path
env["GALLIUM_DRIVER"] = "softpipe"
elif is_macosx():
@@ -229,6 +229,8 @@ def set_osmesa_env(bin_path, env):
"out", "src", "gallium", "targets", "osmesa", ".libs")
glapi_path = path.join(find_dep_path_newest('osmesa-src', bin_path),
"out", "src", "mapi", "shared-glapi", ".libs")
+ if not (osmesa_path and glapi_path):
+ return None
env["DYLD_LIBRARY_PATH"] = osmesa_path + ":" + glapi_path
env["GALLIUM_DRIVER"] = "softpipe"
return env
diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py
index a2c752aeebc..3351984290d 100644
--- a/python/servo/testing_commands.py
+++ b/python/servo/testing_commands.py
@@ -734,8 +734,9 @@ class MachCommands(CommandBase):
# On Linux and mac, find the OSMesa software rendering library and
# add it to the dynamic linker search path.
try:
- args = [self.get_binary_path(use_release, not use_release)]
- set_osmesa_env(args[0], os.environ)
+ bin_path = self.get_binary_path(use_release, not use_release)
+ if not set_osmesa_env(bin_path, os.environ):
+ print("Warning: Cannot set the path to OSMesa library.")
except BuildNotFound:
# This can occur when cross compiling (e.g. arm64), in which case
# we won't run the tests anyway so can safely ignore this step.