%global pypi_name django-tastypie %global docdir %{_docdir}/%{name}-%{fullver} %global majorver 0.9.12 %global release 1 # comment this out to get back to normal versioning %global fullver %{majorver}%{?preminorver:-%{preminorver}} Name: python-%{pypi_name} Version: %{majorver} Release: %{?preminorver:0.}%{release}%{?preminorver:.%{preminorver}}%{?dist} Summary: A flexible and capable API layer for Django Group: Development/Languages License: BSD URL: https://github.com/toastdriven/django-tastypie/ # Only for snapshots: # git clone https://github.com/toastdriven/django-tastypie.git # mv django-tastypie django-tastypie-0.9.12-alpha # tar czf django-tastypie-0.9.12-alpha.tar.gz django-tastypie-0.9.12-alpha #Source0: %{pypi_name}-%{fullver}.tar.gz # Only for non-snapshot versions: Source0: http://pypi.python.org/packages/source/d/%%{pypi_name}/%%{pypi_name}-%%{version}.tar.gz # to get tests: # git clone https://github.com/toastdriven/django-tastypie.git && cd django-tastypie # git checkout v0.9.12 # tar -czf django-tastypie-0.9.12-tests.tgz tests/ Source1: %%{pypi_name}-%%{version}-tests.tgz BuildArch: noarch # Let's keep Requires and BuildRequires sorted alphabetically BuildRequires: python2-devel %if 0%{?rhel} BuildRequires: python-dateutil15 %else BuildRequires: python-dateutil >= 1.5 BuildRequires: python-dateutil < 2.0 %endif %if 0%{?fedora} >= 18 BuildRequires: python-django >= 1.2.0 %else BuildRequires: Django >= 1.2.0 %endif BuildRequires: python-lxml BuildRequires: python-mimeparse >= 0.1.3 BuildRequires: python-setuptools BuildRequires: python-sphinx BuildRequires: PyYAML %if 0%{?rhel} Requires: python-dateutil15 # also require setuptools to be able to use 'require' function from pkg_resources module Requires: python-setuptools %else Requires: python-dateutil >= 1.5 Requires: python-dateutil < 2.0 %endif %if 0%{?fedora} >= 18 Requires: python-django >= 1.2.0 %else Requires: Django >= 1.2.0 %endif Requires: python-mimeparse >= 0.1.3 Provides: %{pypi_name} = %{version}-%{release} Obsoletes: %{pypi_name} < 0.9.11-3 %description Tastypie is an webservice API framework for Django. It provides a convenient, yet powerful and highly customizable, abstraction for creating REST-style interfaces. %package doc Summary: Documentation for %{name} Group: Documentation Requires: %{name} = %{version}-%{release} %description doc This package contains documentation for %{name}. %prep %setup -q -n django-tastypie-%{fullver} rm -rf *egg-info %{!?preminorver:tar xzf %{SOURCE1}} sed -i 's|django-admin.py|django-admin|' tests/run_all_tests.sh # (re)generate the documentation sphinx-build docs docs/_build/html # if on RHEL, using dateutils15, we need to alter __init__.py to load them properly %if 0%{?rhel} cat << 'EOF' >> tastypie/__init__.py from pkg_resources import require require('python-dateutil') EOF %endif %build %{__python} setup.py build %install %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT%{docdir} cp -p LICENSE README.rst AUTHORS -t $RPM_BUILD_ROOT%{docdir} cp -pr docs/_build/html -t $RPM_BUILD_ROOT%{docdir} %check # note: the oauth tests will work once the proper module gets into rawhide # from the authors documentation it is now not very clear if it is # django-oauth or django-oauth-provider or django-oauth-plus # anyway, it is not a hard requirement # also, the gis tests need a running postresql server, so they are skipped pushd tests # handle building on hosts with bad DNS find -type f -name '*.py' -print | xargs sed -i 's|localhost|127.0.0.1|' ./run_all_tests.sh popd %files %doc README.rst AUTHORS LICENSE %dir %{python_sitelib}/tastypie %{python_sitelib}/django_tastypie* %{python_sitelib}/tastypie/* %files doc %doc %{docdir} %exclude %{docdir}/html/.* %changelog * Mon Mar 25 2013 Cédric OLIVIER 0.9.12-1 - Updated to upstream 0.9.12 * Thu Feb 14 2013 Fedora Release Engineering - 0.9.12-0.2.alpha - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild * Tue Aug 14 2012 Bohuslav Kabrda - 0.9.12-0.1.alpha - Updated to upstream version 0.9.12-alpha. - Adapted the specfile to prerelease versioning. - Add some BuildRequires, so that more tests are run (these are soft requirements, so they aren't in Requires) - Fixed URL to point to upstream, not PyPI. - Made the spec compatible with EPEL6. * Sat Jul 21 2012 Fedora Release Engineering - 0.9.11-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild * Sun Mar 18 2012 Cédric OLIVIER 0.9.11-4 - Bugfix in obsoletes * Sun Mar 18 2012 Cédric OLIVIER 0.9.11-3 - Removing bundled .egg-info during prep * Sat Mar 17 2012 Cédric OLIVIER 0.9.11-2 - Adding missing buildrequires - Adding info about renaming django-tastypie - Adding check section - Adding documentation subpackage * Wed Mar 02 2012 Cédric OLIVIER 0.9.11-1 - Initial version of the package