# Created by pyp2rpm-2.0.0
%global pypi_name archivenow

%define python2_package python2

%define python3_package python%{python3_pkgversion}

%define enable_python2 1
%if 0%{?rhel} && 0%{?rhel} >= 8
  %define enable_python2 0
%endif

%define enable_python3 1
%if 0%{?rhel} && 0%{?rhel} <= 7
  %define enable_python3 0
%endif

Name:           python-%{pypi_name}
Version:        2019.7.27.2.35.46
Release:        2%{?dist}
Summary:        A tool to push web resources into public web archives

License:        MIT
URL:            https://github.com/maturban/archivenow
Source0:        https://files.pythonhosted.org/packages/e5/d1/4a3b38173cec0ad7dd48af94b18cb663faa853f9892ab7cb38b598965cdb/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

%if 0%{?enable_python2}
BuildRequires:  %{python2_package}-devel
%if 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires:  python-setuptools
%else
BuildRequires:  %{python2_package}-setuptools
%endif
%endif
 
%if 0%{?enable_python3}
BuildRequires:  %{python3_package}-devel
BuildRequires:  %{python3_package}-setuptools
%endif

%if 0%{?enable_python3}
Requires:       %{python3_package}-%{pypi_name}
%else
Requires:       %{python2_package}-%{pypi_name}
%endif


%description
A tool to push web resources into web archives.


%package -n     %{python2_package}-%{pypi_name}
Summary:        A tool to push web resources into public web archives
%{?python_provide:%python_provide %{python2_package}-%{pypi_name}}
 
%if 0%{?rhel} && 0%{?rhel} <= 7
Requires:       python-flask
Requires:       python-requests
Requires:       python-setuptools
Requires:       python-pathlib
%else
Requires:       %{python2_package}-flask
Requires:       %{python2_package}-requests
Requires:       %{python2_package}-setuptools
Requires:       %{python2_package}-pathlib
%endif


%description -n %{python2_package}-%{pypi_name}
A tool to push web resources into web archives.


%if 0%{?enable_python3}
%package -n     %{python3_package}-%{pypi_name}
Summary:        A tool to push web resources into public web archives
%{?python_provide:%python_provide %{python3_package}-%{pypi_name}}
 
Requires:       %{python3_package}-flask
Requires:       %{python3_package}-requests
Requires:       %{python3_package}-setuptools
#Requires:       %{python3_package}-pathlib


%description -n %{python3_package}-%{pypi_name}
A tool to push web resources into web archives.
%endif


%prep
%autosetup -n %{pypi_name}-%{version}

# Remove bundled egg-info
%{__rm} -rf %{pypi_name}.egg-info


%build
%if 0%{?enable_python2}
%py2_build
%endif

%if 0%{?enable_python3}
%py3_build
%endif


%install
# Must do the subpackages' install first because the scripts in /usr/bin are
# overwritten with every setup.py install.
%if 0%{?enable_python2}
%py2_install
%endif

%if 0%{?enable_python3}
%py3_install
%endif


%files
%doc README.rst
%{_bindir}/archivenow


%if 0%{?enable_python2}
%files -n %{python2_package}-%{pypi_name} 
%doc README.rst
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif


%if 0%{?enable_python3}
%files -n %{python3_package}-%{pypi_name} 
%doc README.rst
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif


%changelog
* Fri Oct 18 2019 Tomasz Tomasik - 2019.7.27.2.35.46-2
- Fix requirements for Fedora 32

* Fri Oct 18 2019 Tomasz Tomasik - 2019.7.27.2.35.46-1
- Update to 2019.7.27.2.35.46.

* Fri Oct 12 2018 Tomasz Tomasik - 2018.10.2.19.46.5-1
- Initial package.