[jhbuild] [config] Add explanatory comments and simplify the special gconf support



commit 7e4e50c6387517769001241fd57e3e5f9aecc296
Author: Frédéric Péters <fpeters 0d be>
Date:   Tue Jun 23 21:01:02 2009 +0200

    [config] Add explanatory comments and simplify the special gconf support

 jhbuild/config.py |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/jhbuild/config.py b/jhbuild/config.py
index 1aaf623..cf4b16d 100644
--- a/jhbuild/config.py
+++ b/jhbuild/config.py
@@ -413,28 +413,30 @@ class Config:
         os.environ['MONO_PREFIX'] = self.prefix
         os.environ['MONO_GAC_PREFIX'] = self.prefix
 
-        # GConf
+        # GConf:
+        # Create a GConf source path file that tells GConf to use the data in
+        # the jhbuild prefix (in addition to the data in the system prefix),
+        # and point to it with GCONF_DEFAULT_SOURCE_PATH so modules will be read
+        # the right data (assuming a new enough libgconf).
         gconfdir = os.path.join(self.prefix, 'etc', 'gconf')
         gconfpathdir = os.path.join(gconfdir, '2')
         if not os.path.exists(gconfpathdir):
             os.makedirs(gconfpathdir)
         gconfpath = os.path.join(gconfpathdir, 'path.jhbuild')
-        if not os.path.exists(gconfpath):
+        if not os.path.exists(gconfpath) and os.path.exists('/etc/gconf/2/path'):
             try:
-                inp = open('/etc/gconf/2/path')
-                out = open(gconfpath, 'w')
-                for line in inp:
-                    if line.find('/etc/gconf') != -1:
-                        out.write(line.replace('/etc/gconf', gconfdir))
-                    out.write(line)
-                out.close()
-                inp.close()
+                file(gconfpath, 'w').write(
+                        file('/etc/gconf/2/path').read().replace('/etc/gconf', gconfdir))
             except:
                 traceback.print_exc()
                 raise FatalError(_('Could not create GConf config (%s)') % gconfpath)
-
         os.environ['GCONF_DEFAULT_SOURCE_PATH'] = gconfpath
-        os.environ['GCONF_SCHEMA_INSTALL_SOURCE'] = 'xml:merged:' + os.path.join(gconfdir, 'gconf.xml.defaults')
+
+        # Set GCONF_SCHEMA_INSTALL_SOURCE to point into the jhbuild prefix so
+        # modules will install their schemas there (rather than failing to
+        # install them into /etc).
+        os.environ['GCONF_SCHEMA_INSTALL_SOURCE'] = 'xml:merged:' + os.path.join(
+                gconfdir, 'gconf.xml.defaults')
 
         # handle environment prepends ...
         for envvar in env_prepends.keys():



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