%global pypi_name Flask-HTTPAuth
%global pkg_name flask-httpauth
%if 0%{?fedora}
%global with_python3 1
%endif
Name: python-%{pkg_name}
Version: 3.2.3
Release: 1%{?dist}
Summary: Basic and Digest HTTP authentication for Flask routes
License: MIT
URL: http://github.com/miguelgrinberg/flask-httpauth/
Source0: https://files.pythonhosted.org/packages/source/F/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch
%description
FlaskHTTPAuth Basic and Digest HTTP authentication for Flask routes.
%package -n python2-%{pkg_name}
Summary: Basic and Digest HTTP authentication for Flask routes
%{?python_provide:%python_provide python2-%{pypi_name}}
BuildRequires: python2-devel
BuildRequires: python-flask
BuildRequires: python-setuptools
BuildRequires: python-sphinx
Requires: python-flask
Requires: python-werkzeug
%description -n python2-%{pkg_name}
FlaskHTTPAuth Basic and Digest HTTP authentication for Flask routes.
%package -n python-%{pkg_name}-doc
Summary: Documentation for Flask-HTTPAuth
%description -n python-%{pkg_name}-doc
FlaskHTTPAuth Basic and Digest HTTP authentication for Flask routes.
This package provides the documentation.
%if 0%{?with_python3}
%package -n python3-%{pkg_name}
Summary: Basic and Digest HTTP authentication for Flask routes
%{?python_provide:%python_provide python3-%{pypi_name}}
BuildRequires: python3-devel
BuildRequires: python3-flask
BuildRequires: python3-setuptools
BuildRequires: python3-sphinx
Requires: python3-flask
Requires: python3-werkzeug
%description -n python3-%{pkg_name}
FlaskHTTPAuth Basic and Digest HTTP authentication for Flask routes.
%endif # with_python3
%prep
%autosetup -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
%build
%py2_build
%if 0%{?with_python3}
%py3_build
%endif # with_python3
# generate html docs
%{__python2} setup.py build_sphinx
# remove the sphinx-build leftovers
rm -rf build/sphinx/html/.{doctrees,buildinfo}
%install
%if 0%{?with_python3}
%py3_install
%endif # with_python3
%py2_install
%check
%if 0%{?with_python3}
%{__python3} setup.py test
%endif # with_python3
%{__python2} setup.py test
%files -n python2-%{pkg_name}
%license LICENSE
%doc README.md
%{python2_sitelib}/flask_httpauth.py*
%{python2_sitelib}/Flask_HTTPAuth-%{version}-py?.?.egg-info
%files -n python-%{pkg_name}-doc
%license LICENSE
%doc build/sphinx/html
%if 0%{?with_python3}
%files -n python3-%{pkg_name}
%license LICENSE
%doc README.md
%{python3_sitelib}/__pycache__/*
%{python3_sitelib}/flask_httpauth.py
%{python3_sitelib}/Flask_HTTPAuth-%{version}-py?.?.egg-info
%endif # with_python3
%changelog
* Mon Jun 05 2017 Javier Peña <jpena@redhat.com> - 3.2.3-1
- Updated to upstream version 3.2.3
- Added %check, doc and test subpackages
* Tue May 16 2017 Javier Peña <jpena@redhat.com> - 3.2.2-1
- Initial package.