Blob Blame History Raw
%global pypi_name djangorestframework

%{!?__python2:%global __python2 %{__python}}
%{!?python2_sitelib:   %global python2_sitelib  %{python_sitelib}}
%{!?python2_sitearch:  %global python2_sitearch %{python_sitearch}}
%{!?python2_version:   %global python2_version  %{python_version}}

%if 0%{?fedora} > 12
%global with_python3 1
%endif

Name:           python-django-rest-framework
Version:        3.7.4
Release:        1%{?dist}
Summary:        Web APIs for Django, made easy

License:        BSD
URL:            http://www.django-rest-framework.org
# Source0:        https://files.pythonhosted.org/packages/source/d/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
Source0:        https://github.com/encode/django-rest-framework/archive/%{version}.tar.gz#/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch



%description
Django REST framework is a powerful and flexible toolkit that makes it easy
to build Web APIs.

Some reasons you might want to use REST framework:

* The Web browsable API is a huge usability win for your developers.
* Authentication policies including OAuth1a and OAuth2 out of the box.
* Serialization that supports both ORM and non-ORM data sources.
* Customizable all the way down - just use regular function-based views if
  you don't need the more powerful features.
* Extensive documentation, and great community support.


%package -n python2-django-rest-framework
Summary:        Web APIs for Django, made easy

Requires:       python2-django
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
%{?python_provide:%python_provide python2-django-rest-framework}


%description -n python2-django-rest-framework
Django REST framework is a powerful and flexible toolkit that makes it easy
to build Web APIs.

Some reasons you might want to use REST framework:

* The Web browsable API is a huge usability win for your developers.
* Authentication policies including OAuth1a and OAuth2 out of the box.
* Serialization that supports both ORM and non-ORM data sources.
* Customizable all the way down - just use regular function-based views if
  you don't need the more powerful features.
* Extensive documentation, and great community support.

%if 0%{?with_python3}
%package -n python3-django-rest-framework
Summary:        Web APIs for Django, made easy

Requires:       python3-django
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
%{?python_provide:%python_provide python3-django-rest-framework}

%description -n python3-django-rest-framework
Django REST framework is a powerful and flexible toolkit that makes it easy
to build Web APIs.

Some reasons you might want to use REST framework:

* The Web browsable API is a huge usability win for your developers.
* Authentication policies including OAuth1a and OAuth2 out of the box.
* Serialization that supports both ORM and non-ORM data sources.
* Customizable all the way down - just use regular function-based views if
  you don't need the more powerful features.
* Extensive documentation, and great community support.

%endif

%prep
%autosetup -n django-rest-framework-%{version}

echo "recursive-include rest_framework/locale *.mo" >> MANIFEST.in

# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info


# remove .po files
find . -name *.po -exec rm -f '{}' \;

%build
%py2_build

%if 0%{?with_python3}
%py3_build
%endif

%install
%py2_install

%if 0%{?with_python3}
%py3_install
%endif

%find_lang django

# separate into files for python2.7 and 3.x
grep "python%{python2_version}" django.lang > django_27.lang
%if 0%{?with_python3}
grep "python%{python3_version}" django.lang > django_34.lang
%endif

%files -n python2-django-rest-framework -f django_27.lang
%license LICENSE.md
%dir %{python2_sitelib}/rest_framework/
%{python2_sitelib}/rest_framework/authtoken
%dir %{python2_sitelib}/rest_framework/locale
%dir %{python2_sitelib}/rest_framework/locale/??/
%dir %{python2_sitelib}/rest_framework/locale/??/LC_MESSAGES
%dir %{python2_sitelib}/rest_framework/locale/??_??/
%dir %{python2_sitelib}/rest_framework/locale/??_??/LC_MESSAGES
%{python2_sitelib}/rest_framework/schemas
%{python2_sitelib}/rest_framework/static
%{python2_sitelib}/rest_framework/templates
%{python2_sitelib}/rest_framework/templatetags
%{python2_sitelib}/rest_framework/utils
%{python2_sitelib}/rest_framework/*.py*
%{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info

%if 0%{?with_python3}
%files -n python3-django-rest-framework -f django_34.lang

%license
%{python3_sitelib}/rest_framework/__pycache__
%dir %{python3_sitelib}/rest_framework/
%{python3_sitelib}/rest_framework/authtoken
%dir %{python3_sitelib}/rest_framework/locale
%dir %{python3_sitelib}/rest_framework/locale/??/
%dir %{python3_sitelib}/rest_framework/locale/??/LC_MESSAGES
%dir %{python3_sitelib}/rest_framework/locale/??_??/
%dir %{python3_sitelib}/rest_framework/locale/??_??/LC_MESSAGES
%{python3_sitelib}/rest_framework/schemas
%{python3_sitelib}/rest_framework/static
%{python3_sitelib}/rest_framework/templates
%{python3_sitelib}/rest_framework/templatetags
%{python3_sitelib}/rest_framework/utils
%{python3_sitelib}/rest_framework/*.py*
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
%endif

%changelog
* Thu Dec 21 2017 Matthias Runge <mrunge@redhat.com> - 3.7.4-1
- update to 3.7.4 (rhbz#1528080)

* Tue Nov 07 2017 Matthias Runge <mrunge@redhat.com> - 3.7.3-1
- update to 3.7.3 (rhbz#1387806)

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 3.5.2-2
- Rebuild for Python 3.6

* Wed Nov 02 2016 Matthias Runge <mrunge@redhat.com> - 3.5.2-1
- update to 3.5.2 (rhbz#1387806)

* Fri Oct 21 2016 Matthias Runge <mrunge@redhat.com> - 3.5.0-1
- update to 3.5.0
- modernize spec file

* Thu Sep 22 2016 Matthias Runge <mrunge@redhat.com> - 3.4.7-1
- update to 3.4.7 (rhbz#1317496)

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3.2-4
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 18 2016 Matthias Runge <mrunge@redhat.com> - 3.3.2-3
- Fix python3 conditionals (rhbz#1399432)
- provide proper python2 and python3 packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Jan 27 2016 Matthias Runge <mrunge@redhat.com> - 3.3.2-1
- update to 3.3.2 (rhbz#1301379)

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Tue May 05 2015 Matthias Runge <mrunge@redhat.com> - 3.1.1-3
- handle locales better (rhbz#1197605)

* Tue May 05 2015 Matthias Runge <mrunge@redhat.com> - 3.1.1-2
- add python-setuptools to BR

* Tue May 05 2015 Matthias Runge <mrunge@redhat.com> - 3.1.1-1
- update to 3.1.1
- add python3 subpackage

* Fri Feb 27 2015 Matthias Runge <mrunge@redhat.com> - 3.0.5-1
- Initial package. (rhbz#1197605)