Blob Blame History Raw
%bcond_without  python3

%global pkgname django-mptt
%global obs_ver 0.4.2-4

# share doc between python2 and python3
%global _docdir_fmt %{name}

Summary:	Utilities for implementing Modified Preorder Tree Traversal
Name:		python-django-mptt
Version:	0.7.4
Release:	1%{?dist}
License:	MIT
Group:		Development/Libraries
URL:		http://github.com/django-mptt/django-mptt
Source:		http://pypi.python.org/packages/source/d/%{pkgname}/%{pkgname}-%{version}.tar.gz
BuildArch:	noarch

BuildRequires:	python2-devel
BuildRequires:	python-setuptools
%if 0%{?with_python3}
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
%endif

# required for check-section
BuildRequires:	python-django
%if 0%{?with_python3}
BuildRequires:	python3-django
%endif

Requires:		python-django


Provides:		%{pkgname} = %{version}-%{release}
Obsoletes:		%{pkgname} < %{obs_ver}


%description
Utilities for implementing Modified Preorder Tree Traversal (MPTT)
with your Django Model classes and working with trees of Model instances.


%if 0%{?with_python3}
%package -n python3-django-mptt
Summary:    Utilities for implementing Modified Preorder Tree Traversal
Group:      Development/Libraries

Requires:  python3-django

%description -n python3-django-mptt
Utilities for implementing Modified Preorder Tree Traversal (MPTT)
with your Django Model classes and working with trees of Model instances.
%endif

%prep
%setup -q -n %{pkgname}-%{version}

# remove unnecessary language ressources:
rm mptt/locale/*/LC_MESSAGES/django.po

%if 0%{?with_python3}
rm -rf  %{py3dir}
cp -a . %{py3dir}
%endif


%build
%{__python} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3


%install
%{__python} setup.py install -O1 --skip-build --root="%{buildroot}" --prefix="%{_prefix}"

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root="%{buildroot}" --prefix="%{_prefix}"
popd
%endif # with_python3


%find_lang django

%if 0%{?with_python3}
# When creating Python3 package, separate lang to Python 2 and Python 3 files
grep python3 django.lang > python3-django.lang
grep python2 django.lang > python2-django.lang
mv {python2-,}django.lang
%endif # with_python3


%check
cd tests
sh runtests.sh

%if 0%{?with_python3}
pushd %{py3dir}
cd tests
sed -i s/django-admin/python3-django-admin/ runtests.sh
sh runtests.sh
popd
%endif # with_python3


%files -f django.lang
%doc README.rst NOTES
%license LICENSE
%{python_sitelib}/django_mptt-%{version}-py2.*.egg-info
%dir %{python_sitelib}/mptt
%{python_sitelib}/mptt/*.py*
%{python_sitelib}/mptt/templates
%{python_sitelib}/mptt/templatetags


%if 0%{?with_python3}
%files -n python3-django-mptt -f python3-django.lang
%doc README.rst NOTES
%license LICENSE
%{python3_sitelib}/django_mptt-%{version}-py3.*.egg-info
%dir %{python3_sitelib}/mptt
%{python3_sitelib}/mptt/*.py
%{python3_sitelib}/mptt/templates
%{python3_sitelib}/mptt/templatetags
%{python3_sitelib}/mptt/__pycache__
%endif # with_python3


%changelog
* Tue Jul  7 2015 Jakub Dorňák <jdornak@redhat.com> - 0.7.4-1
- update to 0.7.4
- move license and docs to the right place

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

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 0.6.0-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Mon Nov 25 2013 Jakub Dorňák <jdornak@redhat.com> - 0.6.0-2
- added python3 subpackage

* Mon Aug 19 2013 Matthias Runge <mrunge@redhat.com> - 0.6.0-1
- update to 0.6.0
- fix ftbfs

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Thu Aug 23 2012 Matthias Runge <mrunge@matthias-runge.de> - 0.5.4-1
- update to version 0.5.4 from upstream

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Wed Mar 28 2012 Matthias Runge <mrunge@matthias-runge.de> - 0.5.2-3
- fix double included language files
- fix license

* Tue Mar 27 2012 Matthias Runge <mrunge@matthias-runge.de> - 0.5.2-1
- renamed to python-django-mptt
- update to version 0.5.2

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Mon Nov 29 2010 Dave Riches <dcr226@fedorapeople.org> - 0.4.2-2
- removed redundant comments from spec


* Sun Nov 28 2010 Clint Savage <herlo@fedorapeople.org> - 0.4.2-1
- Updated the package to 0.4.2 and removed a couple unneeded lines from the spec

* Thu Oct 21 2010 Dave Riches <dcr226@fedorapeople.org> - 0.4.1-1
- Packaged for Fedora