[python-django-tagging/f20] added python3 subpackage
Jakub QB Dorňák
jdornak at fedoraproject.org
Tue Dec 3 09:08:28 UTC 2013
commit f3346c7b821755d5e6dfadc7befe03f8a880edf1
Author: Jakub Dorňák <jdornak at redhat.com>
Date: Tue Dec 3 00:47:33 2013 +0100
added python3 subpackage
...jango-tagging-0.3.1-force_unicode-python3.patch | 15 ++++
python-django-tagging-0.3.1-tests-python3.patch | 75 ++++++++++++++++++++
python-django-tagging.spec | 54 ++++++++++++++-
3 files changed, 143 insertions(+), 1 deletions(-)
---
diff --git a/python-django-tagging-0.3.1-force_unicode-python3.patch b/python-django-tagging-0.3.1-force_unicode-python3.patch
new file mode 100644
index 0000000..651f648
--- /dev/null
+++ b/python-django-tagging-0.3.1-force_unicode-python3.patch
@@ -0,0 +1,15 @@
+--- django-tagging-0.3.1/tagging/utils.py.orig 2013-12-02 13:30:03.178161959 +0100
++++ django-tagging-0.3.1/tagging/utils.py 2013-12-02 13:31:22.120109727 +0100
+@@ -6,7 +6,11 @@ import math
+ import types
+
+ from django.db.models.query import QuerySet
+-from django.utils.encoding import force_unicode
++try:
++ from django.utils.encoding import force_unicode
++except:
++ # force_unicode is not provided for Py3
++ force_unicode = lambda s: s
+ from django.utils.translation import ugettext as _
+
+ # Python 2.3 compatibility
diff --git a/python-django-tagging-0.3.1-tests-python3.patch b/python-django-tagging-0.3.1-tests-python3.patch
new file mode 100644
index 0000000..7c32a12
--- /dev/null
+++ b/python-django-tagging-0.3.1-tests-python3.patch
@@ -0,0 +1,75 @@
+--- python3-python-django-tagging-0.3.1-9.fc21/tagging/tests/tests.py.orig 2013-12-01 22:07:49.305428938 +0100
++++ python3-python-django-tagging-0.3.1-9.fc21/tagging/tests/tests.py 2013-12-01 22:07:12.260484502 +0100
+@@ -136,10 +136,10 @@ class TestNormalisedTagListInput(TestCas
+ def test_with_invalid_input_mix_of_string_and_instance(self):
+ try:
+ get_tag_list(['cheese', self.toast])
+- except ValueError, ve:
++ except ValueError as ve:
+ self.assertEquals(str(ve),
+ 'If a list or tuple of tags is provided, they must all be tag names, Tag objects or Tag ids.')
+- except Exception, e:
++ except Exception as e:
+ raise self.failureException('the wrong type of exception was raised: type [%s] value [%]' %\
+ (str(type(e)), str(e)))
+ else:
+@@ -148,9 +148,9 @@ class TestNormalisedTagListInput(TestCas
+ def test_with_invalid_input(self):
+ try:
+ get_tag_list(29)
+- except ValueError, ve:
++ except ValueError as ve:
+ self.assertEquals(str(ve), 'The tag input given was invalid.')
+- except Exception, e:
++ except Exception as e:
+ raise self.failureException('the wrong type of exception was raised: type [%s] value [%s]' %\
+ (str(type(e)), str(e)))
+ else:
+@@ -204,9 +204,9 @@ class TestCalculateCloud(TestCase):
+ def test_invalid_distribution(self):
+ try:
+ calculate_cloud(self.tags, steps=5, distribution='cheese')
+- except ValueError, ve:
++ except ValueError as ve:
+ self.assertEquals(str(ve), 'Invalid distribution algorithm specified: cheese.')
+- except Exception, e:
++ except Exception as e:
+ raise self.failureException('the wrong type of exception was raised: type [%s] value [%s]' %\
+ (str(type(e)), str(e)))
+ else:
+@@ -272,9 +272,9 @@ class TestBasicTagging(TestCase):
+
+ try:
+ Tag.objects.add_tag(self.dead_parrot, ' ')
+- except AttributeError, ae:
++ except AttributeError as ae:
+ self.assertEquals(str(ae), 'No tags were given: " ".')
+- except Exception, e:
++ except Exception as e:
+ raise self.failureException('the wrong type of exception was raised: type [%s] value [%s]' %\
+ (str(type(e)), str(e)))
+ else:
+@@ -291,9 +291,9 @@ class TestBasicTagging(TestCase):
+
+ try:
+ Tag.objects.add_tag(self.dead_parrot, 'one two')
+- except AttributeError, ae:
++ except AttributeError as ae:
+ self.assertEquals(str(ae), 'Multiple tags were given: "one two".')
+- except Exception, e:
++ except Exception as e:
+ raise self.failureException('the wrong type of exception was raised: type [%s] value [%s]' %\
+ (str(type(e)), str(e)))
+ else:
+@@ -893,9 +893,9 @@ class TestTagFieldInForms(TestCase):
+ u'foo qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvb bar')
+ try:
+ t.clean('foo qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbn bar')
+- except forms.ValidationError, ve:
++ except forms.ValidationError as ve:
+ self.assertEquals(str(ve), "[u'Each tag may be no more than 50 characters long.']")
+- except Exception, e:
++ except Exception as e:
+ raise e
+ else:
+ raise self.failureException('a ValidationError exception was supposed to have been raised.')
diff --git a/python-django-tagging.spec b/python-django-tagging.spec
index a80fb9d..0e6601a 100644
--- a/python-django-tagging.spec
+++ b/python-django-tagging.spec
@@ -1,7 +1,9 @@
+%bcond_without python3
+
%global pkgname django-tagging
Name: python-django-tagging
Version: 0.3.1
-Release: 8%{?dist}
+Release: 9%{?dist}
Summary: A generic tagging application for Django projects
Group: Development/Languages
@@ -9,9 +11,14 @@ License: MIT
URL: http://code.google.com/p/django-tagging/
Source0: http://pypi.python.org/packages/source/d/%{pkgname}/%{pkgname}-%{version}.tar.gz
#md5=a0855f2b044db15f3f8a025fa1016ddf
+Patch0: python-django-tagging-0.3.1-tests-python3.patch
+Patch1: python-django-tagging-0.3.1-force_unicode-python3.patch
BuildArch: noarch
BuildRequires: python2-devel
+%if 0%{?with_python3}
+BuildRequires: python3-devel
+%endif
Requires: python-django
Provides: %{pkgname} = %{version}-%{release}
@@ -23,23 +30,68 @@ A generic tagging application for Django projects, which allows association
of a number of tags with any Model instance and makes retrieval of tags
simple.
+
+%if 0%{?with_python3}
+%package -n python3-django-tagging
+Summary: A generic tagging application for Django projects
+Group: Development/Languages
+
+Requires: python3-django
+
+%description -n python3-django-tagging
+A generic tagging application for Django projects, which allows association
+of a number of tags with any Model instance and makes retrieval of tags
+simple.
+%endif
+
+
%prep
%setup -q -n %{pkgname}-%{version}
+%patch0 -p1 -b .tests-python3
+%patch1 -p1 -b .force_unicode-python3
+
+%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
+
%install
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+popd
+%endif
+
%files
%doc CHANGELOG.txt LICENSE.txt README.txt docs/*
%{python_sitelib}/tagging
%{python_sitelib}/django_tagging-%{version}-py?.?.egg-info
+%if 0%{?with_python3}
+%files -n python3-django-tagging
+%doc CHANGELOG.txt LICENSE.txt README.txt docs/*
+%{python3_sitelib}/tagging
+%{python3_sitelib}/django_tagging-%{version}-py?.?.egg-info
+%endif
+
+
%changelog
+* Sun Dec 1 2013 Jakub Dorňák <jdornak at redhat.com> - 0.3.1-9
+- added python3 subpackage
+
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.3.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
More information about the scm-commits
mailing list