git: 164c5e98aa9b - main - www/py-django-assets: Add compatibility for Django 4.x

From: Kai Knoblich <kai_at_FreeBSD.org>
Date: Sun, 24 Mar 2024 17:59:54 UTC
The branch main has been updated by kai:

URL: https://cgit.FreeBSD.org/ports/commit/?id=164c5e98aa9b406b2297ddcd76d5c0004e9b0dd0

commit 164c5e98aa9b406b2297ddcd76d5c0004e9b0dd0
Author:     Kai Knoblich <kai@FreeBSD.org>
AuthorDate: 2024-03-24 17:54:42 +0000
Commit:     Kai Knoblich <kai@FreeBSD.org>
CommitDate: 2024-03-24 17:54:42 +0000

    www/py-django-assets: Add compatibility for Django 4.x
    
    * Add an upstream patch that adds compatibility for Python 3.11 as well
      while I'm here.
    
    PR:             276319
---
 www/py-django-assets/Makefile                        |  5 +++--
 .../files/patch-django__assets_glob.py               | 20 ++++++++++++++++++++
 ...atch-django__assets_management_commands_assets.py | 19 +++++++++++++++++++
 3 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/www/py-django-assets/Makefile b/www/py-django-assets/Makefile
index eaf5dbb328f5..e4d97b91c5c4 100644
--- a/www/py-django-assets/Makefile
+++ b/www/py-django-assets/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	django-assets
 PORTVERSION=	2.0
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	www python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -14,7 +14,8 @@ LICENSE=	BSD2CLAUSE
 RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}django32>=1.7:www/py-django32@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}webassets>=2.0:www/py-webassets@${PY_FLAVOR}
 
-USES=		python
+USES=		dos2unix python
+DOS2UNIX_FILES= django_assets/management/commands/assets.py
 USE_PYTHON=	autoplist distutils
 
 NO_ARCH=	yes
diff --git a/www/py-django-assets/files/patch-django__assets_glob.py b/www/py-django-assets/files/patch-django__assets_glob.py
new file mode 100644
index 000000000000..477b48ae19fb
--- /dev/null
+++ b/www/py-django-assets/files/patch-django__assets_glob.py
@@ -0,0 +1,20 @@
+From: Jonatan Heyman <jonatan@heyman.info>
+Date: Thu, 10 Nov 2022 23:26:07 +0100
+Subject: [PATCH] Global regex flags must be at the start of regex in Python
+ 3.11
+
+Obtained from:
+
+https://patch-diff.githubusercontent.com/raw/miracle2k/django-assets/pull/104.patch
+
+--- django_assets/glob.py.orig	2018-02-23 09:54:00 UTC
++++ django_assets/glob.py
+@@ -121,7 +121,7 @@ def translate(pat):
+                 res = '%s([%s])' % (res, stuff)
+         else:
+             res = res + re.escape(c)
+-    return res + '\Z(?ms)'
++    return '(?ms)' + res + '\Z'
+ 
+ 
+ """Filename globbing utility."""
diff --git a/www/py-django-assets/files/patch-django__assets_management_commands_assets.py b/www/py-django-assets/files/patch-django__assets_management_commands_assets.py
new file mode 100644
index 000000000000..bb4840e09621
--- /dev/null
+++ b/www/py-django-assets/files/patch-django__assets_management_commands_assets.py
@@ -0,0 +1,19 @@
+From: Madison Swain-Bowden <bowdenm@spu.edu>
+Date: Sat, 5 Nov 2022 14:08:05 -0700
+Subject: [PATCH] Fix issue with running  in Django 4.1
+
+Obtained from:
+
+https://patch-diff.githubusercontent.com/raw/miracle2k/django-assets/pull/103.patch
+
+--- django_assets/management/commands/assets.py.orig	2024-03-24 15:11:16 UTC
++++ django_assets/management/commands/assets.py
+@@ -37,7 +37,7 @@ class Command(BaseCommand):
+ 
+ class Command(BaseCommand):
+     help = 'Manage assets.'
+-    requires_system_checks = False
++    requires_system_checks = []
+ 
+     def add_arguments(self, parser):
+         # parser.add_argument('poll_id', nargs='+', type=str)