diff options
author | Martin Robinson <mrobinson@igalia.com> | 2023-05-18 15:09:30 +0200 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2023-05-19 13:08:43 +0200 |
commit | 5be14ecc3cc92309637604b48bdcf249b110ac16 (patch) | |
tree | ef5f13d8e79866eda1a84c847837938c884ebb2c /python/servo/platform/base.py | |
parent | e09f85e17bd504a4c1c218ad14fa1a0ecbcaa839 (diff) | |
download | servo-5be14ecc3cc92309637604b48bdcf249b110ac16.tar.gz servo-5be14ecc3cc92309637604b48bdcf249b110ac16.zip |
Start organizing platform-specific Python code
This starts to split platform-specific Python code into its own module,
which should help to tidy up our mach commands and make things more
reusable.
Diffstat (limited to 'python/servo/platform/base.py')
-rw-r--r-- | python/servo/platform/base.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/python/servo/platform/base.py b/python/servo/platform/base.py new file mode 100644 index 00000000000..316c998b1db --- /dev/null +++ b/python/servo/platform/base.py @@ -0,0 +1,34 @@ +# Copyright 2023 The Servo Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution. +# +# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +import subprocess + + +class Base: + def _platform_bootstrap(self, _cache_dir: str, _force: bool) -> bool: + raise NotImplementedError("Bootstrap installation detection not yet available.") + + def _platform_bootstrap_gstreamer(self, _cache_dir: str, _force: bool) -> bool: + raise NotImplementedError("GStreamer bootstrap support is not yet available for your OS.") + + def _platform_is_gstreamer_installed(self) -> bool: + return subprocess.call( + ["pkg-config", "--atleast-version=1.16", "gstreamer-1.0"], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0 + + def bootstrap(self, cache_dir: str, force: bool): + if not self._platform_bootstrap(cache_dir, force): + print("Dependencies were already installed!") + + def bootstrap_gstreamer(self, cache_dir: str, force: bool): + if not self._platform_bootstrap_gstreamer(cache_dir, force): + print("Dependencies were already installed!") + + def is_gstreamer_installed(self) -> bool: + return self._platform_is_gstreamer_installed() |