[Django/f17] get building for f17

Tom Callaway spot at fedoraproject.org
Thu Mar 22 18:13:44 UTC 2012


commit e2bdcdec4c5b26bb9f7fa176042c756e3c2bd340
Author: Tom Callaway <spot at fedoraproject.org>
Date:   Thu Mar 22 14:13:41 2012 -0400

    get building for f17

 Django.spec                                     |   54 +++++++++++++++++-----
 django-1.3.1-no-internet-connection-tests.patch |   47 ++++++++++++++++++++
 django-1.3.1-sphinx-param_separator.patch       |   25 ++++++++++
 django-1.3.1-sphinx-table_row_index.patch       |   30 +++++++++++++
 django-1.3.1-test-week_view_allow_future.patch  |   29 ++++++++++++
 5 files changed, 172 insertions(+), 13 deletions(-)
---
diff --git a/Django.spec b/Django.spec
index 890771f..63e0a41 100644
--- a/Django.spec
+++ b/Django.spec
@@ -12,7 +12,19 @@ URL:            http://www.djangoproject.com/
 Source0:        http://media.djangoproject.com/releases/1.3/Django-%{version}.tar.gz
 # stub simplejson module that imports the system version
 Source1:        simplejson-init.py
+# upstream post-1.3.1 patches for building against Sphinx >= 1.1
+# https://code.djangoproject.com/changeset/16223
+Patch0:         django-1.3.1-sphinx-table_row_index.patch
+Patch1:         django-1.3.1-sphinx-param_separator.patch
+# upstream post-1.3.1 patch, fixing a test that only works in 2011
+Patch2:         django-1.3.1-test-week_view_allow_future.patch
+
+# patch tests to skip tests requiring internet connection
+Patch3:         django-1.3.1-no-internet-connection-tests.patch
+
+%if 0%{?rhel} <= 5
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+%endif
 
 BuildArch:      noarch
 # Note: No longer required in development version > 0.95
@@ -21,6 +33,8 @@ BuildRequires:  python-devel
 %if 0%{?rhel} > 4 || 0%{?fedora} > 12
 BuildRequires:  python-sphinx
 %endif
+# for testing
+BuildRequires:  python-simplejson
 
 Requires:       python-simplejson
 
@@ -46,6 +60,19 @@ Python Web framework.
 
 %prep
 %setup -q
+%patch0 -p1 -b .sphinx-table_row_index
+%patch1 -p1 -b .sphinx-param_separator
+%patch2 -p1 -b .test-week_view_allow_future
+
+# patch tests to skip tests requiring internet connection
+%patch3 
+
+# empty files
+echo "# just a comment" > django/contrib/markup/models.py
+echo "# just a comment" > django/contrib/webdesign/models.py
+echo "# just a comment" > django/contrib/staticfiles/models.py
+echo "<!-- nothing -->" > django/contrib/flatpages/tests/templates/registration/login.html
+
 # remove bundled simplejson
 cd django/utils/simplejson/
 rm -rf *
@@ -61,15 +88,10 @@ cp -p %{SOURCE1} __init__.py
 rm -rf $RPM_BUILD_ROOT
 %{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
 
-# Handling locale files
-# This is adapted from the %%find_lang macro, which cannot be directly
-# used since Django locale files are not located in %%{_datadir}
-#
-# The rest of the packaging guideline still apply -- do not list
-# locale files by hand!
-(cd $RPM_BUILD_ROOT && find . -name 'django*.mo') | %{__sed} -e 's|^.||' | %{__sed} -e \
-  's:\(.*/locale/\)\([^/_]\+\)\(.*\.mo$\):%lang(\2) \1\2\3:' \
-  >> %{name}.lang
+%find_lang django
+%find_lang djangojs
+# append djangojs.lang to django.lang
+cat djangojs.lang >> django.lang
 
 # If it's rhel5+ or any Fedora over 12 build docs
 %if 0%{?rhel} > 4 || 0%{?fedora} >= 12
@@ -87,7 +109,7 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d/
 install -m 0644 -p extras/django_bash_completion \
    $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d/
 
-# Fix items in %{_bindir}
+# Fix items in %%{_bindir}
 mv $RPM_BUILD_ROOT%{_bindir}/django-admin.py $RPM_BUILD_ROOT%{_bindir}/django-admin
 
 # remove .po files
@@ -99,12 +121,18 @@ chmod +x \
   $RPM_BUILD_ROOT%{python_sitelib}/django/contrib/admin/media/js/compress.py \
   $RPM_BUILD_ROOT%{python_sitelib}/django/bin/profiling/gather_profile_stats.py*
 
+# test section
+%check
+export PYTHONPATH=$(pwd)
+export LANG=en_US.utf8
+cd tests
+./runtests.py --settings=test_sqlite
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 
-%files -f %{name}.lang
+%files -f django.lang
 %defattr(-,root,root,-)
 %doc AUTHORS LICENSE README
 %{_bindir}/django-admin
@@ -113,8 +141,8 @@ rm -rf $RPM_BUILD_ROOT
 %attr(0755,root,root) %{python_sitelib}/django/bin/daily_cleanup.py*
 %attr(0755,root,root) %{python_sitelib}/django/bin/django-admin.py*
 %dir %{_sysconfdir}/bash_completion.d/
-%{_sysconfdir}/bash_completion.d/django_bash_completion
-%{python_sitelib}/django/bin/profiling/*
+%config(noreplace) %{_sysconfdir}/bash_completion.d/django_bash_completion
+%{python_sitelib}/django/bin/profiling/
 %{python_sitelib}/django/bin/__init__.py*
 # Include everything but the locale data ...
 %dir %{python_sitelib}/django/
diff --git a/django-1.3.1-no-internet-connection-tests.patch b/django-1.3.1-no-internet-connection-tests.patch
new file mode 100644
index 0000000..b2b1726
--- /dev/null
+++ b/django-1.3.1-no-internet-connection-tests.patch
@@ -0,0 +1,47 @@
+diff -up ./tests/modeltests/validation/tests.py.orig ./tests/modeltests/validation/tests.py
+--- ./tests/modeltests/validation/tests.py.orig	2012-03-18 13:24:19.331099108 +0100
++++ ./tests/modeltests/validation/tests.py	2012-03-18 13:24:54.244501199 +0100
+@@ -60,11 +60,11 @@ class BaseModelValidationTests(Validatio
+ 
+     def test_correct_url_value_passes(self):
+         mtv = ModelToValidate(number=10, name='Some Name', url_verify='http://www.google.com/')
+-        self.assertEqual(None, mtv.full_clean()) # This will fail if there's no Internet connection
++        # self.assertEqual(None, mtv.full_clean()) # This will fail if there's no Internet connection
+ 
+     def test_correct_url_with_redirect(self):
+         mtv = ModelToValidate(number=10, name='Some Name', url_verify='http://qa-dev.w3.org/link-testsuite/http.php?code=301') #example.com is a redirect to iana.org now
+-        self.assertEqual(None, mtv.full_clean()) # This will fail if there's no Internet connection
++        # self.assertEqual(None, mtv.full_clean()) # This will fail if there's no Internet connection
+ 
+     def test_correct_https_url_but_nonexisting(self):
+         mtv = ModelToValidate(number=10, name='Some Name', url_verify='https://www.example.com/')
+diff -up ./tests/regressiontests/forms/tests/fields.py.orig ./tests/regressiontests/forms/tests/fields.py
+--- ./tests/regressiontests/forms/tests/fields.py.orig	2012-03-18 13:21:47.999334489 +0100
++++ ./tests/regressiontests/forms/tests/fields.py	2012-03-18 13:22:58.129150306 +0100
+@@ -559,7 +559,7 @@ class FieldsTests(TestCase):
+ 
+     def test_urlfield_3(self):
+         f = URLField(verify_exists=True)
+-        self.assertEqual(u'http://www.google.com/', f.clean('http://www.google.com')) # This will fail if there's no Internet connection
++        #self.assertEqual(u'http://www.google.com/', f.clean('http://www.google.com')) # This will fail if there's no Internet connection
+         self.assertRaisesErrorWithMessage(ValidationError, "[u'Enter a valid URL.']", f.clean, 'http://example')
+         self.assertRaises(ValidationError, f.clean, 'http://www.broken.djangoproject.com') # bad domain
+         self.assertRaises(ValidationError, f.clean, 'http://qa-dev.w3.org/link-testsuite/http.php?code=405') # Method not allowed
+@@ -576,7 +576,7 @@ class FieldsTests(TestCase):
+     def test_urlfield_4(self):
+         f = URLField(verify_exists=True, required=False)
+         self.assertEqual(u'', f.clean(''))
+-        self.assertEqual(u'http://www.google.com/', f.clean('http://www.google.com')) # This will fail if there's no Internet connection
++        #self.assertEqual(u'http://www.google.com/', f.clean('http://www.google.com')) # This will fail if there's no Internet connection
+ 
+     def test_urlfield_5(self):
+         f = URLField(min_length=15, max_length=20)
+@@ -629,7 +629,7 @@ class FieldsTests(TestCase):
+         # UTF-8 in the domain.
+         f = URLField(verify_exists=True)
+         url = u'http://\u03b5\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac.idn.icann.org/\u0391\u03c1\u03c7\u03b9\u03ba\u03ae_\u03c3\u03b5\u03bb\u03af\u03b4\u03b1'
+-        self.assertEqual(url, f.clean(url)) #This will fail without internet.
++        # self.assertEqual(url, f.clean(url)) #This will fail without internet.
+ 
+     # BooleanField ################################################################
+ 
diff --git a/django-1.3.1-sphinx-param_separator.patch b/django-1.3.1-sphinx-param_separator.patch
new file mode 100644
index 0000000..5143999
--- /dev/null
+++ b/django-1.3.1-sphinx-param_separator.patch
@@ -0,0 +1,25 @@
+From 060923d9759a882ac6e94fafbf904379ed76f38e Mon Sep 17 00:00:00 2001
+From: lukeplant <lukeplant at bcc190cf-cafb-0310-a4f2-bffc1f526a37>
+Date: Sun, 15 May 2011 23:02:36 +0000
+Subject: [PATCH] Fixed djangodocs Sphinx extension to work with latest Sphinx
+
+git-svn-id: http://code.djangoproject.com/svn/django/trunk@16231 bcc190cf-cafb-0310-a4f2-bffc1f526a37
+---
+ docs/_ext/djangodocs.py |    1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/docs/_ext/djangodocs.py b/docs/_ext/djangodocs.py
+index eec0983..5d49ef0 100644
+--- a/docs/_ext/djangodocs.py
++++ b/docs/_ext/djangodocs.py
+@@ -134,6 +134,7 @@ class DjangoHTMLTranslator(SmartyPantsHTMLTranslator):
+     def visit_desc_parameterlist(self, node):
+         self.body.append('(')
+         self.first_param = 1
++        self.param_separator = node.child_text_separator
+ 
+     def depart_desc_parameterlist(self, node):
+         self.body.append(')')
+-- 
+1.7.9.3
+
diff --git a/django-1.3.1-sphinx-table_row_index.patch b/django-1.3.1-sphinx-table_row_index.patch
new file mode 100644
index 0000000..fc69c86
--- /dev/null
+++ b/django-1.3.1-sphinx-table_row_index.patch
@@ -0,0 +1,30 @@
+From 8b763b0ed60c460738e0d0a2e3f93685bac78a8c Mon Sep 17 00:00:00 2001
+From: lukeplant <lukeplant at bcc190cf-cafb-0310-a4f2-bffc1f526a37>
+Date: Sat, 14 May 2011 02:58:58 +0000
+Subject: [PATCH] Fixed our Sphinx extension to work with latest Sphinx
+
+This is pretty hacky, but there doesn't seem to be a nice way to fix it,
+since we can't call the base method - we are deliberately overriding it in
+order to not call the base method, which adds an unwanted 'border=1' to the
+HTML.
+
+git-svn-id: http://code.djangoproject.com/svn/django/trunk@16223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
+---
+ docs/_ext/djangodocs.py |    1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/docs/_ext/djangodocs.py b/docs/_ext/djangodocs.py
+index 7710786..eec0983 100644
+--- a/docs/_ext/djangodocs.py
++++ b/docs/_ext/djangodocs.py
+@@ -127,6 +127,7 @@ class DjangoHTMLTranslator(SmartyPantsHTMLTranslator):
+ 
+     # Don't use border=1, which docutils does by default.
+     def visit_table(self, node):
++        self._table_row_index = 0 # Needed by Sphinx
+         self.body.append(self.starttag(node, 'table', CLASS='docutils'))
+ 
+     # <big>? Really?
+-- 
+1.7.9.3
+
diff --git a/django-1.3.1-test-week_view_allow_future.patch b/django-1.3.1-test-week_view_allow_future.patch
new file mode 100644
index 0000000..325a4f5
--- /dev/null
+++ b/django-1.3.1-test-week_view_allow_future.patch
@@ -0,0 +1,29 @@
+From fba031c2e26ff7176d601826f8b067d8f0ef2dfb Mon Sep 17 00:00:00 2001
+From: aaugustin <aaugustin at bcc190cf-cafb-0310-a4f2-bffc1f526a37>
+Date: Sun, 1 Jan 2012 20:59:09 +0000
+Subject: [PATCH] Fixed #17488 -- This test passed in 2011 only because
+ 2012-01-01 is a Sunday. Thanks Florian Apolloner for the
+ report and patch.
+
+git-svn-id: http://code.djangoproject.com/svn/django/trunk@17321 bcc190cf-cafb-0310-a4f2-bffc1f526a37
+---
+ tests/regressiontests/generic_views/dates.py |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/tests/regressiontests/generic_views/dates.py b/tests/regressiontests/generic_views/dates.py
+index 5e03dbe..652f66b 100644
+--- a/tests/regressiontests/generic_views/dates.py
++++ b/tests/regressiontests/generic_views/dates.py
+@@ -257,7 +257,8 @@ class WeekArchiveViewTests(TestCase):
+         self.assertEqual(list(res.context['book_list']), [])
+ 
+     def test_week_view_allow_future(self):
+-        future = datetime.date(datetime.date.today().year + 1, 1, 1)
++        # January 7th always falls in week 1, given Python's definition of week numbers
++        future = datetime.date(datetime.date.today().year + 1, 1, 7)
+         b = Book.objects.create(name="The New New Testement", pages=600, pubdate=future)
+ 
+         res = self.client.get('/dates/books/%s/week/1/' % future.year)
+-- 
+1.7.9.3
+


More information about the scm-commits mailing list