diff --git a/.gitignore b/.gitignore index 00203ef..b8abd22 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1 @@ -/astroid-version-1.0.0.tar.bz2 -/astroid-version-1.0.1.tar.bz2 -/astroid-1.1.tar.bz2 -/astroid-1.2.1.tar.bz2 -/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 -/astroid-1.4.3.tar.gz -/astroid-1.4.4.tar.gz -/astroid-1.4.5.tar.gz -/astroid-1.4.8.tar.gz -/astroid-1.4.9.tar.gz -/astroid-1.5.2.tar.gz -/astroid-1.5.3.tar.gz +/astroid-*.tar.gz diff --git a/0001-Ignore-PyGIWarning.patch b/0001-Ignore-PyGIWarning.patch deleted file mode 100644 index f3ef024..0000000 --- a/0001-Ignore-PyGIWarning.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 96dbb797e7d1a5f5c7f59b53a54b49bf0fd2ed9c Mon Sep 17 00:00:00 2001 -From: Giuseppe Scrivano -Date: Wed, 27 Apr 2016 15:12:45 +0200 -Subject: [PATCH] Ignore PyGIWarning - -It solves this error when running PyLint on a file which uses gi introspection: - -/usr/lib/python2.7/site-packages/astroid/brain/brain_gi.py:136: PyGIWarning: OSTree was \ -imported without specifying a version first. Use gi.require_version('OSTree', '1.0') before \ -import to ensure that the right version gets loaded. - -Signed-off-by: Giuseppe Scrivano ---- - astroid/brain/brain_gi.py | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/astroid/brain/brain_gi.py b/astroid/brain/brain_gi.py -index 62b013c..3c24248 100644 ---- a/astroid/brain/brain_gi.py -+++ b/astroid/brain/brain_gi.py -@@ -133,16 +133,17 @@ def _import_gi_module(modname): - modcode = '' - for m in itertools.chain(modnames, optional_modnames): - try: -- __import__(m) - with warnings.catch_warnings(): - # Just inspecting the code can raise gi deprecation - # warnings, so ignore them. - try: -- from gi import PyGIDeprecationWarning -+ from gi import PyGIDeprecationWarning, PyGIWarning - warnings.simplefilter("ignore", PyGIDeprecationWarning) -+ warnings.simplefilter("ignore", PyGIWarning) - except Exception: - pass - -+ __import__(m) - modcode += _gi_build_stub(sys.modules[m]) - except ImportError: - if m not in optional_modnames: --- -2.5.5 - diff --git a/365-rebased.patch b/365-rebased.patch deleted file mode 100644 index 6ad9086..0000000 --- a/365-rebased.patch +++ /dev/null @@ -1,166 +0,0 @@ -From db75314805c2b5df57883f49b7d93c62a079189e Mon Sep 17 00:00:00 2001 -From: Jared Garst -Date: Sun, 2 Oct 2016 07:22:51 -0700 -Subject: [PATCH] add format string support - -format strings require support for two new nodes: -FormattedValue(expr valu, int? conversion, expr? format_spec) -JoinedStr(expr* values) ---- - astroid/as_string.py | 15 ++++++++++++++- - astroid/node_classes.py | 22 ++++++++++++++++++++++ - astroid/nodes.py | 2 ++ - astroid/rebuilder.py | 12 ++++++++++++ - astroid/tests/unittest_python3.py | 11 +++++++++-- - tox.ini | 4 ++-- - 6 files changed, 61 insertions(+), 5 deletions(-) - -diff --git a/astroid/as_string.py b/astroid/as_string.py -index 3d669c4..8eaebc1 100644 ---- a/astroid/as_string.py -+++ b/astroid/as_string.py -@@ -481,6 +481,19 @@ def visit_asyncwith(self, node): - def visit_asyncfor(self, node): - return 'async %s' % self.visit_for(node) - -+ def visit_joinedstr(self, node): -+ # Special treatment for constants, -+ # as we want to join literals not reprs -+ string = ''.join( -+ value.value if type(value).__name__ == 'Const' -+ else value.accept(self) -+ for value in node.values -+ ) -+ return "f'%s'" % string -+ -+ def visit_formattedvalue(self, node): -+ return '{%s}' % node.value.accept(self) -+ - - def _import_string(names): - """return a list of (name, asname) formatted as a string""" -@@ -490,7 +503,7 @@ def _import_string(names): - _names.append('%s as %s' % (name, asname)) - else: - _names.append(name) -- return ', '.join(_names) -+ return ', '.join(_names) - - - if sys.version_info >= (3, 0): -diff --git a/astroid/node_classes.py b/astroid/node_classes.py -index 42fdf7c..9873158 100644 ---- a/astroid/node_classes.py -+++ b/astroid/node_classes.py -@@ -1863,6 +1863,28 @@ class DictUnpack(NodeNG): - """Represents the unpacking of dicts into dicts using PEP 448.""" - - -+class FormattedValue(bases.NodeNG): -+ """Represents a PEP 498 format string.""" -+ _astroid_fields = ('value', 'format_spec') -+ value = None -+ conversion = None -+ format_spec = None -+ -+ def postinit(self, value, conversion=None, format_spec=None): -+ self.value = value -+ self.conversion = conversion -+ self.format_spec = format_spec -+ -+ -+class JoinedStr(bases.NodeNG): -+ """Represents a list of string expressions to be joined.""" -+ _astroid_fields = ('values',) -+ value = None -+ -+ def postinit(self, values=None): -+ self.values = values -+ -+ - # constants ############################################################## - - CONST_CLS = { -diff --git a/astroid/nodes.py b/astroid/nodes.py -index 1c279cc..3397294 100644 ---- a/astroid/nodes.py -+++ b/astroid/nodes.py -@@ -37,6 +37,7 @@ - TryExcept, TryFinally, Tuple, UnaryOp, While, With, Yield, YieldFrom, - const_factory, - AsyncFor, Await, AsyncWith, -+ FormattedValue, JoinedStr, - # Backwards-compatibility aliases - Backquote, Discard, AssName, AssAttr, Getattr, CallFunc, From, - # Node not present in the builtin ast module. -@@ -75,4 +76,5 @@ - UnaryOp, - While, With, - Yield, YieldFrom, -+ FormattedValue, JoinedStr, - ) -diff --git a/astroid/rebuilder.py b/astroid/rebuilder.py -index d80033f..91774cf 100644 ---- a/astroid/rebuilder.py -+++ b/astroid/rebuilder.py -@@ -984,6 +984,24 @@ def visit_await(self, node, parent): - return self._visit_with(new.AsyncWith, node, parent, - assign_ctx=assign_ctx) - -+ def visit_joinedstr(self, node, parent, assign_ctx=None): -+ newnode = new.JoinedStr() -+ newnode.lineno = node.lineno -+ newnode.col_offset = node.col_offset -+ newnode.parent = parent -+ newnode.postinit([self.visit(child, newnode) -+ for child in node.values]) -+ return newnode -+ -+ def visit_formattedvalue(self, node, parent, assign_ctx=None): -+ newnode = new.FormattedValue() -+ newnode.lineno = node.lineno -+ newnode.col_offset = node.col_offset -+ newnode.parent = parent -+ newnode.postinit(self.visit(node.value, newnode), -+ node.conversion, -+ _visit_or_none(node, 'format_spec', self, newnode, assign_ctx=assign_ctx)) -+ return newnode - - if sys.version_info >= (3, 0): - TreeRebuilder = TreeRebuilder3k -diff --git a/astroid/tests/unittest_python3.py b/astroid/tests/unittest_python3.py -index ad8e57b..e555bb4 100644 ---- a/astroid/tests/unittest_python3.py -+++ b/astroid/tests/unittest_python3.py -@@ -87,7 +87,7 @@ def test_metaclass_error(self): - @require_version('3.0') - def test_metaclass_imported(self): - astroid = self.builder.string_build(dedent(""" -- from abc import ABCMeta -+ from abc import ABCMeta - class Test(metaclass=ABCMeta): pass""")) - klass = astroid.body[1] - -@@ -98,7 +98,7 @@ class Test(metaclass=ABCMeta): pass""")) - @require_version('3.0') - def test_as_string(self): - body = dedent(""" -- from abc import ABCMeta -+ from abc import ABCMeta - class Test(metaclass=ABCMeta): pass""") - astroid = self.builder.string_build(body) - klass = astroid.body[1] -@@ -239,6 +239,13 @@ def test_unpacking_in_dict_getitem(self): - self.assertIsInstance(value, nodes.Const) - self.assertEqual(value.value, expected) - -+ @require_version('3.6') -+ def test_format_string(self): -+ code = "f'{greetings} {person}'" -+ node = extract_node(code) -+ self.assertEqual(node.as_string(), code) -+ -+ - - if __name__ == '__main__': - unittest.main() diff --git a/python-astroid.spec b/python-astroid.spec index 3b7d292..07728dc 100644 --- a/python-astroid.spec +++ b/python-astroid.spec @@ -1,131 +1,85 @@ %global github_owner PyCQA %global github_name astroid -%global github_commit 1602965b4ef3ce54807de425bfc5bb2073d0c4d8 - -%global sum Common base representation of python source code for pylint and other projects -%global desc The aim of this module is to provide a common base representation of python \ -source code for projects such as pychecker, pyreverse, pylint... \ -It provides a compatible representation which comes from the _ast module. It \ -rebuilds the tree generated by the builtin _ast module by recursively walking \ -down the AST and building an extended ast. The new node classes have additional \ -methods and attributes for different usages. They include some support for \ -static inference and local name scopes. Furthermore, astroid builds partial \ -trees by inspecting living objects. - -# Enable Python 3 builds for Fedora + EPEL >= 6 -%if 0%{?fedora} || 0%{?rhel} >= 6 -%bcond_without python3 -%else -%bcond_with python3 -%endif - -# Requirements for tests (BuildRequires) and run (Requires) -# EPEL builds do not provide python2-* -%global t_requires python-enum34 python-six python-wrapt python-lazy-object-proxy python-singledispatch python2-backports-functools_lru_cache -%global t3_requires python%{python3_pkgversion}-six python%{python3_pkgversion}-wrapt python%{python3_pkgversion}-lazy-object-proxy -# singledispatch comes from functools on py3 Name: python-astroid -Version: 1.5.3 -Release: 3%{?dist} -Summary: %{sum} -Group: Development/Languages +Version: 2.0.0 +%global pypi_ver %{version}dev0 +%global github_tag %{github_name}-%{version}-dev +Release: 0.1dev0%{?dist} +Summary: Common base representation of python source code for pylint and other projects License: GPLv2+ URL: https://github.com/%{github_owner}/%{github_name} -Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{github_name}-%{version}.tar.gz +Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_tag}/%{github_name}-%{pypi_ver}.tar.gz -Obsoletes: python-logilab-astng <= 0.24.1 +# Requirements for tests (BuildRequires) and run (Requires) +%global t_requires python3-lazy-object-proxy python3-six python3-wrapt BuildArch: noarch -BuildRequires: python2-devel -BuildRequires: python-setuptools -BuildRequires: python-tools -BuildRequires: python-nose + +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pytest +BuildRequires: python3-pytest-runner +BuildRequires: git-core BuildRequires: %{t_requires} -BuildRequires: git %description -%{desc} - - -%package -n python2-%{github_name} -Summary: %{sum} -Requires: %{t_requires} -%{?python_provide:%python_provide python2-%{github_name}} - -%description -n python2-%{github_name} -%{desc} - -This package provides the Python 2 implementation. - - -%if 0%{?with_python3} -%package -n python%{python3_pkgversion}-astroid -Summary: %{sum} -Group: Development/Languages -Requires: %{t3_requires} -BuildRequires: python%{python3_pkgversion}-devel -BuildRequires: python%{python3_pkgversion}-setuptools -BuildRequires: python%{python3_pkgversion}-tools -BuildRequires: python%{python3_pkgversion}-nose -BuildRequires: %{t3_requires} -BuildRequires: git +The aim of this module is to provide a common base representation of python +source code for projects such as pychecker, pyreverse, pylint... +It provides a compatible representation which comes from the _ast module. It +rebuilds the tree generated by the builtin _ast module by recursively walking +down the AST and building an extended ast. The new node classes have additional +methods and attributes for different usages. They include some support for +static inference and local name scopes. Furthermore, astroid builds partial +trees by inspecting living objects. -%description -n python%{python3_pkgversion}-astroid -%{desc} +%package -n python3-%{github_name} +Summary: %{summary} +Requires: %{t_requires} +%{?python_provide:%python_provide python3-%{github_name}} + +%description -n python3-%{github_name} +The aim of this module is to provide a common base representation of python +source code for projects such as pychecker, pyreverse, pylint... +It provides a compatible representation which comes from the _ast module. It +rebuilds the tree generated by the builtin _ast module by recursively walking +down the AST and building an extended ast. The new node classes have additional +methods and attributes for different usages. They include some support for +static inference and local name scopes. Furthermore, astroid builds partial +trees by inspecting living objects. -This package provides the Python 2 implementation. -%endif # if with_python3 +This package provides the Python 3 implementation. %prep -%autosetup -n %{github_name}-%{github_commit} -p1 +%autosetup -n %{github_name}-%{github_tag} -p1 %build -%py2_build - -%if %{with python3} %py3_build -%endif # with_python3 %install -%if 0%{?with_python3} %py3_install rm -rf %{buildroot}%{python3_sitelib}/astroid/tests -%endif # with_python3 - -%py2_install -rm -rf %{buildroot}%{python2_sitelib}/astroid/tests %check -# One test failing on Fedora 26 and newer with Python 2.7 -%if 0%{?fedora} < 26 && 0%{?rhel} <= 7 -PYTHONPATH=./ %{__python2} -m unittest discover -p "unittest*.py" -%endif +%{__python3} -m pytest -v -%if 0%{?with_python3} -PYTHONPATH=./ %{__python3} -m unittest discover -p "unittest*.py" -%endif # with_python3 - -%files -n python2-%{github_name} -%doc README.rst -%license COPYING -%{python2_sitelib}/astroid -%{python2_sitelib}/astroid*.egg-info - -%if 0%{?with_python3} -%files -n python%{python3_pkgversion}-astroid +%files -n python3-%{github_name} %doc README.rst %license COPYING %{python3_sitelib}/astroid %{python3_sitelib}/astroid*.egg-info -%endif # with_python3 %changelog +* Mon May 21 2018 Miro HronĨok - 2.0.0-0.1dev0 +- Update to 2.0.0dev0 +- Drop python2-astroid (that goes to it's own package in 1.6.x) +- Switch to pytest as does upstream + * Fri Feb 09 2018 Fedora Release Engineering - 1.5.3-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild diff --git a/sources b/sources index 4232be5..69b8ca3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (astroid-1.5.3.tar.gz) = c204ad1f133fd7224c37aaac2fc19d7371862a9809b7cede61afc0cb76f4ea9f7cebaa5152a8ae668f8791058fc7df5bc3f602755d302090cdc20897c9e5b88d +SHA512 (astroid-2.0.0dev0.tar.gz) = 1b2980094e6f67fd750ddcbbe736abed9c4ba9b67fbdc5f7136efbeb70e079f14247cc6582066fbad095f7f3878f144db68a8a3e6c6b34c140ab016500e34ff7