From 9cb1e4083eb4ab93b7d1a83d5753cf69e3712f42 Mon Sep 17 00:00:00 2001
Message-Id: <9cb1e4083eb4ab93b7d1a83d5753cf69e3712f42.1395496594.git.crobinso@redhat.com>
From: Cole Robinson <crobinso@redhat.com>
Date: Sat, 22 Mar 2014 09:11:00 -0400
Subject: [PATCH] brain: py2gi: Fix function detection on newer pygobject
Fallback to assuming anything callable is a function, and everything else
is a constant. This covers some special constants that use module
defined classes, like Gdk.Atom
---
brain/py2gi.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/brain/py2gi.py b/brain/py2gi.py
index b001625..bcaea4b 100644
--- a/brain/py2gi.py
+++ b/brain/py2gi.py
@@ -53,6 +53,12 @@ def _gi_build_stub(parent):
str(obj).startswith("<GType ") or
inspect.isdatadescriptor(obj)):
constants[name] = 0
+ elif callable(obj):
+ # Fall back to a function for anything callable
+ functions[name] = obj
+ else:
+ # Assume everything else is some manner of constant
+ constants[name] = 0
ret = ""
--
1.8.5.3