## START: Set by rpmautospec
## (rpmautospec version 0.3.1)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 2;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

Name:           python-asttokens
Version:        2.1.0
Release:        %autorelease
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
Patch0:         py3.11.patch

BuildArch:      noarch
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}dist(setuptools)
BuildRequires:  python%{python3_pkgversion}dist(setuptools-scm)
BuildRequires:  python%{python3_pkgversion}dist(wheel)
# BuildRequires:  python%{python3_pkgversion}dist(toml)
BuildRequires:  python%{python3_pkgversion}dist(pytest)
BuildRequires:  python%{python3_pkgversion}dist(astroid)
BuildRequires:  python%{python3_pkgversion}dist(six)

%global _description %{expand:
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 python%{python3_pkgversion}-asttokens
Summary:        %{summary}
Requires:       %{py3_dist six}
%{?python_provide:%python_provide python%{python3_pkgversion}-asttokens}

%description -n python%{python3_pkgversion}-asttokens %_description

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

%build
%py3_build

%install
%py3_install

%check
TEST_ARGS=(
        # Temporarily disabled until version incompatibility is resolved upstream:
        # https://github.com/gristlabs/asttokens/issues/79
        --ignore=tests/test_astroid.py
)

pytest-3 tests/ -v "${TEST_ARGS[@]}"

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

%changelog
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Tue Nov 01 2022 Lumir Balhar <lbalhar@redhat.com> - 2.1.0-1
- Update to 2.1.0

* Wed Aug 17 2022 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.0.8-1
- Version 2.0.8 (rhbz#2116423)

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.5-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 2.0.5-7
- Rebuilt for Python 3.11

* Wed Apr 27 2022 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.0.5-6
- Do not test against astroid (rhbz#2034943)

* Mon Apr 25 2022 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.0.5-5
- Rewrap %%description to 80 columns

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 2.0.4-4
- Rebuilt for Python 3.10

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Wed Jun  3 2020 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.0.4-1
- Update to latest version (#1823090)
- Ignore tests that fail with python3.9 (#1817679)

* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 2.0.3-3
- Rebuilt for Python 3.9

* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Wed Dec 18 2019  <zbyszek@in.waw.pl> - 2.0.3-1
- Update to latest bugfix release

* Tue Oct 15 2019 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.0.0-1
- Update to latest version (#1752074). This should finally fix compatibility
  with python3.8.

* Tue Sep 10 2019 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.1.13-3
- Fix build with python3.8 (#1697503)

* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 1.1.13-3
- Rebuilt for Python 3.8

* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.13-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Sat May  4 2019 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.1.13-1
- Update to latest version (#1697407)

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.10-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Wed Oct 24 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.1.10-4
- Subpackage python2-asttokens has been removed
  See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.10-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Sat Jul  7 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.1.10-2
- Replace my own patches with better patches from upstream
  (all tests should now pass)

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

* 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

