guix_mirror_bot pushed a commit to branch master
in repository guix.
commit e0a350ba279e9a8a6f1f419eac81c2e662d53499
Author: Charles Roelli <[email protected]>
AuthorDate: Wed Oct 1 14:50:32 2025 +0200
gnu: python-django-compressor: Patch for Django 5.2 compatibility.
*
gnu/packages/patches/django-compressor-build-with-beautifulsoup-4.14+.patch:
New patch.
* gnu/packages/django.scm (python-django-compressor)[source]: Patch
with https://github.com/django-compressor/django-compressor/pull/1296,
minus conflicting changes to requirements/tests.txt.
Change-Id: Ic22268f6870b30c3ace689a4cadb63a77f69ca9e
Signed-off-by: Sharlatan Hellseher <[email protected]>
---
gnu/packages/django.scm | 4 ++-
...compressor-build-with-beautifulsoup-4.14+.patch | 40 ++++++++++++++++++++++
2 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/django.scm b/gnu/packages/django.scm
index ac90c442e9..a16346a8f8 100644
--- a/gnu/packages/django.scm
+++ b/gnu/packages/django.scm
@@ -1748,7 +1748,9 @@ forms using your favorite CSS framework, without writing
template code.")
(method url-fetch)
(uri (pypi-uri "django_compressor" version))
(sha256
- (base32 "08m8cs1mnpwd2zlck8cbl4cdp21dgv4vj7j17krbgn745s5a9n61"))))
+ (base32 "08m8cs1mnpwd2zlck8cbl4cdp21dgv4vj7j17krbgn745s5a9n61"))
+ (patches
+ (search-patches
"django-compressor-build-with-beautifulsoup-4.14+.patch"))))
(build-system pyproject-build-system)
(arguments
(list
diff --git
a/gnu/packages/patches/django-compressor-build-with-beautifulsoup-4.14+.patch
b/gnu/packages/patches/django-compressor-build-with-beautifulsoup-4.14+.patch
new file mode 100644
index 0000000000..b63251779f
--- /dev/null
+++
b/gnu/packages/patches/django-compressor-build-with-beautifulsoup-4.14+.patch
@@ -0,0 +1,40 @@
+From 53f50bc0cee1cdfaf023ba65e1524b820cb7c18e Mon Sep 17 00:00:00 2001
+From: Matthias Kestenholz <[email protected]>
+Date: Thu, 22 May 2025 10:37:20 +0200
+Subject: [PATCH 1/2] Disable bs4's multi valued attributes
+
+---
+ compressor/parser/beautifulsoup.py | 12 ++++--------
+ 1 file changed, 4 insertions(+), 8 deletions(-)
+
+diff --git a/compressor/parser/beautifulsoup.py
b/compressor/parser/beautifulsoup.py
+index 91897485..f673410e 100644
+--- a/compressor/parser/beautifulsoup.py
++++ b/compressor/parser/beautifulsoup.py
+@@ -10,7 +10,9 @@ def __init__(self, content):
+ try:
+ from bs4 import BeautifulSoup
+
+- self.soup = BeautifulSoup(self.content, "html.parser")
++ # Disable multi_valued_attributes
++ #
http://www.crummy.com/software/BeautifulSoup/bs4/doc/#multi-valued-attributes
++ self.soup = BeautifulSoup(self.content, "html.parser",
multi_valued_attributes={})
+ except ImportError as err:
+ raise ImproperlyConfigured("Error while importing BeautifulSoup:
%s" % err)
+
+@@ -21,13 +23,7 @@ def js_elems(self):
+ return self.soup.find_all("script")
+
+ def elem_attribs(self, elem):
+- attrs = dict(elem.attrs)
+- # hack around changed behaviour in bs4, it returns lists now instead
of one string, see
+- #
http://www.crummy.com/software/BeautifulSoup/bs4/doc/#multi-valued-attributes
+- for key, value in attrs.items():
+- if type(value) is list:
+- attrs[key] = " ".join(value)
+- return attrs
++ return elem.attrs
+
+ def elem_content(self, elem):
+ return elem.string
+