git: ffaa8cd925c2 - main - www/seahub: Patch for new version of Pillow

From: Richard Gallamore <ultima_at_FreeBSD.org>
Date: Sat, 26 Aug 2023 17:32:07 UTC
The branch main has been updated by ultima:

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

commit ffaa8cd925c26ff03e8d7e358b9fa54e774a9db5
Author:     Richard Gallamore <ultima@FreeBSD.org>
AuthorDate: 2023-08-26 17:24:40 +0000
Commit:     Richard Gallamore <ultima@FreeBSD.org>
CommitDate: 2023-08-26 17:24:40 +0000

    www/seahub: Patch for new version of Pillow
    
    PR: 272942
    Reported by: Scott Kitchin (scott@kitchin.com), Boris Tassou (boris.tassou@securmail.fr)
    Submitted by: sunpoet
    Obtained from: Seafile
---
 www/seahub/Makefile           |  3 ++-
 www/seahub/files/patch-pillow | 50 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/www/seahub/Makefile b/www/seahub/Makefile
index d4faf16db76a..2ad0d93ce723 100644
--- a/www/seahub/Makefile
+++ b/www/seahub/Makefile
@@ -2,6 +2,7 @@ PORTNAME=	seahub
 DISTVERSIONPREFIX=	v
 DISTVERSION=	${SEAHUB_VER}
 DISTVERSIONSUFFIX=	-server
+PORTREVISION=	1
 CATEGORIES=	www
 
 MAINTAINER=	ultima@FreeBSD.org
@@ -29,7 +30,7 @@ RUN_DEPENDS=	bash:shells/bash \
 		${PYTHON_PKGNAMEPREFIX}djangorestframework>=0:www/py-djangorestframework@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}dateutil>=0:devel/py-dateutil@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}requests>=0:www/py-requests@${PY_FLAVOR} \
-		${PY_PILLOW} \
+		${PYTHON_PKGNAMEPREFIX}pillow>=0:graphics/py-pillow@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pyjwt>=0:www/py-pyjwt@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pycryptodome>=3.12.0:security/py-pycryptodome@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}requests-oauthlib>=0:www/py-requests-oauthlib@${PY_FLAVOR} \
diff --git a/www/seahub/files/patch-pillow b/www/seahub/files/patch-pillow
new file mode 100644
index 000000000000..b4fae5571f32
--- /dev/null
+++ b/www/seahub/files/patch-pillow
@@ -0,0 +1,50 @@
+Obtained from:	https://github.com/haiwen/seahub/commit/cbe0817f2bee0c2b00d3ffd3e047c3141862c6c5
+
+--- seahub/avatar/settings.py.orig	2022-11-30 03:34:16 UTC
++++ seahub/avatar/settings.py
+@@ -22,7 +22,7 @@ AUTO_GENERATE_GROUP_AVATAR_SIZES = getattr(settings, '
+
+ ### Common settings ###
+ AVATAR_FILE_STORAGE = getattr(settings, 'AVATAR_FILE_STORAGE', '')
+-AVATAR_RESIZE_METHOD = getattr(settings, 'AVATAR_RESIZE_METHOD', Image.ANTIALIAS)
++AVATAR_RESIZE_METHOD = getattr(settings, 'AVATAR_RESIZE_METHOD', Image.Resampling.LANCZOS)
+ AVATAR_GRAVATAR_BACKUP = getattr(settings, 'AVATAR_GRAVATAR_BACKUP', True)
+ AVATAR_GRAVATAR_DEFAULT = getattr(settings, 'AVATAR_GRAVATAR_DEFAULT', None)
+ AVATAR_MAX_AVATARS_PER_USER = getattr(settings, 'AVATAR_MAX_AVATARS_PER_USER', 42)
+--- seahub/thumbnail/utils.py.orig	2022-11-30 03:34:16 UTC
++++ seahub/thumbnail/utils.py
+@@ -54,22 +54,22 @@ def get_rotated_image(image):
+
+     if orientation == 2:
+         # Vertical image
+-        image = image.transpose(Image.FLIP_LEFT_RIGHT)
++        image = image.transpose(Image.Transpose.FLIP_LEFT_RIGHT)
+     elif orientation == 3:
+         # Rotation 180
+         image = image.rotate(180)
+     elif orientation == 4:
+-        image = image.rotate(180).transpose(Image.FLIP_LEFT_RIGHT)
++        image = image.rotate(180).transpose(Image.Transpose.FLIP_LEFT_RIGHT)
+         # Horizontal image
+     elif orientation == 5:
+         # Horizontal image + Rotation 90 CCW
+-        image = image.rotate(-90, expand=True).transpose(Image.FLIP_LEFT_RIGHT)
++        image = image.rotate(-90, expand=True).transpose(Image.Transpose.FLIP_LEFT_RIGHT)
+     elif orientation == 6:
+         # Rotation 270
+         image = image.rotate(-90, expand=True)
+     elif orientation == 7:
+         # Horizontal image + Rotation 270
+-        image = image.rotate(90, expand=True).transpose(Image.FLIP_LEFT_RIGHT)
++        image = image.rotate(90, expand=True).transpose(Image.Transpose.FLIP_LEFT_RIGHT)
+     elif orientation == 8:
+         # Rotation 90
+         image = image.rotate(90, expand=True)
+@@ -230,7 +230,7 @@ def _create_thumbnail_common(fp, thumbnail_file, size)
+         image = image.convert("RGB")
+
+     image = get_rotated_image(image)
+-    image.thumbnail((size, size), Image.ANTIALIAS)
++    image.thumbnail((size, size), Image.Resampling.LANCZOS)
+     image.save(thumbnail_file, THUMBNAIL_EXTENSION)
+     return (True, 200)