Blob Blame History Raw
Name:           python-asttokens
Version:        1.1.10
Release:        1%{?dist}
Summary:        Module to annotate Python abstract syntax trees with source code positions

License:        ASL 2.0
URL:            https://pypi.python.org/pypi/asttokens
Source0:        https://files.pythonhosted.org/packages/source/a/asttokens/asttokens-%{version}.tar.gz

Patch0001:      0001-Remove-test-for-deep-recursion.patch
Patch0002:      0002-Import-typed_ast-instead-of-ast-like-astroid-2.0-doe.patch
Patch0003:      0003-line_numbers-fix-off-by-one-in-offset-indexing.patch
Patch0004:      0004-test-split-calls-to-to_source-into-seperate-lines.patch
Patch0005:      0005-test-adjust-test-for-JoinedStr.patch

BuildArch:      noarch
BuildRequires:  python2-devel
BuildRequires:  python3-devel
BuildRequires:  %{py2_dist nose}
BuildRequires:  %{py3_dist nose}
BuildRequires:  %{py2_dist astroid}
BuildRequires:  %{py3_dist astroid}
BuildRequires:  %{py2_dist six}
BuildRequires:  %{py3_dist six}

%global _description \
The asttokens module annotates Python abstract syntax trees (ASTs)\
with the positions of tokens and text in the source code that\
generated them. This makes it possible for tools that work with\
logical AST nodes to find the particular text that resulted in those\
nodes, for example for automated refactoring or highlighting.

%description %_description

%package     -n python2-asttokens
Summary:        %{summary}
Requires:       %{py2_dist six}
%{?python_provide:%python_provide python2-asttokens}

%description -n python2-asttokens %_description

%package     -n python3-asttokens
Summary:        %{summary}
Requires:       %{py3_dist six}
%{?python_provide:%python_provide python3-asttokens}

%description -n python3-asttokens %_description

%prep
%autosetup -p1 -n asttokens-%{version}

%build
%py2_build
%py3_build

%install
%py2_install
%py3_install

%check
# Disable the test for f-strings for now
# See https://github.com/gristlabs/asttokens/issues/16.
sed -r -i s/test_fstrings/_disabled_/ tests/test_mark_tokens.py
sed -r -i s/test_adjacent_joined_strings/_disabled_/ tests/test_mark_tokens.py

# Disable tests that fail under python3.7
# See https://github.com/gristlabs/asttokens/issues/18.
sed -r -i s/test_adjacent_strings/_disabled_/ tests/test_mark_tokens.py
sed -r -i s/test_token_methods/_disabled_/ tests/test_asttokens.py

nosetests-2 tests/ -v
nosetests-3 tests/ -v

%files -n python2-asttokens
%license LICENSE
%doc README.rst
# For noarch packages: sitelib
%{python2_sitelib}/*

%files -n python3-asttokens
%license LICENSE
%doc README.rst
%{python3_sitelib}/*

%changelog
* Thu Jul  5 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.1.10-1
- Update to latest version (this does fix #1586009 unfortunately)

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Mon Nov  6 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.1.6-1
- Initial version