Merge ~lvoytek/ubuntu/+source/django-assets:fix-django4-compatibility into ubuntu/+source/django-assets:ubuntu/devel

Proposed by Lena Voytek
Status: Merged
Approved by: git-ubuntu bot
Approved revision: not available
Merged at revision: d228897d8e882bdd2c76ec7671b70176b7332680
Proposed branch: ~lvoytek/ubuntu/+source/django-assets:fix-django4-compatibility
Merge into: ubuntu/+source/django-assets:ubuntu/devel
Diff against target: 131 lines (+56/-30)
6 files modified
debian/changelog (+9/-0)
debian/control (+2/-1)
debian/patches/django4-compatibility.patch (+21/-0)
debian/patches/fix-node-iteration.patch (+22/-0)
debian/patches/series (+2/-1)
dev/null (+0/-28)
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Graham Inggs (community) Approve
Canonical Server Pending
Canonical Server Reporter Pending
Review via email: mp+449658@code.launchpad.net

Description of the change

Make django-assets compatible with Django 4.2 and fix build failures

django4-compatibility.patch comes from a merge request upstream that updates requires_system_checks to an empty array rather than False as boolean compatibility was removed in Django 4

01-webassets_version.patch is removed since upstream added the >= in __init__.py, meaning having it would lead to the error:
error in django-assets setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after name and no valid version specifier)
    webassets>=>=2.0

fix-node-iteration.patch Fixes the error:
TypeError: 'TextNode' object is not iterable
I created this patch myself and sent the fix upstream - https://github.com/miracle2k/django-assets/pull/105

PPA: https://launchpad.net/~lvoytek/+archive/ubuntu/django-4-mantic

To post a comment you must log in.
Revision history for this message
Graham Inggs (ginggs) wrote :

Looks good to me!

review: Approve
Revision history for this message
git-ubuntu bot (git-ubuntu-bot) wrote :

Approvers: ginggs, lvoytek
Uploaders: ginggs
MP auto-approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index d5483f5..37c5beb 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,12 @@
6+django-assets (2.0-2.1ubuntu1) mantic; urgency=medium
7+
8+ * d/p/django4-compatibility.patch: Fix Django 4 compatibility by updating the
9+ deprecated field requires_system_checks (LP: #2022089)
10+ * d/p/fix-node-iteration.patch: Fix TypeError when iterating over Nodes
11+ * d/p/01-webassets_version.patch: Remove - fixed upstream through __init__.py
12+
13+ -- Lena Voytek <lena.voytek@canonical.com> Mon, 31 Jul 2023 12:07:24 -0700
14+
15 django-assets (2.0-2.1) unstable; urgency=low
16
17 * Non-maintainer upload.
18diff --git a/debian/control b/debian/control
19index ae19f0b..00cd2fe 100644
20--- a/debian/control
21+++ b/debian/control
22@@ -1,7 +1,8 @@
23 Source: django-assets
24 Section: python
25 Priority: optional
26-Maintainer: Debian Python Team <team+python@tracker.debian.org>
27+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
28+XSBC-Original-Maintainer: Debian Python Team <team+python@tracker.debian.org>
29 Uploaders:
30 Michael Fladischer <fladi@debian.org>,
31 Chris Lamb <lamby@debian.org>,
32diff --git a/debian/patches/01-webassets_version.patch b/debian/patches/01-webassets_version.patch
33deleted file mode 100644
34index e6aa376..0000000
35--- a/debian/patches/01-webassets_version.patch
36+++ /dev/null
37@@ -1,28 +0,0 @@
38-From: Mcihael Fladischer <fladi@debian.org>
39-Date: Thu, 8 Oct 2015 08:49:20 -0700
40-Subject: loosen up dependency on webassets
41-
42- Upstream uses a strict versioned dependency on webassets-library which is
43- unnecessary. This patch loosens up this dependency to also allow newer versions
44- of webassets.
45-Last-Update: 2014-09-09
46-Forwarded: no
47-
48-Patch-Name: 01-webassets_version.patch
49----
50- setup.py | 2 +-
51- 1 file changed, 1 insertion(+), 1 deletion(-)
52-
53-diff --git a/setup.py b/setup.py
54-index 206458a..07a9ca0 100755
55---- a/setup.py
56-+++ b/setup.py
57-@@ -42,7 +42,7 @@ setup(
58- platforms='any',
59- install_requires=[
60- 'Django>=1.7',
61-- 'webassets%s' % webassets_version
62-+ 'webassets>=%s' % webassets_version
63- ],
64- classifiers=[
65- 'Environment :: Web Environment',
66diff --git a/debian/patches/django4-compatibility.patch b/debian/patches/django4-compatibility.patch
67new file mode 100644
68index 0000000..ea8fb10
69--- /dev/null
70+++ b/debian/patches/django4-compatibility.patch
71@@ -0,0 +1,21 @@
72+Description: Fix depricated field to build django-assets against Django 4.2
73+ In Django 4 the requires_system_checks variable must now be a list or tuple,
74+ as support for boolean values was removed. This patch replaces the False value
75+ with an equivalent empty array. See https://code.djangoproject.com/ticket/33896
76+Author: Madison Swain-Bowden <bowdenm@spu.edu>
77+Origin: other, https://github.com/miracle2k/django-assets/pull/103/commits/bc85445e31acbdbf86deff62255175da72a8ea13
78+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/django-assets/+bug/2022089
79+Last-Update: 2023-07-31
80+---
81+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
82+--- a/django_assets/management/commands/assets.py
83++++ b/django_assets/management/commands/assets.py
84+@@ -37,7 +37,7 @@
85+
86+ class Command(BaseCommand):
87+ help = 'Manage assets.'
88+- requires_system_checks = False
89++ requires_system_checks = []
90+
91+ def add_arguments(self, parser):
92+ # parser.add_argument('poll_id', nargs='+', type=str)
93diff --git a/debian/patches/fix-node-iteration.patch b/debian/patches/fix-node-iteration.patch
94new file mode 100644
95index 0000000..01531b5
96--- /dev/null
97+++ b/debian/patches/fix-node-iteration.patch
98@@ -0,0 +1,22 @@
99+Description: Fix Node iteration error due to unsupported __iter__ function
100+ When iterating over Template and Node objects directly, nodes may fail with an
101+ exception such as: TypeError: 'TextNode' object is not iterable
102+ This is due to iterating over nodes being unsupported in Django, as noted in
103+ https://code.djangoproject.com/ticket/7430
104+ To avoid this error, explicitly iterate over the nodelist attribute, rather
105+ than relying on __iter__.
106+Author: Lena Voytek <lena.voytek@canonical.com>
107+Origin: backport, https://github.com/miracle2k/django-assets/pull/105/commits/af2440a107df0eac310cf3585b9f267ebe59f3dc
108+Last-Update: 2023-08-22
109+---
110+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
111+--- a/django_assets/loaders.py
112++++ b/django_assets/loaders.py
113+@@ -107,6 +107,6 @@
114+ and node.nodelist\
115+ or []:
116+ _recurse_node(subnode)
117+- for node in t: # don't move into _recurse_node, ``Template`` has a .nodelist attribute
118++ for node in t.nodelist: # don't move into _recurse_node, ``Template`` has a .nodelist attribute
119+ _recurse_node(node)
120+ return result
121diff --git a/debian/patches/series b/debian/patches/series
122index e2d6a99..73abe40 100644
123--- a/debian/patches/series
124+++ b/debian/patches/series
125@@ -1,4 +1,5 @@
126-01-webassets_version.patch
127 02-intersphinx.patch
128 0003-Patch-pytest-plugin-to-check-whether-we-are-running-.patch
129 0001-Global-regex-flags-must-be-at-the-start-of-regex-in-.patch
130+django4-compatibility.patch
131+fix-node-iteration.patch

Subscribers

People subscribed via source and target branches

to all changes: