[meld] bin/meld: Recompile gschemas based on schema mtime check (bgo#739267)



commit 982f386570f403ddec702f7db548d79de52fee83
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Nov 9 07:27:35 2014 +1000

    bin/meld: Recompile gschemas based on schema mtime check (bgo#739267)
    
    When checking whether we have a compiled version of the schemas, we now
    also check to see whether it looks like it's actually current, based on
    the relative mtimes of the source and compiled schema files.
    
    This keeps biting people running from source whenever we change the
    schemas. While this fix isn't exactly elegant, it's better than
    constantly running into the problem, since that's what the
    autocompiling-the-schemas hack was added for in the first place.

 bin/meld |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/bin/meld b/bin/meld
index ce3a783..d25f003 100755
--- a/bin/meld
+++ b/bin/meld
@@ -217,8 +217,17 @@ def setup_resources():
 def setup_settings():
     import meld.conf
 
-    schema_path = os.path.join(meld.conf.DATADIR, "gschemas.compiled")
-    if uninstalled and not os.path.exists(schema_path):
+    schema_path = os.path.join(meld.conf.DATADIR, "org.gnome.meld.gschema.xml")
+    compiled_schema_path = os.path.join(meld.conf.DATADIR, "gschemas.compiled")
+
+    try:
+        schema_mtime = os.path.getmtime(schema_path)
+        compiled_mtime = os.path.getmtime(compiled_schema_path)
+        have_schema = schema_mtime < compiled_mtime
+    except OSError:
+        have_schema = False
+
+    if uninstalled and not have_schema:
         subprocess.call(["glib-compile-schemas", meld.conf.DATADIR],
                         cwd=melddir)
 


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