Blob Blame History Raw
%global with_python3 1
%global module_name drat

Name:           python-%{module_name}
Version:        0.4.2
Release:        12%{?dist}
Summary:        A reading text analysis tool

License:        GPLv3+
URL:            https://github.com/riverrun/drat
Source0:        https://files.pythonhosted.org/packages/source/d/%{module_name}/%{module_name}-%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  python2-devel
BuildRequires:  python2-requests
BuildRequires:  python2-click
BuildRequires:  python2-setuptools

%global _description\
Drat is a tool that analyzes reading texts and produces a brief report which\
gives a readability score (according to the Dale-Chall readability formula)\
and the number of uncommon words (based on the General Service List) in the\
text. It also lists all of these uncommon words (if you choose the verbose\
option).

%description %_description

%package -n python2-%{module_name}
Summary: %summary
%{?python_provide:%python_provide python2-%{module_name}}

%description -n python2-%{module_name} %_description

%if 0%{with_python3}
%package -n python3-%{module_name}
Summary:        A reading text analysis tool
License:        GPLv3+
BuildRequires:  python3-devel
BuildRequires:  python3-requests
BuildRequires:  python3-click
BuildRequires:  python3-setuptools

%description -n python3-%{module_name} %_description
%endif

%package -n %{module_name}-tools
Summary:        A reading text analysis tool
License:        GPLv3+

%if 0%{with_python3}
Requires: python3-drat
%else
Requires: python2-drat
%endif

%description -n %{module_name}-tools
drat tool.

%prep
%setup -q -n %{module_name}-%{version}
rm -rf *.egg-info

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3

find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'

%build
%{__python2} setup.py build

%if 0%{with_python3}
echo ${_python3}
%{__python3} setup.py build
%endif

%install
%{__python2} setup.py install --skip-build --root=%{buildroot}

%if 0%{with_python3}
%{__python3} setup.py install --skip-build --root=%{buildroot}
%endif

%check
%{__python2} setup.py test

%if 0%{with_python3}
%{__python3} setup.py test
%endif

%files -n %{module_name}-tools
%doc README.rst
%{_bindir}/*

%files -n python2-%{module_name}
%doc README.rst
%{python2_sitelib}/%{module_name}/
%{python2_sitelib}/%{module_name}-%{version}-py2.7.egg-info

%if 0%{?with_python3}
%files -n python3-%{module_name}
%doc README.rst
%{python3_sitelib}/%{module_name}/
%{python3_sitelib}/%{module_name}-%{version}-py3.*.egg-info
%endif


%changelog
* Mon Feb 12 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.4.2-12
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

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

* Tue Aug 08 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.4.2-10
- Python 2 binary package renamed to python2-drat
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.2-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.2-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.4.2-7
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.2-6
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.2-4
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Fri Jan 09 2015 Parag Nemade <pnemade AT redhat DOT com> - 0.4.2-2
- Fix drat execution
- require python3-drat

* Sun Oct 19 2014 Parag Nemade <pnemade AT redhat DOT com> - 0.4.2-1
- Update to 0.4.2 release

* Sun Sep 28 2014 Parag Nemade <pnemade AT redhat DOT com> - 0.4.1-1
- Update to 0.4.1 release

* Mon Sep 22 2014 Parag Nemade <pnemade AT redhat DOT com> - 0.4.0-1
- Initial packaging