# spec from fedora
Name:           rss2email
Version:        3.12.2
Release:        1%{?dist}
Summary:        Deliver news from RSS feeds to your SMTP server as text or HTML mail

License:        GPLv2+ or GPLv3+
URL:            https://github.com/%{name}/%{name}
Source0:        %{url}/archive/v%{version}.tar.gz
# Migration tool (rss2email 2.x to rss2email 3.x) from https://github.com/emillon/rss2email-debian
Source1:        r2e-migrate
Source2:        r2e-migrate.1
Source3:        README.migrate
Patch0:         rss2email-python-3-5-drop.patch

BuildArch:      noarch
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-feedparser >= 5.2.1, python3-feedparser < 6.0.0
BuildRequires:  python3-html2text >= 2018.1.9
Recommends:     python3-beautifulsoup4
Recommends:     esmtp
# r2e-migrate
Requires:       python3-pyxdg

%description
%{name} lets you subscribe to a list of XML news feeds (RSS or Atom). It can
parse them regularly with the help of cron and send new items to you by email.

An HTML mail will be send in the default configuration to the local SMTP server.
See the manual page r2e for details on how to set up %{name}.

%package zsh-completion
Summary:        zsh-completion files for rss2email
BuildArch:      noarch
Supplements:    (rss2email and zsh)
Requires:       zsh
Requires:       rss2email

%description zsh-completion
This package provides %{summary}.

%prep
%autosetup -p1

cp -p %{SOURCE3} .


%build
%py3_build


%install
%py3_install

install -D -m 644 -p completion/r2e.zsh %{buildroot}%{_datadir}/zsh/functions/Completion/Unix/_r2e

install -D -m 644 -p r2e.1 %{buildroot}%{_mandir}/man1/r2e.1

install -D -m 755 -p %{SOURCE1} %{buildroot}%{_bindir}/r2e-migrate
install -D -m 644 -p %{SOURCE2} %{buildroot}%{_mandir}/man1/r2e-migrate.1


%check
PATH="${PATH}:%{buildroot}%{_bindir}" PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} ./test/test.py


%files
%license COPYING
%doc AUTHORS CHANGELOG README.rst README.migrate
%{_bindir}/r2e
%{_bindir}/r2e-migrate
%{_mandir}/man1/r2e.1*
%{_mandir}/man1/r2e-migrate.1*
%{python3_sitelib}/%{name}/
%{python3_sitelib}/%{name}-%{version}-py%{python3_version}.egg-info/

%files zsh-completion
%{_datadir}/zsh/functions/Completion/Unix/_r2e

%changelog
* Sun Feb 14 2021 voidanix <voidanix@keyedlimepie.org> - 3.12.2-1
- Initial build