[python-astroid] - Add patch to fix gobject introspection of illegal symbol names (dshea)

Brian C. Lane bcl at fedoraproject.org
Fri Feb 28 22:35:47 UTC 2014


commit 9f85c4fadb1fcd28b1097c01b6151de43cf70272
Author: Brian C. Lane <bcl at redhat.com>
Date:   Fri Feb 28 12:05:42 2014 -0800

    - Add patch to fix gobject introspection of illegal symbol names (dshea)

 ...-illegal-symbols-in-gobject-introspection.patch |   50 ++++++++++++++++++++
 python-astroid.spec                                |    8 +++-
 2 files changed, 57 insertions(+), 1 deletions(-)
---
diff --git a/0001-Ignore-illegal-symbols-in-gobject-introspection.patch b/0001-Ignore-illegal-symbols-in-gobject-introspection.patch
new file mode 100644
index 0000000..0098b5f
--- /dev/null
+++ b/0001-Ignore-illegal-symbols-in-gobject-introspection.patch
@@ -0,0 +1,50 @@
+From 24116cfe98d40c51cbbf24059460b9910064c93e Mon Sep 17 00:00:00 2001
+From: David Shea <dshea at redhat.com>
+Date: Fri, 28 Feb 2014 12:00:52 -0800
+Subject: [PATCH] Ignore illegal symbols in gobject introspection
+
+See upstream bug:
+
+https://bitbucket.org/logilab/astroid/issue/19/syntaxerror-when-examining-gi-modules
+
+gobject introspection can result in symbols that are not valid in
+python. Ignore them.
+---
+ brain/py2gi.py | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/brain/py2gi.py b/brain/py2gi.py
+index 5001b7c..b001625 100644
+--- a/brain/py2gi.py
++++ b/brain/py2gi.py
+@@ -5,6 +5,7 @@ Helps with understanding everything imported from 'gi.repository'
+ 
+ import inspect
+ import sys
++import re
+ 
+ from astroid import MANAGER, AstroidBuildingException
+ from astroid.builder import AstroidBuilder
+@@ -12,6 +13,7 @@ from astroid.builder import AstroidBuilder
+ 
+ _inspected_modules = {}
+ 
++_identifier_re = r'^[A-Za-z_]\w*$'
+ 
+ def _gi_build_stub(parent):
+     """
+@@ -26,6 +28,11 @@ def _gi_build_stub(parent):
+         if not name or name.startswith("__"):
+             # GLib.IConv has a parameter named "" :/
+             continue
++
++        # Check if this is a valid name in python
++        if not re.match(_identifier_re, name):
++            continue
++
+         try:
+             obj = getattr(parent, name)
+         except:
+-- 
+1.8.5.3
+
diff --git a/python-astroid.spec b/python-astroid.spec
index 246e70d..2538468 100644
--- a/python-astroid.spec
+++ b/python-astroid.spec
@@ -10,13 +10,15 @@
 
 Name:           python-astroid
 Version:        1.0.1
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Python Abstract Syntax Tree New Generation
 Group:          Development/Languages
 License:        GPLv2+
 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
+
 Provides:       python-astroid = %{version}-%{release}
 Obsoletes:      python-logilab-astng <= 0.24.1
 
@@ -50,6 +52,7 @@ python module with some additional methods and attributes.
 
 %prep
 %setup -q -n logilab-astroid-%{commit}
+%patch0 -p1
 
 %if 0%{?with_python3}
 rm -rf %{py3dir}
@@ -112,6 +115,9 @@ popd
 %endif # with_python3
 
 %changelog
+* 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)
+
 * Thu Feb 27 2014 Brian C. Lane <bcl at redhat.com> 1.0.1-1
 - Upstream v1.0.1
   Drop patch included in upstream


More information about the scm-commits mailing list