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