%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-admin-bootstrapped Name: python-%{pypi_name} Version: 1.6.4 Release: 1%{?dist} Summary: Bootstrap support for Django projects License: ASL 2.0 URL: https://pypi.python.org/pypi/%{pypi_name} Source0: https://pypi.python.org/packages/source/d/%{pypi_name}/%{pypi_name}-%{version}.tar.gz # Not included in tarball, so pulled license from the git repo at # https://github.com/riccardo-forina/django-admin-bootstrapped Source1: LICENSE 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 A Django admin theme using Twitter Bootstrap. It doesn't need any kind of modification on your side, just add it to the installed apps. %if 0%{?with_python3} %package -n python3-%{pypi_name} Summary: Best way to have Django DRY forms %description -n python3-%{pypi_name} A Django admin theme using Twitter Bootstrap. It doesn't need any kind of modification on your side, just add it to the installed apps. %endif # with_python3 %prep %setup -q -n %{pypi_name}-%{version} # Add LICENSE from upstream git cp -p %{SOURCE1} . # 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 %{python_sitelib}/* %if 0%{?with_python3} %files -n python3-%{pypi_name} %doc LICENSE %{python3_sitelib}/* %endif # with_python3 %changelog * Thu Jan 16 2014 Brian Pepple - 1.6.4-1 - Initial spec file.