[caribou] Add a comment explaining the compatibility the getattr()ing provides.



commit 55411a9a2bd933540e8ecda6c303e2325eb9865a
Author: Marien Zwart <marien zwart gmail com>
Date:   Mon Sep 3 12:39:09 2012 +0200

    Add a comment explaining the compatibility the getattr()ing provides.

 tools/make_schema.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/tools/make_schema.py b/tools/make_schema.py
index cd255d6..7237ac4 100755
--- a/tools/make_schema.py
+++ b/tools/make_schema.py
@@ -56,6 +56,14 @@ class SchemasMaker:
             key.setAttribute('name', setting.gsettings_key)
             key.setAttribute('type', setting.variant_type)
             schemalist.appendChild(key)
+            # pygobject >= 3.3.3 and up expose g_variant_print as
+            # "print_". Older pygobjects expose it as "print", which
+            # we need to use through getattr as "print" is a keyword.
+            #
+            # Try the new name first, fall back to the old one if unavailable.
+            #
+            # Once we depend on pygobject >= 3.4 we can just call
+            # setting.gvariant.print_(False) directly.
             printfunc = getattr(setting.gvariant, 'print_', None)
             if printfunc is None:
                 printfunc = getattr(setting.gvariant, 'print')



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