diff --git a/0001-brain-gi-fix-glib-detection-1141440.patch b/0001-brain-gi-fix-glib-detection-1141440.patch new file mode 100644 index 0000000..547e4ca --- /dev/null +++ b/0001-brain-gi-fix-glib-detection-1141440.patch @@ -0,0 +1,58 @@ +From c6d5b3e4cda0d7b803a50652503405087860737e Mon Sep 17 00:00:00 2001 +Message-Id: +From: Cole Robinson +Date: Sat, 13 Sep 2014 07:56:42 -0400 +Subject: [PATCH] brain: gi: fix glib detection + +pygobject has some special hidden modules that we need to inspect +for glib and gobject. However, on latest pygobject, the hidden glib +module has been removed, which caused pylint to fail to detect +glib whatsoever. + +Tread errors in processing these hidden modules as non-fatal. + +Closes astroid issue #49 +--- + brain/py2gi.py | 23 ++++++++++++++++------- + 1 file changed, 16 insertions(+), 7 deletions(-) + +diff --git a/brain/py2gi.py b/brain/py2gi.py +index dd9868d..3b74cb2 100644 +--- a/brain/py2gi.py ++++ b/brain/py2gi.py +@@ -134,17 +134,26 @@ def _new_import_module(self, modname, relative_only=False, level=None): + # build astroid representation unless we already tried so + if modname not in _inspected_modules: + modnames = [modname] +- # GLib and GObject have some special case handling +- # in pygobject that we need to cope with ++ optional_modnames = [] ++ ++ # GLib and GObject may have some special case handling ++ # in pygobject that we need to cope with. However at ++ # least as of pygobject3-3.13.91 the _glib module doesn't ++ # exist anymore, so if treat these modules as optional. + if modname == 'gi.repository.GLib': +- modnames.append('gi._glib') ++ optional_modnames.append('gi._glib') + elif modname == 'gi.repository.GObject': +- modnames.append('gi._gobject') ++ optional_modnames.append('gi._gobject') ++ + try: + modcode = '' +- for m in modnames: +- __import__(m) +- modcode += _gi_build_stub(sys.modules[m]) ++ for m in modnames + optional_modnames: ++ try: ++ __import__(m) ++ modcode += _gi_build_stub(sys.modules[m]) ++ except ImportError: ++ if m not in optional_modnames: ++ raise + except ImportError: + astng = _inspected_modules[modname] = None + else: +-- +2.1.0 diff --git a/python-astroid.spec b/python-astroid.spec index 2871add..9e20a10 100644 --- a/python-astroid.spec +++ b/python-astroid.spec @@ -10,12 +10,13 @@ Name: python-astroid Version: 1.2.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}.tar.bz2 +Patch0: 0001-brain-gi-fix-glib-detection-1141440.patch Provides: python-astroid = %{version}-%{release} Obsoletes: python-logilab-astng <= 0.24.1 @@ -50,6 +51,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 +114,10 @@ popd %endif # with_python3 %changelog +* Fri Oct 17 2014 Brian C. Lane 1.2.1-2 +- Add patch to fix GLib detection (#1141440) + https://bitbucket.org/logilab/astroid/issue/49 + * Fri Oct 03 2014 Brian C. Lane 1.2.1-1 - Upstream v1.2.1 Drop patches now included in upstream