[gnome-music/wip/merge: 211/343] Load libgd from source dir if we are running there



commit 577bde318f6ea9d332f738846055db3af69a3eed
Author: Arnel A. Borja <arnelborja src gnome org>
Date:   Wed Jul 17 19:22:15 2013 +0800

    Load libgd from source dir if we are running there
    
    Makes sure that when we run inside the source dir, the source files and
    current build of libgd will be used instead of the installed ones.

 gnome-music.in |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/gnome-music.in b/gnome-music.in
index fdfcb9e..9ff1cd0 100644
--- a/gnome-music.in
+++ b/gnome-music.in
@@ -1,9 +1,24 @@
 #!/usr/bin/env python3
 
-import sys, signal
+import sys, signal, os
 sys.path.insert(1, '@pyexecdir@')
 
 from gi.repository import Gio, Gtk
+import gnomemusic
+
+srcdir = os.path.abspath(os.path.join(os.path.dirname(gnomemusic.__file__), '..'))
+if os.path.exists(os.path.join(srcdir, 'gnome-music.doap')):
+    print('Running from source tree, using local files')
+    libgd_libdir = os.path.join(srcdir, 'libgd', '.libs')
+    libgd_typelibdir = os.path.join(srcdir, 'libgd')
+else:
+    libgd_libdir = '@pkglibdir@'
+    libgd_typelibdir = '@pkglibdir@/girepository-1.0'
+
+# We use our own libgd.so, so let gi.repository find it
+from gi.repository import GIRepository
+GIRepository.Repository.prepend_search_path(libgd_typelibdir)
+GIRepository.Repository.prepend_library_path(libgd_libdir)
 
 from gnomemusic.application import Application
 
@@ -21,11 +36,6 @@ def install_excepthook():
 if __name__ == "__main__":
     install_excepthook()
 
-    # We use our own libgd.so, so let gi.repository find it
-    from gi.repository import GIRepository
-    GIRepository.Repository.prepend_search_path('@libdir@/gnome-music')
-    GIRepository.Repository.prepend_library_path('@libdir@/gnome-music')
-
     resource = Gio.resource_load("data/gnome-music.gresource")
     Gio.Resource._register(resource)
 


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