[meld/meld-3-18: 2/4] Use external help in frozen installation, like uninstalled (#197)



commit aafea31928d553c8c10efa58638ff221c86d7ff1
Author: Vasily Galkin <galkin-vv ya ru>
Date:   Wed May 30 22:13:22 2018 +0300

    Use external help in frozen installation, like uninstalled (#197)
    
    There were two different UNINSTALLED_* flags for
    uninstalled/frozen installations. Every flag had a single use.
    
    In #197 it turns out that showing offline help in frozen installation
    can fail since frozen installation is quite "portable"
    so it can be problematic to rely on system tool for showing help.
    (actually I'm not completely sure how freezing is typically
    used on non-windows, but non-windows freezing doesn't look popular)
    
    So simple fix of #197 is to merge flags, because the single case
    that was different (trying to sho help in frozen state) is the bug case.
    So it looks that single flag indicating that meld can assume that
    it's data is installed in "global" system prefixes is enough.

 meld/conf.py     | 14 +++++++-------
 meld/meldapp.py  |  2 +-
 meld/settings.py |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/meld/conf.py b/meld/conf.py
index d4cfade9..883a6503 100644
--- a/meld/conf.py
+++ b/meld/conf.py
@@ -9,8 +9,9 @@ __version__ = "3.18.2"
 DATADIR = os.path.join(sys.prefix, "share", "meld")
 LOCALEDIR = os.path.join(sys.prefix, "share", "locale")
 # END
-UNINSTALLED = False
-UNINSTALLED_SCHEMA = False
+
+# Flag enabling some workarounds if data dir isn't installed in standard prefix
+DATADIR_IS_UNINSTALLED = False
 PYTHON_REQUIREMENT_TUPLE = (3, 3)
 
 # Installed from main script
@@ -19,13 +20,13 @@ ngettext = lambda x, *args: x
 
 
 def frozen():
-    global DATADIR, LOCALEDIR, UNINSTALLED_SCHEMA
+    global DATADIR, LOCALEDIR, DATADIR_IS_UNINSTALLED
 
     melddir = os.path.dirname(sys.executable)
 
     DATADIR = os.path.join(melddir, "share", "meld")
     LOCALEDIR = os.path.join(melddir, "share", "mo")
-    UNINSTALLED_SCHEMA = True
+    DATADIR_IS_UNINSTALLED = True
 
     # This first bit should be unnecessary, but some things (GTK icon theme
     # location, GSettings schema location) don't fall back correctly.
@@ -35,14 +36,13 @@ def frozen():
 
 
 def uninstalled():
-    global DATADIR, LOCALEDIR, UNINSTALLED, UNINSTALLED_SCHEMA
+    global DATADIR, LOCALEDIR, DATADIR_IS_UNINSTALLED
     melddir = os.path.abspath(os.path.join(
         os.path.dirname(os.path.realpath(__file__)), ".."))
 
     DATADIR = os.path.join(melddir, "data")
     LOCALEDIR = os.path.join(melddir, "build", "mo")
-    UNINSTALLED = True
-    UNINSTALLED_SCHEMA = True
+    DATADIR_IS_UNINSTALLED = True
 
     # This first bit should be unnecessary, but some things (GTK icon theme
     # location, GSettings schema location) don't fall back correctly.
diff --git a/meld/meldapp.py b/meld/meldapp.py
index c1bbafcf..72b5385b 100644
--- a/meld/meldapp.py
+++ b/meld/meldapp.py
@@ -109,7 +109,7 @@ class MeldApp(Gtk.Application):
         meld.preferences.PreferencesDialog(self.get_active_window())
 
     def help_callback(self, action, parameter):
-        if meld.conf.UNINSTALLED:
+        if meld.conf.DATADIR_IS_UNINSTALLED:
             uri = "http://meldmerge.org/help/";
         else:
             uri = "help:meld"
diff --git a/meld/settings.py b/meld/settings.py
index ee4d02f6..7f9f9ead 100644
--- a/meld/settings.py
+++ b/meld/settings.py
@@ -79,7 +79,7 @@ class MeldSettings(GObject.GObject):
 
 
 def load_settings_schema(schema_id):
-    if meld.conf.UNINSTALLED_SCHEMA:
+    if meld.conf.DATADIR_IS_UNINSTALLED:
         schema_source = Gio.SettingsSchemaSource.new_from_directory(
             meld.conf.DATADIR,
             Gio.SettingsSchemaSource.get_default(),


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