5 %bcond_without doc # don't build doc
6 %bcond_with tests # do not perform "make test"
7 %bcond_without python2 # CPython 2.x module
8 %bcond_without python3 # CPython 3.x module
10 %define module rest_framework
11 %define pypi_name djangorestframework
12 Summary: Web APIs for Django, made easy
13 Name: python-django-rest-framework
17 Source0: https://files.pythonhosted.org/packages/source/d/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
18 # Source0-md5: 491651fc15e91bfff00684ba2d85d4d4
19 Group: Libraries/Python
20 URL: http://www.django-rest-framework.org/
21 BuildRequires: rpm-pythonprov
22 BuildRequires: rpmbuild(find_lang) >= 1.40
23 BuildRequires: rpmbuild(macros) >= 1.714
25 BuildRequires: python-modules
26 BuildRequires: python-setuptools
29 BuildRequires: python3-modules
30 BuildRequires: python3-setuptools
32 Requires: python-django
34 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
37 Django REST framework is a powerful and flexible toolkit that makes it
38 easy to build Web APIs.
40 Some reasons you might want to use REST framework:
41 - The Web browsable API is a huge usability win for your developers.
42 - Authentication policies including OAuth1a and OAuth2 out of the box.
43 - Serialization that supports both ORM and non-ORM data sources.
44 - Customizable all the way down - just use regular function-based
45 views if you don't need the more powerful features.
46 - Extensive documentation, and great community support.
48 %package -n python3-django-rest-framework
49 Summary: Web APIs for Django, made easy
50 Group: Libraries/Python
51 Requires: python3-django
53 %description -n python3-django-rest-framework
54 Django REST framework is a powerful and flexible toolkit that makes it
55 easy to build Web APIs.
57 Some reasons you might want to use REST framework:
58 - The Web browsable API is a huge usability win for your developers.
59 - Authentication policies including OAuth1a and OAuth2 out of the box.
60 - Serialization that supports both ORM and non-ORM data sources.
61 - Customizable all the way down - just use regular function-based
62 views if you don't need the more powerful features.
63 - Extensive documentation, and great community support.
66 %setup -q -n %{pypi_name}-%{version}
68 # Remove bundled egg-info
69 rm -r %{pypi_name}.egg-info
73 find . -name *.po -exec rm -f '{}' \;
77 %py_build %{?with_tests:test}
81 %py3_build %{?with_tests:test}
85 rm -rf $RPM_BUILD_ROOT
95 %find_lang django --with-django
97 # separate into files for python2.7 and 3.x
99 grep "python%{py_ver}" django.lang > django_py2.lang
102 grep "python%{py3_ver}" django.lang > django_py3.lang
106 rm -rf $RPM_BUILD_ROOT
109 %files -f django_py2.lang
110 %defattr(644,root,root,755)
112 %dir %{py_sitescriptdir}/%{module}
113 %{py_sitescriptdir}/%{module}/*.py*
114 %{py_sitescriptdir}/%{module}/authtoken
115 %{py_sitescriptdir}/%{module}/static
116 %{py_sitescriptdir}/%{module}/templates
117 %{py_sitescriptdir}/%{module}/templatetags
118 %{py_sitescriptdir}/%{module}/utils
119 %dir %{py_sitescriptdir}/%{module}/locale
120 %{py_sitescriptdir}/%{pypi_name}-%{version}-py%{py_ver}.egg-info
124 %files -n python3-django-rest-framework -f django_py3.lang
125 %defattr(644,root,root,755)
127 %dir %{py3_sitescriptdir}/%{module}
128 %{py3_sitescriptdir}/%{module}/__pycache__
129 %{py3_sitescriptdir}/%{module}/*.py*
130 %{py3_sitescriptdir}/%{module}/authtoken
131 %{py3_sitescriptdir}/%{module}/static
132 %{py3_sitescriptdir}/%{module}/templates
133 %{py3_sitescriptdir}/%{module}/templatetags
134 %{py3_sitescriptdir}/%{module}/utils
135 %dir %{py3_sitescriptdir}/%{module}/locale
136 %{py3_sitescriptdir}/%{pypi_name}-%{version}-py%{py3_ver}.egg-info