[python-django-mptt/f20] added python3 subpackage

Jakub Dorňák jdornak at fedoraproject.org
Mon Dec 2 13:48:12 UTC 2013


commit 58356680c45bbc6251445da0f29a1cd4a5db4e09
Author: Jakub Dorňák <jdornak at redhat.com>
Date:   Mon Dec 2 14:37:39 2013 +0100

    added python3 subpackage

 python-django-mptt.spec           |   78 +++++++++++++++++++++++++++++++-
 python_2_unicode_compatible.patch |   91 +++++++++++++++++++++++++++++++++++++
 2 files changed, 168 insertions(+), 1 deletions(-)
---
diff --git a/python-django-mptt.spec b/python-django-mptt.spec
index b5f9afd..07dc746 100644
--- a/python-django-mptt.spec
+++ b/python-django-mptt.spec
@@ -1,21 +1,31 @@
+%bcond_without  python3
+
 %global pkgname django-mptt
 %global obs_ver 0.4.2-4
 
 Summary:	Utilities for implementing Modified Preorder Tree Traversal
 Name:		python-django-mptt
 Version:	0.6.0
-Release:	1%{?dist}
+Release:	2%{?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
+Patch0:		python_2_unicode_compatible.patch
 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
 
@@ -28,24 +38,74 @@ Obsoletes:		%{pkgname} < %{obs_ver}
 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}
+%patch0 -p1
 #remove unnecessary language ressources:
 # de dk,fr, pl 
 rm mptt/locale/??/LC_MESSAGES/django.po 
 
+%if 0%{?with_python3}
+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 LICENSE README.rst NOTES
 %{python_sitelib}/django_mptt-%{version}-py2.*.egg-info
@@ -54,7 +114,23 @@ sh runtests.sh
 %{python_sitelib}/mptt/templates
 %{python_sitelib}/mptt/templatetags
 
+
+%if 0%{?with_python3}
+%files -n python3-django-mptt -f python3-django.lang
+%doc LICENSE README.rst NOTES
+%{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
+* Mon Nov 25 2013 Jakub Dorňák <jdornak at redhat.com> - 0.6.0-2
+- added python3 subpackage
+
 * Mon Aug 19 2013 Matthias Runge <mrunge at redhat.com> - 0.6.0-1
 - update to 0.6.0
 - fix ftbfs
diff --git a/python_2_unicode_compatible.patch b/python_2_unicode_compatible.patch
new file mode 100644
index 0000000..f0efe96
--- /dev/null
+++ b/python_2_unicode_compatible.patch
@@ -0,0 +1,91 @@
+--- django-mptt-0.6.0/tests/myapp/models.py.orig	2013-11-26 11:47:22.059160623 +0100
++++ django-mptt-0.6.0/tests/myapp/models.py	2013-11-26 11:51:05.432683714 +0100
+@@ -12,11 +12,11 @@ class CustomTreeManager(TreeManager):
+     pass
+ 
+ 
++ at python_2_unicode_compatible
+ class Category(MPTTModel):
+     name = models.CharField(max_length=50)
+     parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
+ 
+-    @python_2_unicode_compatible
+     def __str__(self):
+         return self.name
+ 
+@@ -24,11 +24,11 @@ class Category(MPTTModel):
+         super(Category, self).delete()
+ 
+ 
++ at python_2_unicode_compatible
+ class Genre(MPTTModel):
+     name = models.CharField(max_length=50, unique=True)
+     parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
+ 
+-    @python_2_unicode_compatible
+     def __str__(self):
+         return self.name
+ 
+@@ -37,6 +37,7 @@ class Insert(MPTTModel):
+     parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
+ 
+ 
++ at python_2_unicode_compatible
+ class MultiOrder(MPTTModel):
+     name = models.CharField(max_length=50)
+     size = models.PositiveIntegerField()
+@@ -46,7 +47,6 @@ class MultiOrder(MPTTModel):
+     class MPTTMeta:
+         order_insertion_by = ['name', 'size', '-date']
+ 
+-    @python_2_unicode_compatible
+     def __str__(self):
+         return self.name
+ 
+@@ -61,6 +61,7 @@ class Node(MPTTModel):
+         tree_id_attr = 'work'
+ 
+ 
++ at python_2_unicode_compatible
+ class OrderedInsertion(MPTTModel):
+     name = models.CharField(max_length=50)
+     parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
+@@ -68,7 +69,6 @@ class OrderedInsertion(MPTTModel):
+     class MPTTMeta:
+         order_insertion_by = ['name']
+ 
+-    @python_2_unicode_compatible
+     def __str__(self):
+         return self.name
+ 
+@@ -84,6 +84,7 @@ class NewStyleMPTTMeta(MPTTModel):
+         left_attr = 'testing'
+ 
+ 
++ at python_2_unicode_compatible
+ class Person(MPTTModel):
+     name = models.CharField(max_length=50)
+     parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
+@@ -92,7 +93,6 @@ class Person(MPTTModel):
+     objects = models.Manager()
+     my_tree_manager = CustomTreeManager()
+ 
+-    @python_2_unicode_compatible
+     def __str__(self):
+         return self.name
+ 
+@@ -101,13 +101,13 @@ class Student(Person):
+     type = models.CharField(max_length=50)
+ 
+ 
++ at python_2_unicode_compatible
+ class CustomPKName(MPTTModel):
+     my_id = models.AutoField(db_column='my_custom_name', primary_key=True)
+     name = models.CharField(max_length=50)
+     parent = models.ForeignKey('self', null=True, blank=True,
+             related_name='children', db_column="my_cusom_parent")
+ 
+-    @python_2_unicode_compatible
+     def __str__(self):
+         return self.name
+ 


More information about the scm-commits mailing list