]>
Commit | Line | Data |
---|---|---|
78576fcc ER |
1 | # TODO |
2 | # - fix find-lang | |
3 | # | |
4 | # Conditional build: | |
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 | |
9 | ||
21908af5 | 10 | %define module rest_framework |
78576fcc ER |
11 | %define pypi_name djangorestframework |
12 | Summary: Web APIs for Django, made easy | |
13 | Name: python-django-rest-framework | |
72b1cefd | 14 | Version: 3.6.3 |
2a7eb162 | 15 | Release: 6 |
78576fcc | 16 | License: BSD |
df76c155 | 17 | Source0: https://files.pythonhosted.org/packages/source/d/%{pypi_name}/%{pypi_name}-%{version}.tar.gz |
72b1cefd | 18 | # Source0-md5: 491651fc15e91bfff00684ba2d85d4d4 |
78576fcc ER |
19 | Group: Libraries/Python |
20 | URL: http://www.django-rest-framework.org/ | |
21 | BuildRequires: rpm-pythonprov | |
53621f6f | 22 | BuildRequires: rpmbuild(find_lang) >= 1.40 |
78576fcc ER |
23 | BuildRequires: rpmbuild(macros) >= 1.714 |
24 | %if %{with python2} | |
25 | BuildRequires: python-modules | |
26 | BuildRequires: python-setuptools | |
27 | %endif | |
28 | %if %{with python3} | |
29 | BuildRequires: python3-modules | |
30 | BuildRequires: python3-setuptools | |
31 | %endif | |
32 | Requires: python-django | |
33 | BuildArch: noarch | |
34 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
35 | ||
36 | %description | |
37 | Django REST framework is a powerful and flexible toolkit that makes it | |
38 | easy to build Web APIs. | |
39 | ||
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. | |
47 | ||
48 | %package -n python3-django-rest-framework | |
49 | Summary: Web APIs for Django, made easy | |
50 | Group: Libraries/Python | |
51 | Requires: python3-django | |
52 | ||
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. | |
56 | ||
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. | |
64 | ||
65 | %prep | |
66 | %setup -q -n %{pypi_name}-%{version} | |
67 | ||
68 | # Remove bundled egg-info | |
69 | rm -r %{pypi_name}.egg-info | |
70 | ||
71 | # remove .po files | |
72 | # FIXME: why?! | |
73 | find . -name *.po -exec rm -f '{}' \; | |
74 | ||
75 | %build | |
76 | %if %{with python2} | |
77 | %py_build %{?with_tests:test} | |
78 | %endif | |
79 | ||
80 | %if %{with python3} | |
81 | %py3_build %{?with_tests:test} | |
82 | %endif | |
83 | ||
84 | %install | |
e31dfee4 | 85 | rm -rf $RPM_BUILD_ROOT |
78576fcc ER |
86 | %if %{with python2} |
87 | %py_install | |
88 | %py_postclean | |
89 | %endif | |
90 | ||
91 | %if %{with python3} | |
92 | %py3_install | |
93 | %endif | |
94 | ||
53621f6f | 95 | %find_lang django --with-django |
78576fcc ER |
96 | |
97 | # separate into files for python2.7 and 3.x | |
98 | %if %{with python2} | |
99 | grep "python%{py_ver}" django.lang > django_py2.lang | |
100 | %endif | |
101 | %if %{with python3} | |
102 | grep "python%{py3_ver}" django.lang > django_py3.lang | |
103 | %endif | |
78576fcc ER |
104 | |
105 | %clean | |
106 | rm -rf $RPM_BUILD_ROOT | |
107 | ||
108 | %if %{with python2} | |
109 | %files -f django_py2.lang | |
110 | %defattr(644,root,root,755) | |
0a2aa59a | 111 | %doc LICENSE.md |
21908af5 ER |
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 | |
78576fcc ER |
120 | %{py_sitescriptdir}/%{pypi_name}-%{version}-py%{py_ver}.egg-info |
121 | %endif | |
122 | ||
123 | %if %{with python3} | |
124 | %files -n python3-django-rest-framework -f django_py3.lang | |
125 | %defattr(644,root,root,755) | |
0a2aa59a | 126 | %doc LICENSE.md |
21908af5 ER |
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 | |
78576fcc ER |
136 | %{py3_sitescriptdir}/%{pypi_name}-%{version}-py%{py3_ver}.egg-info |
137 | %endif |