From 092a3596dfde796b80ba22a8212ed1c3dde79df7 Mon Sep 17 00:00:00 2001 From: Brian C. Lane Date: Dec 10 2015 22:26:35 +0000 Subject: - Upstream 1.4.1 - Drop included patches - Drop requirement on logilab-common - Add requirement on python-wrapt and python-lazy-object-proxy - New upstream source from GitHub - Fix a couple of test failures - UnicodeEncodeError in AsStringVisitor.visit_functiondef https://bitbucket.org/logilab/astroid/issues/273/regression-unicodeencodeerror-in - Remove %check section, the full tests cannot be run because of un-packaged requirements --- diff --git a/.gitignore b/.gitignore index b27827f..f67ec9c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ /astroid-1.3.4.tar.bz2 /astroid-1.3.6.tar.bz2 /astroid-1.3.7.tar.bz2 +/astroid-1.4.1.tar.bz2 +/astroid-1.4.1.tar.gz diff --git a/0001-Fix-multiprocessing-on-py3.4.patch b/0001-Fix-multiprocessing-on-py3.4.patch deleted file mode 100644 index 1fbb3b8..0000000 --- a/0001-Fix-multiprocessing-on-py3.4.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 1d81b5521c1567fb11f680b1e6386b073b2f7a4d Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Tue, 28 Apr 2015 09:58:03 -0700 -Subject: [PATCH] Fix multiprocessing on py3.4 - ---- - astroid/brain/py2stdlib.py | 83 +++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 82 insertions(+), 1 deletion(-) - -diff --git a/astroid/brain/py2stdlib.py b/astroid/brain/py2stdlib.py -index 2bfcbcd..54cf2a7 100644 ---- a/astroid/brain/py2stdlib.py -+++ b/astroid/brain/py2stdlib.py -@@ -12,7 +12,7 @@ from textwrap import dedent - - from astroid import ( - MANAGER, AsStringRegexpPredicate, -- UseInferenceDefault, inference_tip, -+ UseInferenceDefault, inference_tip, BoundMethod, - YES, InferenceError, register_module_extender) - from astroid import exceptions - from astroid import nodes -@@ -20,6 +20,7 @@ from astroid.builder import AstroidBuilder - - PY3K = sys.version_info > (3, 0) - PY33 = sys.version_info >= (3, 3) -+PY34 = sys.version_info >= (3, 4) - - # general function - -@@ -322,6 +323,83 @@ def infer_enum_class(node): - break - return node - -+def multiprocessing_transform(): -+ module = AstroidBuilder(MANAGER).string_build(dedent(''' -+ from multiprocessing.managers import SyncManager -+ def Manager(): -+ return SyncManager() -+ ''')) -+ if not PY34: -+ return module -+ -+ # On Python 3.4, multiprocessing uses a getattr lookup inside contexts, -+ # in order to get the attributes they need. Since it's extremely -+ # dynamic, we use this approach to fake it. -+ node = AstroidBuilder(MANAGER).string_build(dedent(''' -+ from multiprocessing.context import DefaultContext, BaseContext -+ default = DefaultContext() -+ base = BaseContext() -+ ''')) -+ try: -+ context = next(node['default'].infer()) -+ base = next(node['base'].infer()) -+ except InferenceError: -+ return module -+ -+ for node in (context, base): -+ for key, value in node.locals.items(): -+ if key.startswith("_"): -+ continue -+ -+ value = value[0] -+ if isinstance(value, nodes.Function): -+ # We need to rebound this, since otherwise -+ # it will have an extra argument (self). -+ value = BoundMethod(value, node) -+ module[key] = value -+ return module -+ -+def multiprocessing_managers_transform(): -+ return AstroidBuilder(MANAGER).string_build(dedent(''' -+ import array -+ import threading -+ import multiprocessing.pool as pool -+ -+ import six -+ -+ class Namespace(object): -+ pass -+ -+ class Value(object): -+ def __init__(self, typecode, value, lock=True): -+ self._typecode = typecode -+ self._value = value -+ def get(self): -+ return self._value -+ def set(self, value): -+ self._value = value -+ def __repr__(self): -+ return '%s(%r, %r)'%(type(self).__name__, self._typecode, self._value) -+ value = property(get, set) -+ -+ def Array(typecode, sequence, lock=True): -+ return array.array(typecode, sequence) -+ -+ class SyncManager(object): -+ Queue = JoinableQueue = six.moves.queue.Queue -+ Event = threading.Event -+ RLock = threading.RLock -+ BoundedSemaphore = threading.BoundedSemaphore -+ Condition = threading.Condition -+ Barrier = threading.Barrier -+ Pool = pool.Pool -+ list = list -+ dict = dict -+ Value = Value -+ Array = Array -+ Namespace = Namespace -+ ''')) -+ - - MANAGER.register_transform(nodes.CallFunc, inference_tip(infer_named_tuple), - looks_like_namedtuple) -@@ -332,3 +410,6 @@ register_module_extender(MANAGER, 'hashlib', hashlib_transform) - register_module_extender(MANAGER, 'collections', collections_transform) - register_module_extender(MANAGER, 'pkg_resources', pkg_resources_transform) - register_module_extender(MANAGER, 'subprocess', subprocess_transform) -+register_module_extender(MANAGER, 'multiprocessing.managers', -+ multiprocessing_managers_transform) -+register_module_extender(MANAGER, 'multiprocessing', multiprocessing_transform) --- -2.1.0 - diff --git a/0001-UnicodeEncodeError-in-AsStringVisitor.visit_function.patch b/0001-UnicodeEncodeError-in-AsStringVisitor.visit_function.patch new file mode 100644 index 0000000..13d2a2d --- /dev/null +++ b/0001-UnicodeEncodeError-in-AsStringVisitor.visit_function.patch @@ -0,0 +1,68 @@ +From 9a6736f8e714297eb11bbbbfd7e01db5396673ec Mon Sep 17 00:00:00 2001 +From: Fedora Ninjas +Date: Mon, 30 Nov 2015 15:08:02 -0800 +Subject: [PATCH] UnicodeEncodeError in AsStringVisitor.visit_functiondef + +Fix from upstream issue tracker: +https://bitbucket.org/logilab/astroid/issues/273/regression-unicodeencodeerror-in +--- + astroid/as_string.py | 14 +++++++------- + astroid/tests/unittest_regrtest.py | 17 +++++++++++++++++ + 2 files changed, 24 insertions(+), 7 deletions(-) + +diff --git a/astroid/as_string.py b/astroid/as_string.py +index d7786fe..829c69b 100644 +--- a/astroid/as_string.py ++++ b/astroid/as_string.py +@@ -287,13 +287,13 @@ class AsStringVisitor(object): + trailer = return_annotation + ":" + else: + trailer = ":" +- def_format = "\n{decorators}def {name}({args}){trailer}{docs}\n{body}" +- return def_format.format(decorators=decorate, +- name=node.name, +- args=node.args.accept(self), +- trailer=trailer, +- docs=docs, +- body=self._stmt_list(node.body)) ++ def_format = "\n%sdef %s(%s)%s%s\n%s" ++ return def_format % (decorate, ++ node.name, ++ node.args.accept(self), ++ trailer, ++ docs, ++ self._stmt_list(node.body)) + + def visit_generatorexp(self, node): + """return an astroid.GeneratorExp node as string""" +diff --git a/astroid/tests/unittest_regrtest.py b/astroid/tests/unittest_regrtest.py +index 3e22152..b255bfe 100644 +--- a/astroid/tests/unittest_regrtest.py ++++ b/astroid/tests/unittest_regrtest.py +@@ -282,6 +282,23 @@ def test(): + ''') + self.assertRaises(exceptions.InferenceError, next, node.infer()) + ++ def test_unicode_in_docstring(self): ++ # Crashed for astroid==1.4.1 ++ # Test for https://bitbucket.org/logilab/astroid/issues/273/ ++ ++ # In a regular file, "coding: utf-8" would have been used. ++ node = extract_node(u''' ++ from __future__ import unicode_literals ++ ++ class MyClass(object): ++ def method(self): ++ "With unicode : %s " ++ ++ instance = MyClass() ++ ''' % u"\u2019") ++ ++ next(node.value.infer()).as_string() ++ + + class Whatever(object): + a = property(lambda x: x, lambda x: x) +-- +2.5.0 + diff --git a/0001-brain-py2gi-Silence-pygi-deprecation-warnings.patch b/0001-brain-py2gi-Silence-pygi-deprecation-warnings.patch deleted file mode 100644 index 6ce5f45..0000000 --- a/0001-brain-py2gi-Silence-pygi-deprecation-warnings.patch +++ /dev/null @@ -1,49 +0,0 @@ -From b9aef5ac624041f1427f61f7698a0b3f553b1d69 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Cole Robinson -Date: Fri, 27 Mar 2015 17:32:42 -0400 -Subject: [PATCH] brain: py2gi: Silence pygi deprecation warnings - -The way we inspect gi modules can trigger python-gobject deprecation -warnings. At least on Fedora 22 this is very noisy with a ton of -warnings right after running pylint on gi using code. - -Silence the specific pygi deprecation warnings. ---- - astroid/brain/py2gi.py | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) - -diff --git a/astroid/brain/py2gi.py b/astroid/brain/py2gi.py -index 6747898..8ff8c8f 100644 ---- a/astroid/brain/py2gi.py -+++ b/astroid/brain/py2gi.py -@@ -7,6 +7,7 @@ import inspect - import itertools - import sys - import re -+import warnings - - from astroid import MANAGER, AstroidBuildingException - from astroid.builder import AstroidBuilder -@@ -135,7 +136,17 @@ def _import_gi_module(modname): - for m in itertools.chain(modnames, optional_modnames): - try: - __import__(m) -- modcode += _gi_build_stub(sys.modules[m]) -+ with warnings.catch_warnings(): -+ # Just inspecting the code can raise gi deprecation -+ # warnings, so ignore them. -+ try: -+ from gi import PyGIDeprecationWarning -+ warnings.simplefilter("ignore", -+ PyGIDeprecationWarning) -+ except: -+ pass -+ -+ modcode += _gi_build_stub(sys.modules[m]) - except ImportError: - if m not in optional_modnames: - raise --- -2.3.3 - diff --git a/0003-Duplicate-calls-to-gi.require_version.patch b/0003-Duplicate-calls-to-gi.require_version.patch deleted file mode 100644 index 2ffa481..0000000 --- a/0003-Duplicate-calls-to-gi.require_version.patch +++ /dev/null @@ -1,63 +0,0 @@ -# HG changeset patch -# User David Shea -# Date 1436366590 14400 -# Wed Jul 08 10:43:10 2015 -0400 -# Branch pygobject-require_version -# Node ID 57b1f06de1794f1fdc4b89f995d6db7c0e2f7b9e -# Parent 4e95eaf062feba0e0505b471ccb3190fd9f19ac0 -Duplicate calls to gi.require_version. - -gobject-introspection uses gi.require_version to choose which version of a -library to import from gi.repository, and pygobject now issues a warning if -gi.require_version is not used. Find calls to require_version and duplicate -them in py2gi.py so that the version data is present in the context of the -import. - -diff -r 4e95eaf062fe -r 57b1f06de179 astroid/brain/py2gi.py ---- a/astroid/brain/py2gi.py Tue Jul 07 12:51:30 2015 +0300 -+++ b/astroid/brain/py2gi.py Wed Jul 08 10:43:10 2015 -0400 -@@ -9,7 +9,7 @@ - import re - import warnings - --from astroid import MANAGER, AstroidBuildingException -+from astroid import MANAGER, AstroidBuildingException, nodes - from astroid.builder import AstroidBuilder - - -@@ -158,6 +158,34 @@ - raise AstroidBuildingException('Failed to import module %r' % modname) - return astng - -+def _looks_like_require_version(node): -+ # Return whether this looks like a call to gi.require_version(, ) -+ # Only accept function calls with two constant arguments -+ if len(node.args) != 2: -+ return False -+ -+ if not all(isinstance(arg, nodes.Const) for arg in node.args): -+ return False -+ -+ func = node.func -+ if isinstance(func, nodes.Getattr): -+ if func.attrname != 'require_version': -+ return False -+ if isinstance(func.expr, nodes.Name) and func.expr.name == 'gi': -+ return True -+ -+ return False -+ -+ if isinstance(func, nodes.Name): -+ return func.name == 'require_version' -+ -+ return False -+ -+def _register_require_version(node): -+ # Load the gi.require_version locally -+ import gi -+ gi.require_version(node.args[0].value, node.args[1].value) -+ return node - - MANAGER.register_failed_import_hook(_import_gi_module) -- -+MANAGER.register_transform(nodes.CallFunc, _register_require_version, _looks_like_require_version) diff --git a/0004-Ignore-exceptions-raised-by-gi.require_version.patch b/0004-Ignore-exceptions-raised-by-gi.require_version.patch deleted file mode 100644 index 3587746..0000000 --- a/0004-Ignore-exceptions-raised-by-gi.require_version.patch +++ /dev/null @@ -1,27 +0,0 @@ -# HG changeset patch -# User David Shea -# Date 1436370427 14400 -# Wed Jul 08 11:47:07 2015 -0400 -# Branch pygobject-require_version -# Node ID cd394ae4751407e17f3d0737f3962fde4d5b221a -# Parent 57b1f06de1794f1fdc4b89f995d6db7c0e2f7b9e -Ignore exceptions raised by gi.require_version - -diff -r 57b1f06de179 -r cd394ae47514 astroid/brain/py2gi.py ---- a/astroid/brain/py2gi.py Wed Jul 08 10:43:10 2015 -0400 -+++ b/astroid/brain/py2gi.py Wed Jul 08 11:47:07 2015 -0400 -@@ -183,8 +183,12 @@ - - def _register_require_version(node): - # Load the gi.require_version locally -- import gi -- gi.require_version(node.args[0].value, node.args[1].value) -+ try: -+ import gi -+ gi.require_version(node.args[0].value, node.args[1].value) -+ except Exception: -+ pass -+ - return node - - MANAGER.register_failed_import_hook(_import_gi_module) diff --git a/0005-Subprocess-communicate-has-a-different-signature-for.patch b/0005-Subprocess-communicate-has-a-different-signature-for.patch deleted file mode 100644 index 6a7560a..0000000 --- a/0005-Subprocess-communicate-has-a-different-signature-for.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 988f0cde7f3ca067a272bf296b5ca1e174aedb4a Mon Sep 17 00:00:00 2001 -From: David Shea -Date: Thu, 30 Jul 2015 10:15:33 -0700 -Subject: [PATCH] Subprocess communicate() has a different signature for Py3.3 - -In Python 3.3 the timeout argument was added to the communicate method. ---- - astroid/brain/py2stdlib.py | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/astroid/brain/py2stdlib.py b/astroid/brain/py2stdlib.py -index 54cf2a7..eb8bedc 100644 ---- a/astroid/brain/py2stdlib.py -+++ b/astroid/brain/py2stdlib.py -@@ -189,6 +189,7 @@ def cleanup_resources(force=False): - def subprocess_transform(): - if PY3K: - communicate = (bytes('string', 'ascii'), bytes('string', 'ascii')) -+ communicate_signature = 'def communicate(self, input=None, timeout=None)' - init = """ - def __init__(self, args, bufsize=0, executable=None, - stdin=None, stdout=None, stderr=None, -@@ -200,6 +201,7 @@ def subprocess_transform(): - """ - else: - communicate = ('string', 'string') -+ communicate_signature = 'def communicate(self, input=None)' - init = """ - def __init__(self, args, bufsize=0, executable=None, - stdin=None, stdout=None, stderr=None, -@@ -220,7 +222,7 @@ class Popen(object): - - %(init)s - -- def communicate(self, input=None): -+ %(communicate_signature)s: - return %(communicate)r - %(wait_signature)s: - return self.returncode -@@ -234,6 +236,7 @@ class Popen(object): - pass - ''' % {'init': init, - 'communicate': communicate, -+ 'communicate_signature': communicate_signature, - 'wait_signature': wait_signature}) - - --- -2.4.3 - diff --git a/0006-logilab-common-requirement-should-be-1.0.0.patch b/0006-logilab-common-requirement-should-be-1.0.0.patch deleted file mode 100644 index 9e83293..0000000 --- a/0006-logilab-common-requirement-should-be-1.0.0.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 5e706c9df019fc8b76344b75d5588b8470993814 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 30 Jul 2015 10:27:29 -0700 -Subject: [PATCH] logilab-common requirement should be < 1.0.0 - ---- - astroid/__pkginfo__.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/astroid/__pkginfo__.py b/astroid/__pkginfo__.py -index 4dc7d0d..d53c6e9 100644 ---- a/astroid/__pkginfo__.py -+++ b/astroid/__pkginfo__.py -@@ -23,7 +23,7 @@ modname = 'astroid' - numversion = (1, 3, 7) - version = '.'.join([str(num) for num in numversion]) - --install_requires = ['logilab-common<=0.63.0', 'six'] -+install_requires = ['logilab-common<1.0.0', 'six'] - - license = 'LGPL' - --- -2.4.3 - diff --git a/python-astroid.spec b/python-astroid.spec index 94af049..c01a3b0 100644 --- a/python-astroid.spec +++ b/python-astroid.spec @@ -4,39 +4,29 @@ %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} %endif -# This needs to be pulled from the source tarball -%global commit cda2deee65e3 - - Name: python-astroid -Version: 1.3.7 -Release: 2%{?dist} +Version: 1.4.1 +Release: 1%{?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 - -Patch1: 0001-Fix-multiprocessing-on-py3.4.patch -Patch2: 0001-brain-py2gi-Silence-pygi-deprecation-warnings.patch -Patch3: 0003-Duplicate-calls-to-gi.require_version.patch -Patch4: 0004-Ignore-exceptions-raised-by-gi.require_version.patch -Patch5: 0005-Subprocess-communicate-has-a-different-signature-for.patch -Patch6: 0006-logilab-common-requirement-should-be-1.0.0.patch +Source0: https://github.com/PyCQA/astroid/archive/astroid-%{version}.tar.gz Provides: python-astroid = %{version}-%{release} Obsoletes: python-logilab-astng <= 0.24.1 +Requires: python-six +Requires: python-wrapt +Requires: python-lazy-object-proxy BuildArch: noarch BuildRequires: python-devel python-setuptools python-tools BuildRequires: python-six -BuildRequires: python-logilab-common >= 0.63.2 -Requires: python-logilab-common >= 0.63.2 -%if 0%{?with_python3} -BuildRequires: python3-devel python3-setuptools python3-tools -BuildRequires: python3-six -BuildRequires: python3-logilab-common >= 0.63.2 -%endif # if with_python3 +BuildRequires: python-wrapt +BuildRequires: python-lazy-object-proxy +BuildRequires: git + +Patch0001: 0001-UnicodeEncodeError-in-AsStringVisitor.visit_function.patch %description The aim of this module is to provide a common base representation of @@ -48,7 +38,14 @@ python module with some additional methods and attributes. %package -n python3-astroid Summary: Python Abstract Syntax Tree New Generation Group: Development/Languages -Requires: python3-logilab-common >= 0.63.2 +Requires: python3-six +Requires: python3-wrapt +Requires: python3-lazy-object-proxy +BuildRequires: python3-devel python3-setuptools python3-tools +BuildRequires: python3-six +BuildRequires: python3-wrapt +BuildRequires: python3-lazy-object-proxy +BuildRequires: git %description -n python3-astroid The aim of this module is to provide a common base representation of @@ -58,13 +55,14 @@ python module with some additional methods and attributes. %endif # if with_python3 %prep -%setup -q -n logilab-astroid-%{commit} -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 +%setup -q -n astroid-astroid-%{version} +git init +git config user.email "python-astroid-owner@fedoraproject.org" +git config user.name "Fedora Ninjas" +git add . +git commit -a -q -m "%{version} baseline." +git am %{patches} +git tag -a %{name}-%{version} -m "baseline" %if 0%{?with_python3} rm -rf %{py3dir} @@ -101,15 +99,6 @@ for FILE in README; do mv -f $FILE.utf8 $FILE done -%check -%{__python} setup.py test - -%if 0%{?with_python3} -pushd %{py3dir} -%{__python3} setup.py test -popd -%endif # with_python3 - %files %doc README COPYING %{python_sitelib}/astroid @@ -123,6 +112,16 @@ popd %endif # with_python3 %changelog +* Thu Dec 10 2015 Brian C. Lane 1.4.1-1 +- Upstream 1.4.1 +- Drop included patches +- Drop requirement on logilab-common +- Add requirement on python-wrapt and python-lazy-object-proxy +- New upstream source from GitHub +- UnicodeEncodeError in AsStringVisitor.visit_functiondef + https://bitbucket.org/logilab/astroid/issues/273/regression-unicodeencodeerror-in +- Remove %check section, the full tox tests cannot be run because of un-packaged requirements + * Tue Nov 10 2015 Fedora Release Engineering - 1.3.7-2 - Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 diff --git a/sources b/sources index a69463e..de479b1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -91e13471f9cdd95bdfc8420ad7ea5925 astroid-1.3.7.tar.bz2 +ed70bfed5e4b25be4292e7fe72da2c02 astroid-1.4.1.tar.gz