[pitivi] Make sure that flatpak gst-python overrides are always used first.



commit 7e23dd7abea1d8be82f1956a6df1cdd808f6ee23
Author: Thibault Saunier <tsaunier gnome org>
Date:   Tue Sep 19 21:39:42 2017 -0300

    Make sure that flatpak gst-python overrides are always used first.
    
    Reviewed-by: Alex Băluț <<alexandru balut gmail com>>
    Differential Revision: https://phabricator.freedesktop.org/D1863

 bin/pitivi.in     |    8 ++++++--
 tests/__init__.py |    9 +++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/bin/pitivi.in b/bin/pitivi.in
index 3a2cf15..30fb3bd 100755
--- a/bin/pitivi.in
+++ b/bin/pitivi.in
@@ -67,12 +67,16 @@ def _add_pitivi_path():
         exit(1)
 
     # Let Gst overrides from our prefix take precedence over any
-    # other, making sure they are used. This allows us to ensure that
-    # Gst overrides from gst-python are used when within flatpak
+    # other, making sure they are used.
     local_overrides = os.path.join(LIBDIR, "python" + sys.version[:3],
                                    "site-packages", "gi", "overrides")
     gi.overrides.__path__.insert(0, local_overrides)
 
+    # Make sure that flatpak gst-python overrides are always used first.
+    flatpak_gst_python_path = os.path.join("/app/lib/", "python" + sys.version[:3],
+                                           "site-packages", "gi", "overrides")
+    if os.path.exists(flatpak_gst_python_path):
+        gi.overrides.__path__.insert(0, flatpak_gst_python_path)
     dir = os.path.dirname(os.path.abspath(__file__))
     if _in_devel():
         root = os.path.split(dir)[0]
diff --git a/tests/__init__.py b/tests/__init__.py
index 3cfbf1d..1e7d4a0 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -45,13 +45,18 @@ def setup():
     from pitivi import configure
 
     # Let Gst overrides from our prefix take precedence over any
-    # other, making sure they are used. This allows us to ensure that
-    # Gst overrides from gst-python are used when within flatpak
+    # other, making sure they are used.
     local_overrides = os.path.join(configure.LIBDIR,
                                    "python" + sys.version[:3],
                                    "site-packages", "gi", "overrides")
     gi.overrides.__path__.insert(0, local_overrides)
 
+    # Make sure that flatpak gst-python overrides are always used first.
+    flatpak_gst_python_path = os.path.join("/app/lib/", "python" + sys.version[:3],
+                                           "site-packages", "gi", "overrides")
+    if os.path.exists(flatpak_gst_python_path):
+        gi.overrides.__path__.insert(0, flatpak_gst_python_path)
+
     # Make available the compiled C code.
     sys.path.append(configure.BUILDDIR)
     subproject_paths = os.path.join(configure.BUILDDIR, "subprojects", "gst-transcoder")


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]