Back to development
[platform/upstream/gstreamer.git] / subprojects / gstreamer-sharp / update_sources.py
1 #!/usr/bin/env python3
2
3 import subprocess
4 import os
5 import sys
6 import shutil
7
8 def accept_command(commands):
9     """Search @commands and returns the first found absolute path."""
10     for command in commands:
11         command = shutil.which(command)
12         if command:
13             return command
14
15     return None
16
17 if __name__ == "__main__":
18     ninja = accept_command(["ninja", "ninja-build"])
19     buildroot = os.environ["MESON_BUILD_ROOT"]
20
21     bindinate  = False
22     if len(sys.argv) > 1 and sys.argv[1] == "bindinate":
23         bindinate  = True
24
25     print("Building all code")
26     subprocess.check_call([ninja, "-C", buildroot])
27
28     if 'gstreamer-sharp' in os.environ['MESON_SUBDIR']:
29         subproject_prefix = 'gstreamer-sharp@@'
30     else:
31         subproject_prefix = ''
32
33     if bindinate:
34         print("Bindinate GStreamer")
35         subprocess.check_call([ninja, "-C", buildroot, subproject_prefix + "bindinate_gstreamer"])
36
37     print("Update GStreamer bindings")
38     subprocess.check_call([ninja, "-C", buildroot, subproject_prefix + "update_gstreamer_code"])
39
40     if bindinate:
41         print("Bindinate GES")
42         subprocess.check_call([ninja, "-C", buildroot, subproject_prefix + "bindinate_ges"])
43     print("Update GES bindings")
44     subprocess.check_call([ninja, "-C", buildroot, subproject_prefix + "update_ges_code"])
45
46     print("Building all code")
47     subprocess.check_call([ninja, "-C", buildroot])