# 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
# Python 3 check fails on Django2, disable until we update tot whitenoise 4
%global with_python3_check 0
# Python3 is currently only available on Fedora
%if 0%{?fedora}
%global with_python3 1
%endif
%global srcname whitenoise
%global commit0 9238341a348c57e20a0f4bab34fb93b86c7d59be
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
%global owner evansd
Name: python-%{srcname}
Version: 3.3.1
Release: 2%{?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: python2-requests
BuildRequires: python2-setuptools
BuildRequires: python2-pytest
%if 0%{?rhel} == 6
BuildRequires: Django
BuildRequires: python-unittest2
BuildRequires: python-argparse
Requires: Django
%else
%if 0%{?fedora} < 28
BuildRequires: python2-django
Requires: python2-django
%else
BuildRequires: python2-django1.11
Requires: python2-django1.11
%endif
%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: python2-sphinx
BuildRequires: python2-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 ../
sed -i "1iSTATIC_ROOT='.'" -i tests/django_settings.py
%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
%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
export LANG=en_US.UTF-8
python2 setup.py test
%if 0%{?with_python3_check}
python3 setup.py test
%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
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 3.3.1-2
- Rebuilt for Python 3.7
* Mon Mar 19 2018 Piotr Popieluch <piotr1212@gmail.com> - 3.3.1-2
- Update to 3.3.1
- Disable checks on python3 until we have support for Django2
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Jun 30 2017 Piotr Popieluch <piotr1212@gmail.com> - 3.1-4
- Upate requires to include Python version
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 3.1-2
- Rebuild for Python 3.6
* 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