[meld] build_helpers: Move broken gsettings schema flag to distribution



commit 8af86a169b9428a8d0551e5696ea6650cc6cfd26
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun May 18 08:47:22 2014 +1000

    build_helpers: Move broken gsettings schema flag to distribution

 README                |   15 +++++++++++++--
 meld/build_helpers.py |   21 ++++-----------------
 2 files changed, 17 insertions(+), 19 deletions(-)
---
diff --git a/README b/README
index 6306462..23352c9 100644
--- a/README
+++ b/README
@@ -49,8 +49,19 @@ supports, and little else.
 Additional hacks are added to make life easier for packagers where required,
 such as:
 
-* The NO_COMPILE_SCHEMAS schemas environment variable will, if set to 1, stop
-  Meld from compiling gsettings schemas post-install.
+* Passing `--no-update-icon-cache` will stop Meld from running
+  `gtk-update-icon-cache` post-install
+* Passing `--no-compile-schemas` will stop Meld from trying to compile
+  gsettings schemas post-install
+
+These arguments need to be passed to `setup.py` itself, *not* to the install
+command. In other words, do this:
+
+    python setup.py --no-compile-schemas install
+
+**not** this:
+
+    python setup.py install --no-compile-schemas
 
 
 Contacting
diff --git a/meld/build_helpers.py b/meld/build_helpers.py
index 036676c..85fb0eb 100644
--- a/meld/build_helpers.py
+++ b/meld/build_helpers.py
@@ -58,10 +58,12 @@ distutils.command.build.build.sub_commands.extend([
 class MeldDistribution(distutils.dist.Distribution):
     global_options = distutils.dist.Distribution.global_options + [
         ("no-update-icon-cache", None, "Don't run gtk-update-icon-cache"),
+        ("no-compile-schemas", None, "Don't compile gsettings schemas"),
     ]
 
     def __init__(self, *args, **kwargs):
         self.no_update_icon_cache = False
+        self.no_compile_schemas = False
         distutils.dist.Distribution.__init__(self, *args, **kwargs)
 
 
@@ -310,22 +312,6 @@ class build_i18n(distutils.cmd.Command):
 
 class install_data(distutils.command.install_data.install_data):
 
-    user_options = [
-        ("no-compile-schemas", None,
-         "Don't compile gsettings schemas post-install"),
-    ]
-    boolean_options = ["no-compile-schemas"]
-
-    def initialize_options(self):
-        distutils.command.install_data.install_data.initialize_options(self)
-        self.no_compile_schemas = None
-
-    def finalize_options(self):
-        distutils.command.install_data.install_data.finalize_options(self)
-        if self.no_compile_schemas is None:
-            self.no_compile_schemas = bool(
-                os.environ.get('NO_COMPILE_SCHEMAS', None))
-
     def run(self):
         distutils.command.install_data.install_data.run(self)
 
@@ -335,7 +321,8 @@ class install_data(distutils.command.install_data.install_data):
             icon_path = os.path.join(self.install_dir, "share/icons/hicolor")
             self.spawn(["gtk-update-icon-cache", "-q", "-t", icon_path])
 
-        if not self.no_compile_schemas:
+        if not self.distribution.no_compile_schemas:
+            info("compiling gsettings schemas")
             gschema_path = build_data.gschemas[0][0]
             gschema_install = os.path.join(self.install_dir, gschema_path)
             self.spawn(["glib-compile-schemas", gschema_install])


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