%global with_python3 1
%global pkgname dj_database_url
%global commit c9c933f1bd3087cdbbf9d6abfd26b91f4fa8f8cb
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: python-django-database-url
Version: 0.3.0
Release: 3%{?dist}
Summary: Use Database URLs in your Django Application
Group: Development/Languages
License: BSD
URL: https://github.com/kennethreitz/dj-database-url
Source0: https://github.com/kennethreitz/dj-database-url/archive/%{commit}/dj-database-url-%{commit}.tar.gz
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-setuptools
%if 0%{?with_python3}
BuildRequires: python3-devel
%endif
Requires: python-django
%description
This simple Django utility allows you to utilize the 12factor inspired
DATABASE_URL environment variable to configure your Django application.
%if 0%{?with_python3}
%package -n python3-django-database-url
Summary: Use Database URLs in your Django Application
Group: Development/Languages
Requires: python3-django
%description -n python3-django-database-url
This simple Django utility allows you to utilize the 12factor inspired
DATABASE_URL environment variable to configure your Django application.
%endif
%prep
%setup -qn dj-database-url-%{commit}
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
%{__python2} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif
%install
%{__python2} setup.py install --skip-build --root %{buildroot}
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif
%check
make test
%files
%doc LICENSE README.rst
%{python2_sitelib}/%{pkgname}.py*
%{python2_sitelib}/%{pkgname}-%{version}-py*.egg-info
%if 0%{?with_python3}
%files -n python3-django-database-url
%doc LICENSE README.rst
%{python3_sitelib}/%{pkgname}.py*
%{python3_sitelib}/__pycache__/%{pkgname}.cpython-*.py*
%{python3_sitelib}/%{pkgname}-%{version}-py*.egg-info
%endif
%changelog
* Thu Dec 11 2014 Juan Orti <jorti@fedoraproject.org> - 0.3.0-3
- Add Python3 support
- Change Source0 to GitHub
- Run tests
* Wed Dec 03 2014 Juan Orti <jorti@fedoraproject.org> - 0.3.0-2
- Spec file cleanup
* Mon May 26 2014 Didier Fabert <didier.fabert@gmail.com> 0.3.0-1
- Initial RPM release