git: f8c049d638e6 - main - science/gramps: Optional dependency on py-bsddb3

From: Fernando Apesteguía <fernape_at_FreeBSD.org>
Date: Thu, 23 Jun 2022 15:42:37 UTC
The branch main has been updated by fernape:

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

commit f8c049d638e6a9b00ad054f5afaf9083fa1c6581
Author:     Benjamin Takacs <nimaje+fbz@bureaucracy.de>
AuthorDate: 2022-06-23 06:03:51 +0000
Commit:     Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2022-06-23 15:39:59 +0000

    science/gramps: Optional dependency on py-bsddb3
    
    databases/py-bsddb3 is deprecated. Make science/gramps use py-bsddb3 as an
    option to facilitate the migration and remove the DEPRECATE note since it does
    not apply anymore.
    
    Add UPDATING note with instructions for the migration.
    
    While here pet linters.
    
    PR:     264529
    Reported by:    nimaje+fbz@bureaucracy.de
---
 UPDATING                                             | 10 ++++++++++
 science/gramps/Makefile                              | 14 ++++++--------
 .../files/patch-gramps_gen_utils_grampslocale.py     | 20 ++++++++++++++++++++
 3 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/UPDATING b/UPDATING
index 3684a2974f4b..c876ee6f0527 100644
--- a/UPDATING
+++ b/UPDATING
@@ -5,6 +5,16 @@ they are unavoidable.
 You should get into the habit of checking this file for changes each time
 you update your ports collection, before attempting any port upgrades.
 
+20220623:
+AFFECTS: users of science/gramps
+  AUTHOR: fernape@FreeBSD.org
+
+  databases/py-bsddb3 is deprecated and will be removed in the future. With that
+  gramps will lose the ability to load family trees using Berkeley DB.
+  It is suggested to migrate all family trees using Berkeley DB by exporting
+  them to gramps xml and import that gramps xml into a family tree using sqlite
+  as database.
+
 20220620:
 AFFECTS: users of www/selenium
   AUTHOR: fernape@FreeBSD.org
diff --git a/science/gramps/Makefile b/science/gramps/Makefile
index 80ed881973ec..58bc4677b7e3 100644
--- a/science/gramps/Makefile
+++ b/science/gramps/Makefile
@@ -2,8 +2,8 @@
 
 PORTNAME=	gramps
 PORTVERSION=	5.1.5
-PORTREVISION=	1
 DISTVERSIONPREFIX=	v
+PORTREVISION=	2
 CATEGORIES=	science gnome python
 
 MAINTAINER=	ports@FreeBSD.org
@@ -12,14 +12,10 @@ COMMENT=	GTK3-based genealogy program
 LICENSE=	GPLv2+
 LICENSE_FILE=	${WRKSRC}/COPYING
 
-DEPRECATED=	Requires py-bsddb3 which requires upstream EOLd db5
-EXPIRATION_DATE=	2022-06-30
-
 LIB_DEPENDS=	libgeocode-glib.so:net/geocode-glib \
 		libosmgpsmap-1.0.so:x11-toolkits/osm-gps-map
-RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}bsddb3>0:databases/py-bsddb3@${PY_FLAVOR} \
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pygraphviz>=0:graphics/py-pygraphviz@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pyicu>=1.8:devel/py-pyicu@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}pygraphviz>=0:graphics/py-pygraphviz@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}sqlite3>=0:databases/py-sqlite3@${PY_FLAVOR} \
 		xdg-open:devel/xdg-utils
 
@@ -33,14 +29,16 @@ CONFIGURE_ARGS=	--disable-mime-install
 
 NO_ARCH=	yes
 
-OPTIONS_DEFINE=		GEXIV GTKSPELL PIL RCS TTFFREEFONT
-OPTIONS_DEFAULT=	GEXIV GTKSPELL
+OPTIONS_DEFINE=		BDB GEXIV GTKSPELL PIL RCS TTFFREEFONT
+OPTIONS_DEFAULT=	BDB GEXIV GTKSPELL
+BDB_DESC=		Install py-bsddb3 to support family trees using Berkeley DB (DEPRECATED)
 GEXIV_DESC=		Manage Exif metadata embedded in media
 GTKSPELL_DESC=		Spell checking support via gtkspell
 PIL_DESC=		Crop/convert images with Python Imaging Library (Pillow)
 RCS_DESC=		Manage revisions of family trees with with GNU RCS
 TTFFREEFONT_DESC=	More font support in reports
 
+BDB_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}bsddb3>0:databases/py-bsddb3@${PY_FLAVOR}
 GEXIV_LIB_DEPENDS=	libgexiv2.so:graphics/gexiv2
 GTKSPELL_LIB_DEPENDS=	libgtkspell3-3.so:textproc/gtkspell3
 PIL_RUN_DEPENDS=	${PY_PILLOW}
diff --git a/science/gramps/files/patch-gramps_gen_utils_grampslocale.py b/science/gramps/files/patch-gramps_gen_utils_grampslocale.py
new file mode 100644
index 000000000000..eaad4287fa38
--- /dev/null
+++ b/science/gramps/files/patch-gramps_gen_utils_grampslocale.py
@@ -0,0 +1,20 @@
+--- gramps/gen/utils/grampslocale.py.orig	2022-06-08 13:02:30.116272000 +0200
++++ gramps/gen/utils/grampslocale.py	2022-06-08 12:40:34.253581000 +0200
+@@ -527,9 +527,14 @@
+         # with locale instead of gettext. Win32 doesn't support bindtextdomain.
+         if self.localedir:
+             if not sys.platform == 'win32':
+-                # bug12278, _build_popup_ui() under linux and macOS
+-                locale.textdomain(self.localedomain)
+-                locale.bindtextdomain(self.localedomain, self.localedir)
++                if hasattr(locale, 'textdomain'):
++                    # bug12278, _build_popup_ui() under linux and macOS
++                    locale.textdomain(self.localedomain)
++                    locale.bindtextdomain(self.localedomain, self.localedir)
++                else:
++                    import gettext
++                    gettext.textdomain(self.localedomain)
++                    gettext.bindtextdomain(self.localedomain, self.localedir)
+             else:
+                 self._win_bindtextdomain(self.localedomain.encode('utf-8'),
+                                          self.localedir.encode('utf-8'))