From 81c439a8990caf498bd3318cbe5f51c33830f7e3 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Wed, 20 Nov 2019 13:24:21 +0000 Subject: [PATCH] Extract media_stack pick into CommandBase --- python/servo/build_commands.py | 13 +------------ python/servo/command_base.py | 13 +++++++++++++ python/servo/devenv_commands.py | 13 +------------ python/servo/post_build_commands.py | 13 +------------ 4 files changed, 16 insertions(+), 36 deletions(-) diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index effcd8676c5..8f462939b5b 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -191,18 +191,7 @@ class MachCommands(CommandBase): if not uwp: uwp = target and 'uwp' in target - # A guess about which platforms should use the gstreamer media stack - if not(media_stack): - if ( - not(target) or - ("armv7" in target and "android" in target) or - ("x86_64" in target) - ): - media_stack = "gstreamer" - else: - media_stack = "dummy" - - features += ["media-" + media_stack] + features += self.pick_media_stack(media_stack, target) target_path = base_path = self.get_target_dir() if android: diff --git a/python/servo/command_base.py b/python/servo/command_base.py index e1b8695ec5f..5a8818333a9 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -862,6 +862,19 @@ install them, let us know by filing a bug!") android = self.handle_android_target(target) return target, android + # A guess about which platforms should use the gstreamer media stack + def pick_media_stack(self, media_stack, target): + if not(media_stack): + if ( + not(target) or + ("armv7" in target and "android" in target) or + ("x86_64" in target) + ): + media_stack = "gstreamer" + else: + media_stack = "dummy" + return ["media-" + media_stack] + def run_cargo_build_like_command( self, command, cargo_args, env=None, verbose=False, diff --git a/python/servo/devenv_commands.py b/python/servo/devenv_commands.py index 1a29fc5f118..45a3f946f38 100644 --- a/python/servo/devenv_commands.py +++ b/python/servo/devenv_commands.py @@ -47,18 +47,7 @@ class MachCommands(CommandBase): target, android = self.pick_target_triple(target, android, magicleap) - # A guess about which platforms should use the gstreamer media stack - if not(media_stack): - if ( - not(target) or - ("armv7" in target and "android" in target) or - ("x86_64" in target) - ): - media_stack = "gstreamer" - else: - media_stack = "dummy" - - features += ["media-" + media_stack] + features += self.pick_media_stack(media_stack, target) self.ensure_bootstrapped() self.ensure_clobbered() diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py index 4cc7e69318f..a6ab4de647c 100644 --- a/python/servo/post_build_commands.py +++ b/python/servo/post_build_commands.py @@ -272,18 +272,7 @@ class PostBuildCommands(CommandBase): target, android = self.pick_target_triple(target, android, magicleap) - # A guess about which platforms should use the gstreamer media stack - if not(media_stack): - if ( - not(target) or - ("armv7" in target and "android" in target) or - ("x86_64" in target) - ): - media_stack = "gstreamer" - else: - media_stack = "dummy" - - features += ["media-" + media_stack] + features += self.pick_media_stack(media_stack, target) returncode = self.run_cargo_build_like_command("doc", params, features=features, **kwargs) if returncode: