diff --git a/python-whitenoise.spec b/python-whitenoise.spec index db2606d..48d70c9 100644 --- a/python-whitenoise.spec +++ b/python-whitenoise.spec @@ -1,5 +1,12 @@ -# needed for building on EL6 -%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +# 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} @@ -13,7 +20,7 @@ Name: python-%{srcname} Version: 2.0.6 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Static file serving for Python web apps License: MIT @@ -36,11 +43,18 @@ Summary: Static file serving for Python web apps License: MIT BuildRequires: python2-devel -BuildRequires: python-django 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} @@ -50,7 +64,7 @@ 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 @@ -60,6 +74,7 @@ BuildRequires: fontawesome-fonts-web %description -n python2-%{srcname}-doc Documentation for the Python Whitenoise module +%endif # with_docs %if 0%{?with_python3} @@ -83,6 +98,7 @@ 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 @@ -92,86 +108,78 @@ BuildRequires: fontawesome-fonts-web %description -n python3-%{srcname}-doc Documentation for the Python Whitenoise module +%endif # with_docs %endif # with_python3 %prep -%setup -qc -mv %{srcname}-%{commit0} python2 -pushd python2 +%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 ../ -popd - -%if 0%{?with_python3} -cp -a python2 python3 -%endif # with_python3 %build -pushd python2 -%{__python} setup.py build +%py2_build + # Build documentation +%if 0%{?with_docs} pushd docs -sphinx-build -b html -d build/doctrees . build/html +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 -popd +%endif # with_docs +#popd %if 0%{?with_python3} -pushd python3 -%{__python3} setup.py build +%py3_build + # Build documentation +%if 0%{?with_docs} pushd docs -sphinx-build-3 -b html -d build/doctrees . build/html +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 -popd +%endif # with_docs %endif # with_python3 %install %if 0%{?with_python3} -pushd python3 -%{__python3} setup.py install --skip-build --root %{buildroot} -popd +%py3_install %endif # with_python3 -pushd python2 -%{__python} setup.py install --skip-build --root %{buildroot} -popd +%py2_install +%if %{?with_check} %check export DJANGO_SETTINGS_MODULE=tests.django_settings -pushd python2 py.test -popd %if 0%{?with_python3} -pushd python3 py.test-3 -popd %endif # with_python3 +%endif # with_check %files -n python2-%{srcname} %doc README.rst docs/ -%{!?_licensedir:%global license %%doc} %license LICENSE %{python_sitelib}/%{srcname} %{python_sitelib}/%{srcname}-%{version}-py2.?.egg-info +%if 0%{?with_docs} %files -n python2-%{srcname}-doc -%doc python2/docs/build/html +%doc docs/python2/build/html %license LICENSE +%endif # with_docs %if 0%{?with_python3} @@ -182,13 +190,19 @@ popd %{python3_sitelib}/%{srcname}-%{version}-py3.?.egg-info +%if 0%{?with_docs} %files -n python3-%{srcname}-doc -%doc python3/docs/build/html +%doc docs/python3/build/html %license LICENSE +%endif # with_docs %endif # with_python3 %changelog +* Sun Sep 25 2016 Piotr Popieluch - 2.0.6-5 +- Update to newer package guidelines +- EL6 support + * Tue Jul 19 2016 Fedora Release Engineering - 2.0.6-4 - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages