]> git.pld-linux.org Git - packages/python-astroid.git/commitdiff
Add support for loading modules with no sources auto/th/python-astroid-1.3.6-2
authorJacek Konieczny <j.konieczny@eggsoft.pl>
Thu, 11 Jun 2015 12:14:57 +0000 (14:14 +0200)
committerJacek Konieczny <j.konieczny@eggsoft.pl>
Thu, 11 Jun 2015 12:14:57 +0000 (14:14 +0200)
workaround for the stupid 'no python sources' policy in PLD

modules_without_sources.patch [new file with mode: 0644]
python-astroid.spec

diff --git a/modules_without_sources.patch b/modules_without_sources.patch
new file mode 100644 (file)
index 0000000..c381556
--- /dev/null
@@ -0,0 +1,35 @@
+diff -dur astroid-1.3.6.orig/astroid/manager.py astroid-1.3.6/astroid/manager.py
+--- astroid-1.3.6.orig/astroid/manager.py      2015-03-14 15:04:09.000000000 +0100
++++ astroid-1.3.6/astroid/manager.py   2015-06-11 13:57:16.000000000 +0200
+@@ -144,7 +144,7 @@
+                 module = self.zip_import_data(filepath)
+                 if module is not None:
+                     return module
+-            elif mp_type in (imp.C_BUILTIN, imp.C_EXTENSION):
++            elif mp_type in (imp.C_BUILTIN, imp.C_EXTENSION, imp.PY_COMPILED):
+                 if mp_type == imp.C_EXTENSION and not self._can_load_extension(modname):
+                     return self._build_stub_module(modname)
+                 try:
+@@ -153,8 +153,6 @@
+                     msg = 'Unable to load module %s (%s)' % (modname, ex)
+                     raise AstroidBuildingException(msg)
+                 return self.ast_from_module(module, modname)
+-            elif mp_type == imp.PY_COMPILED:
+-                raise AstroidBuildingException("Unable to load compiled module %s" % (modname,))
+             if filepath is None:
+                 raise AstroidBuildingException("Unable to load module %s" % (modname,))
+             return self.ast_from_file(filepath, modname, fallback=False)
+diff -dur astroid-1.3.6.orig/astroid/modutils.py astroid-1.3.6/astroid/modutils.py
+--- astroid-1.3.6.orig/astroid/modutils.py     2015-03-09 23:00:27.000000000 +0100
++++ astroid-1.3.6/astroid/modutils.py  2015-06-11 13:57:49.000000000 +0200
+@@ -534,6 +534,10 @@
+         return None, imp.C_BUILTIN
+     elif mtype == imp.PKG_DIRECTORY:
+         mp_filename = _has_init(mp_filename)
++        try:
++            return get_source_file(mp_filename), imp.PY_SOURCE
++        except NoSourceFile:
++            return mp_filename, imp.PY_COMPILED
+         mtype = imp.PY_SOURCE
+     return mp_filename, mtype
index 06083ad2b522ae8c83df89a8f9e3c583b7f9bba3..3c3280ab8e82ba0a8ac46ffacef8bae65f876eb5 100644 (file)
@@ -8,11 +8,12 @@ Summary:      Rebuild a new abstract syntax tree from Python's AST
 Summary(pl.UTF-8):     Tworzenie nowego abstrakcyjnego drzewa składniowego z pythonowego AST
 Name:          python-%{module}
 Version:       1.3.6
-Release:       1
+Release:       2
 License:       LGPL v2.1+
 Group:         Development/Languages/Python
 Source0:       https://pypi.python.org/packages/source/a/astroid/astroid-%{version}.tar.gz
 # Source0-md5: 0d387f5b2e878f424b95af3bfe44e106
+Patch0:                modules_without_sources.patch
 URL:           http://www.astroid.org/
 %if %{with python2}
 BuildRequires: python-devel >= 1:2.7
@@ -70,6 +71,8 @@ potrzebami pylinta. Dawniej nazywała się logilab-astng.
 
 %prep
 %setup -q -n %{module}-%{version}
+
+%patch0 -p1
 # drop python 2.5 egg deps
 %{__rm} */*/*/*/*/*py2.5.egg
 
This page took 0.122882 seconds and 4 git commands to generate.