%if (0%{?fedora} > 12 || 0%{?rhel} > 5) %global with_python3 1 %else %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} %endif %global pypi_name django-crispy-forms Name: python-%{pypi_name} Version: 1.4.0 Release: 2%{?dist} Summary: Best way to have Django DRY forms License: MIT URL: http://pypi.python.org/pypi/%{pypi_name}/%{version} Source0: http://pypi.python.org/packages/source/d/%{pypi_name}/%{pypi_name}-%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel BuildRequires: python-setuptools %if 0%{?with_python3} BuildRequires: python3-devel BuildRequires: python3-setuptools %endif # with_python3 Requires: python-django %description The best way to have Django DRY forms. Build programmatic reusable layouts out of components, having full control of the rendered HTML without writing HTML in templates. All this without breaking the standard way of doing things in Django, so it plays nice with any other form application. %if 0%{?with_python3} %package -n python3-%{pypi_name} Summary: Best way to have Django DRY forms %description -n python3-%{pypi_name} The best way to have Django DRY forms. Build programmatic reusable layouts out of components, having full control of the rendered HTML without writing HTML in templates. All this without breaking the standard way of doing things in Django, so it plays nice with any other form application. %endif # with_python3 %prep %setup -q -n %{pypi_name}-%{version} # Fix some rpmlint warnings for script in crispy_forms/tests/runtests.py crispy_forms/tests/runtests_bootstrap3.py crispy_forms/tests/runtests_uniform.py crispy_forms/tests/runtests_bootstrap.py; do %{__sed} -i.orig -e 1d ${script} touch -r ${script}.orig ${script} %{__rm} ${script}.orig chmod a-x ${script} done # Remove zero-length file. rm -f crispy_forms/models.py # Remove bundled egg-info rm -rf %{pypi_name}.egg-info %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' %endif # with_python3 find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|' %build %{__python} setup.py build %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py build popd %endif # with_python3 %install rm -rf $RPM_BUILD_ROOT %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT popd %endif # with_python3 %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT %files %doc LICENSE.txt README.rst %{python_sitelib}/* %if 0%{?with_python3} %files -n python3-%{pypi_name} %doc LICENSE.txt README.rst %{python3_sitelib}/* %endif # with_python3 %changelog * Thu Jan 16 2014 Brian Pepple - 1.4.0-2 - Add python3 support. * Tue Jan 14 2014 Brian Pepple - 1.4.0-1 - Initial spec file.