From 55411a9a2bd933540e8ecda6c303e2325eb9865a Mon Sep 17 00:00:00 2001 From: Marien Zwart Date: Mon, 3 Sep 2012 12:39:09 +0200 Subject: Add a comment explaining the compatibility the getattr()ing provides. --- tools/make_schema.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tools') 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') -- cgit v1.2.1