build: Disable pygobject submodule if system version exists
authorBastien Nocera <hadess@hadess.net>
Wed, 13 Oct 2021 10:38:35 +0000 (12:38 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 13 Oct 2021 14:17:13 +0000 (14:17 +0000)
If pygobject is available on the system, its version is new enough,
don't build the older pygobject and rely on that system one.

This fixes totem not being able to use libpeas' Python support.

** (totem:544972): WARNING **: 12:04:05.407: Error initializing Python Plugin Loader: PyGObject initialization failed
ImportError: could not import gobject (version mismatch, 3.40.1 is required, found 3.38.1)

Closes: #806
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1135>

meson.build

index 73b654b..1458acc 100644 (file)
@@ -86,7 +86,7 @@ subprojects = [
   ['gstreamer-vaapi', { 'option': get_option('vaapi'), 'build-hotdoc': true}],
   ['gst-omx', { 'option': get_option('omx'), 'build-hotdoc': true}],
   ['gstreamer-sharp', { 'option': get_option('sharp') }],
-  ['pygobject', { 'option': get_option('python'), 'match_gst_version': false }],
+  ['pygobject', { 'option': get_option('python'), 'match_gst_version': false, 'sysdep': 'pygobject-3.0', 'sysdep_version': '>= 3.38.1' }],
   ['gst-python', { 'option': get_option('python')}],
   ['gst-examples', { 'option': get_option('gst-examples'), 'match_gst_versions': false}],
   ['gst-plugins-rs', { 'option': get_option('rs'), 'match_gst_version': false}],
@@ -116,10 +116,17 @@ foreach sp : subprojects
   project_name = sp[0]
   build_infos = sp[1]
   is_required = build_infos.get('option', true)
+  sysdep = build_infos.get('sysdep', '')
+  sysdep_version = build_infos.get('sysdep_version', '')
   match_gst_version = build_infos.get('match_gst_version', true)
 
   if match_gst_version
     subproj = subproject(project_name, version: gst_version, required: is_required)
+  elif sysdep != ''
+      sysdep_dep = dependency(sysdep, version: sysdep_version, required: false)
+      if not sysdep_dep.found()
+        subproj = subproject(project_name, required: is_required)
+      endif
   else
     subproj = subproject(project_name, required: is_required)
   endif