# docs don't build on el6
# check fails on el6 but seems to work
%if 0%{?rhel} == 6
%global with_docs 0
%global with_check 0
%else
%global with_docs 1
%global with_check 1
%endif
# Python3 is currently only available on Fedora
%if 0%{?fedora}
%global with_python3 1
%endif
%global srcname whitenoise
%global commit0 a1bb363faeb2ea864b82bde0b9290b9fd72c1032
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
%global owner evansd
Name: python-%{srcname}
Version: 3.1
Release: 1%{?dist}
Summary: Static file serving for Python web apps
License: MIT
URL: http://whitenoise.evans.io/
# pypi source does not contain tests
Source0: https://github.com/%{owner}/%{srcname}/archive/%{commit0}.tar.gz#/%{srcname}-%{shortcommit0}.tar.gz
BuildArch: noarch
%description
Radically simplified static file serving for python web apps. with a couple of
lines of config whitenoise allows your web app to serve its own static files,
making it a self-contained unit that can be deployed anywhere without relying
on nginx, amazon s3 or any other external service. (Especially useful on
Heroku, OpenShift and other PaaS providers.)
%package -n python2-%{srcname}
Summary: Static file serving for Python web apps
License: MIT
BuildRequires: python2-devel
BuildRequires: python-requests
BuildRequires: python-setuptools
BuildRequires: pytest
%if 0%{?rhel} == 6
BuildRequires: Django
BuildRequires: python-unittest2
BuildRequires: python-argparse
Requires: Django
%else
BuildRequires: python-django
Requires: python-django
%endif
%{?python_provide:%python_provide python2-%{srcname}}
%description -n python2-%{srcname}
Radically simplified static file serving for python web apps. with a couple of
lines of config whitenoise allows your web app to serve its own static files,
making it a self-contained unit that can be deployed anywhere without relying
on nginx, amazon s3 or any other external service. (Especially useful on
Heroku, OpenShift and other PaaS providers.)
%if 0%{?with_docs}
%package -n python2-%{srcname}-doc
Summary: Documentation for the Python Whitenoise module
BuildRequires: python-sphinx
BuildRequires: python-sphinx_rtd_theme
%description -n python2-%{srcname}-doc
Documentation for the Python Whitenoise module
%endif # with_docs
%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary: Static file serving for Python web apps
License: MIT
BuildRequires: python3-devel
BuildRequires: python3-django
BuildRequires: python3-pytest
BuildRequires: python3-requests
BuildRequires: python3-setuptools
Requires: python3-django
%{?python_provide:%python_provide python3-%{srcname}}
%description -n python3-%{srcname}
Radically simplified static file serving for python web apps. with a couple of
lines of config whitenoise allows your web app to serve its own static files,
making it a self-contained unit that can be deployed anywhere without relying
on nginx, amazon s3 or any other external service. (especially useful on
heroku, openshift and other paas providers.)
%if 0%{?with_docs}
%package -n python3-%{srcname}-doc
Summary: Documentation for the Python Whitenoise module
BuildRequires: python3-sphinx
BuildRequires: python3-sphinx_rtd_theme
# Can be removed after RHBZ#1282297 is pushed
BuildRequires: fontawesome-fonts-web
%description -n python3-%{srcname}-doc
Documentation for the Python Whitenoise module
%endif # with_docs
%endif # with_python3
%prep
%autosetup -n %{srcname}-%{commit0}
# remove dangling doc symlink
rm docs/changelog.rst
# copy common doc files to top dir
cp -pr docs/ README.rst LICENSE ../
%build
%py2_build
# Build documentation
%if 0%{?with_docs}
pushd docs
sphinx-build -b html -d build/doctrees . python2/build/html
# remove unneeded files which create rpmlint warnings
rm -f build/html/.buildinfo
rm -f build/html/objects.inv
popd
%endif # with_docs
#popd
%if 0%{?with_python3}
%py3_build
# Build documentation
%if 0%{?with_docs}
pushd docs
sphinx-build-3 -b html -d build/doctrees . python3/build/html
# remove unneeded files which create rpmlint warnings
rm -f build/html/.buildinfo
rm -f build/html/objects.inv
popd
%endif # with_docs
%endif # with_python3
%install
%if 0%{?with_python3}
%py3_install
%endif # with_python3
%py2_install
%if %{?with_check}
%check
export DJANGO_SETTINGS_MODULE=tests.django_settings
py.test
%if 0%{?with_python3}
py.test-3
%endif # with_python3
%endif # with_check
%files -n python2-%{srcname}
%doc README.rst docs/
%license LICENSE
%{python_sitelib}/%{srcname}
%{python_sitelib}/%{srcname}-%{version}-py2.?.egg-info
%if 0%{?with_docs}
%files -n python2-%{srcname}-doc
%doc docs/python2/build/html
%license LICENSE
%endif # with_docs
%if 0%{?with_python3}
%files -n python3-%{srcname}
%doc README.rst docs/
%license LICENSE
%{python3_sitelib}/%{srcname}
%{python3_sitelib}/%{srcname}-%{version}-py3.?.egg-info
%if 0%{?with_docs}
%files -n python3-%{srcname}-doc
%doc docs/python3/build/html
%license LICENSE
%endif # with_docs
%endif # with_python3
%changelog
* Sun Sep 25 2016 Piotr Popieluch <piotr1212@gmail.com> - - 3.1-1
- Update to 3.1
* Sun Sep 25 2016 Piotr Popieluch <piotr1212@gmail.com> - 2.0.6-5
- Update to newer package guidelines
- EL6 support
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.6-4
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Sun Nov 29 2015 Piotr Popieluch <piotr1212@gmail.com> - 2.0.6-2
- Add license to all subpackages
- Create a python2 subpackage
* Fri Nov 27 2015 Piotr Popieluch <piotr1212@gmail.com> - 2.0.6-1
- Update to new version
- Add missing BR
- Change source from pypi to github
- Use py.test
- Add doc subpackage
* Tue Nov 10 2015 Piotr Popieluch <piotr1212@gmail.com> - 2.0.4-3
- Rewrite spec to support EL6 & EL7
* Thu Nov 05 2015 Piotr Popieluch <piotr1212@gmail.com> - 2.0.4-2
- Remove shebang from gzip.py script
* Thu Oct 22 2015 Piotr Popieluch <piotr1212@gmail.com> - 2.0.4-1
- Initial package