[pitivi: 2/3] Allow passing custom LD_LIBRARY_PATH and GST_PLUGIN_PATH to configure.



commit ed1057818fe7e7b9e82be80eecc9154a61f8944e
Author: Alessandro Decina <alessandro d gmail com>
Date:   Mon Jun 7 19:09:51 2010 +0200

    Allow passing custom LD_LIBRARY_PATH and GST_PLUGIN_PATH to configure.

 bin/pitivi.in |   22 ++++++++++++++++++++--
 configure.ac  |    6 ++++++
 2 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/bin/pitivi.in b/bin/pitivi.in
index 25b6d75..db19ed9 100644
--- a/bin/pitivi.in
+++ b/bin/pitivi.in
@@ -28,6 +28,8 @@ import gettext
 
 # variables
 CONFIGURED_PYTHONPATH = '@CONFIGURED_PYTHONPATH@'
+CONFIGURED_LD_LIBRARY_PATH = '@CONFIGURED_LD_LIBRARY_PATH@'
+CONFIGURED_GST_PLUGIN_PATH = '@CONFIGURED_GST_PLUGIN_PATH@'
 LIBDIR = '@LIBDIR@'
 
 localedir = ""
@@ -45,6 +47,14 @@ def _in_devel():
             os.path.exists(os.path.join(rd, 'CVS')) or
             os.path.exists(os.path.join(rd, '.git')))
 
+def _prepend_env_path(name, value):
+    os.environ[name] = os.pathsep.join(value +
+            os.environ.get(name, "").split(os.pathsep))
+
+def jump_through_hoops():
+    os.environ["JUMP_THROUGH_HOOPS"] = "1"
+    os.execv(sys.argv[0], sys.argv)
+
 def _add_pitivi_path():
     global localedir
     dir = os.path.dirname(os.path.abspath(__file__))
@@ -77,6 +87,14 @@ def _add_pitivi_path():
     except:
         print "Couldn't set locale !, reverting to C locale"
 
+    if CONFIGURED_LD_LIBRARY_PATH or CONFIGURED_GST_PLUGIN_PATH:
+        _prepend_env_path("LD_LIBRARY_PATH", [CONFIGURED_LD_LIBRARY_PATH])
+        _prepend_env_path("GST_PLUGIN_PATH", [CONFIGURED_GST_PLUGIN_PATH])
+
+        if "JUMP_THROUGH_HOOPS" not in os.environ:
+            # ld caches LD_LIBRARY_PATH at startup so we need to execv() here. LALA.
+            jump_through_hoops()
+
 def _init_gobject_gtk_gst():
     global localedir
     try:
@@ -87,8 +105,8 @@ def _init_gobject_gtk_gst():
 
         import gobject
         gobject.threads_init()
-    except ImportError:
-        raise SystemExit("PyGTK couldn't be found !")
+    except ImportError, e:
+        raise SystemExit("PyGTK couldn't be found !", str(e))
 
     gobject.threads_init()
 
diff --git a/configure.ac b/configure.ac
index 66ddb6e..a62126b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,12 @@ IT_PROG_INTLTOOL([0.35.0])
 CONFIGURED_PYTHONPATH=$PYTHONPATH
 AC_SUBST(CONFIGURED_PYTHONPATH)
 
+CONFIGURED_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
+AC_SUBST(CONFIGURED_LD_LIBRARY_PATH)
+
+CONFIGURED_GST_PLUGIN_PATH=$GST_PLUGIN_PATH
+AC_SUBST(CONFIGURED_GST_PLUGIN_PATH)
+
 AC_CONFIG_FILES([bin/pitivi], [chmod +x bin/pitivi])
 
 dnl output stuff



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