aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/command_base.py
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2018-09-03 13:54:20 +0530
committerManish Goregaokar <manishsmail@gmail.com>2018-09-11 19:34:38 +0530
commit36797801e9eda3405444cd55201104072a55a099 (patch)
tree6b3003f94f10c70cee6293bc29ef27474db0961a /python/servo/command_base.py
parenteba68a1a4947b29bcc58fbc502cb70dcc0ac71c0 (diff)
downloadservo-36797801e9eda3405444cd55201104072a55a099.tar.gz
servo-36797801e9eda3405444cd55201104072a55a099.zip
Allow WPT to be run with local gstreamer
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r--python/servo/command_base.py35
1 files changed, 24 insertions, 11 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index c997b0bcc80..cedfeb626f3 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -477,6 +477,23 @@ class CommandBase(object):
bin_folder = path.join(destination_folder, "PFiles", "Mozilla research", "Servo Tech Demo")
return path.join(bin_folder, "servo{}".format(BIN_SUFFIX))
+ def needs_gstreamer_env(self, target):
+ gstpath = path.join(self.context.topdir, "support", "linux", "gstreamer", "gstreamer")
+ if sys.platform == "linux2" and path.isdir(gstpath):
+ if not check_gstreamer_lib():
+ if "x86_64" not in (target or host_triple()):
+ raise Exception("We don't currently support using local gstreamer builds \
+ for non-x86_64, please file a bug")
+ return True
+ return False
+
+ def set_run_env(self):
+ """Some commands, like test-wpt, don't use a full build env,
+ but may still need dynamic search paths. This command sets that up"""
+ if self.needs_gstreamer_env(None):
+ gstpath = path.join(self.context.topdir, "support", "linux", "gstreamer", "gstreamer")
+ os.environ["LD_LIBRARY_PATH"] = path.join(gstpath, "lib", "x86_64-linux-gnu")
+
def build_env(self, hosts_file_path=None, target=None, is_build=False, test_unit=False):
"""Return an extended environment dictionary."""
env = os.environ.copy()
@@ -519,17 +536,13 @@ class CommandBase(object):
# Always build harfbuzz from source
env["HARFBUZZ_SYS_NO_PKG_CONFIG"] = "true"
- gstpath = path.join(os.getcwd(), "support", "linux", "gstreamer", "gstreamer")
- if sys.platform == "linux2" and path.isdir(gstpath):
- if not check_gstreamer_lib():
- if "x86_64" not in (target or host_triple()):
- raise Exception("We don't currently support using local gstreamer builds \
- for non-x86_64, please file a bug")
- extra_path += [path.join(gstpath, "bin")]
- libpath = path.join(gstpath, "lib", "x86_64-linux-gnu")
- extra_path += [libpath]
- extra_lib += [libpath]
- append_to_path_env(path.join(libpath, "pkgconfig"), env, "PKG_CONFIG_PATH")
+ if self.needs_gstreamer_env(target):
+ gstpath = path.join(self.context.topdir, "support", "linux", "gstreamer", "gstreamer")
+ extra_path += [path.join(gstpath, "bin")]
+ libpath = path.join(gstpath, "lib", "x86_64-linux-gnu")
+ extra_path += [libpath]
+ extra_lib += [libpath]
+ append_to_path_env(path.join(libpath, "pkgconfig"), env, "PKG_CONFIG_PATH")
if extra_path:
env["PATH"] = "%s%s%s" % (os.pathsep.join(extra_path), os.pathsep, env["PATH"])