aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/platform/macos.py
diff options
context:
space:
mode:
authorbors-servo <infra@servo.org>2023-05-19 13:09:29 +0200
committerGitHub <noreply@github.com>2023-05-19 13:09:29 +0200
commit71c5bb02b41b8d98b1612563558c2c14b3e20b1a (patch)
tree3896fe2ce7741ae30e67dbe1f5c84acb0272c087 /python/servo/platform/macos.py
parent42332e588849aa5451f81e976dea0d1c19ea7a1b (diff)
parent5be14ecc3cc92309637604b48bdcf249b110ac16 (diff)
downloadservo-71c5bb02b41b8d98b1612563558c2c14b3e20b1a.tar.gz
servo-71c5bb02b41b8d98b1612563558c2c14b3e20b1a.zip
Auto merge of #29754 - mrobinson:organize-python-by-platform, r=mukilan
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. This is step one toward fixing #25335. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because they just change mach scripts. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'python/servo/platform/macos.py')
-rw-r--r--python/servo/platform/macos.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/python/servo/platform/macos.py b/python/servo/platform/macos.py
new file mode 100644
index 00000000000..6189140cabf
--- /dev/null
+++ b/python/servo/platform/macos.py
@@ -0,0 +1,36 @@
+# 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 os
+import subprocess
+
+from .base import Base
+from ..gstreamer import macos_gst_root
+
+
+class MacOS(Base):
+ def __init__(self):
+ pass
+
+ def _platform_is_gstreamer_installed(self) -> bool:
+ # We override homebrew gstreamer if installed and always use pkgconfig
+ # from official gstreamer framework.
+ try:
+ gst_root = macos_gst_root()
+ env = os.environ.copy()
+ env["PATH"] = os.path.join(gst_root, "bin")
+ env["PKG_CONFIG_PATH"] = os.path.join(gst_root, "lib", "pkgconfig")
+ has_gst = subprocess.call(
+ ["pkg-config", "--atleast-version=1.21", "gstreamer-1.0"],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) == 0
+ gst_lib_dir = subprocess.check_output(
+ ["pkg-config", "--variable=libdir", "gstreamer-1.0"], env=env)
+ return has_gst and gst_lib_dir.startswith(bytes(gst_root, 'utf-8'))
+ except FileNotFoundError:
+ return False