[python-astroid] Fix some gobject introspection false positives (bz #1079643)

Cole Robinson crobinso at fedoraproject.org
Tue Apr 1 14:36:40 UTC 2014


commit 705768c388ff261f92b471e5fc0a3498520adb06
Author: Cole Robinson <crobinso at redhat.com>
Date:   Tue Apr 1 10:36:51 2014 -0400

    Fix some gobject introspection false positives (bz #1079643)

 ...-Fix-function-detection-on-newer-pygobjec.patch |   33 ++++++++++++++++++++
 python-astroid.spec                                |   11 ++++++-
 2 files changed, 43 insertions(+), 1 deletions(-)
---
diff --git a/0002-brain-py2gi-Fix-function-detection-on-newer-pygobjec.patch b/0002-brain-py2gi-Fix-function-detection-on-newer-pygobjec.patch
new file mode 100644
index 0000000..219ca78
--- /dev/null
+++ b/0002-brain-py2gi-Fix-function-detection-on-newer-pygobjec.patch
@@ -0,0 +1,33 @@
+From 9cb1e4083eb4ab93b7d1a83d5753cf69e3712f42 Mon Sep 17 00:00:00 2001
+Message-Id: <9cb1e4083eb4ab93b7d1a83d5753cf69e3712f42.1395496594.git.crobinso at redhat.com>
+From: Cole Robinson <crobinso at 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
+
diff --git a/python-astroid.spec b/python-astroid.spec
index 2538468..7bddd00 100644
--- a/python-astroid.spec
+++ b/python-astroid.spec
@@ -10,7 +10,7 @@
 
 Name:           python-astroid
 Version:        1.0.1
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        Python Abstract Syntax Tree New Generation
 Group:          Development/Languages
 License:        GPLv2+
@@ -18,6 +18,9 @@ URL:            http://www.astroid.org
 Source0:        https://bitbucket.org/logilab/astroid/get/astroid-version-%{version}.tar.bz2
 
 Patch0:         0001-Ignore-illegal-symbols-in-gobject-introspection.patch
+# Fix some gobject introspection false positives (bz #1079643)
+Patch1: 0002-brain-py2gi-Fix-function-detection-on-newer-pygobjec.patch
+
 
 Provides:       python-astroid = %{version}-%{release}
 Obsoletes:      python-logilab-astng <= 0.24.1
@@ -52,7 +55,10 @@ python module with some additional methods and attributes.
 
 %prep
 %setup -q -n logilab-astroid-%{commit}
+
 %patch0 -p1
+# Fix some gobject introspection false positives (bz #1079643)
+%patch1 -p1
 
 %if 0%{?with_python3}
 rm -rf %{py3dir}
@@ -115,6 +121,9 @@ popd
 %endif # with_python3
 
 %changelog
+* Tue Apr 01 2014 Cole Robinson <crobinso at redhat.com> - 1.0.1-3
+- Fix some gobject introspection false positives (bz #1079643)
+
 * Fri Feb 28 2014 Brian C. Lane <bcl at redhat.com> 1.0.1-2
 - Add patch to fix gobject introspection of illegal symbol names (dshea)
 


More information about the scm-commits mailing list