On Mon Oct 11, 2021 at 01:57:27PM +0200, Rob Schmersel wrote:
> Hi,
> 
> My first attempt to update a port (thanks @sthen for the guidance).
> Updated deluge to include the following fixes to get it starting up without 
> errors in python >= 3.8
> 
> [Logging] Fix Python 3.8 compatibility: 
> https://git.deluge-torrent.org/deluge/commit/?h=develop&id=351664ec071daa04161577c6a1c949ed0f2c3206
> 
> [Logging] Fix findCaller with unknown source: 
> https://git.deluge-torrent.org/deluge/commit/?h=develop&id=5e06aee5c8846f94bd5fcc209132dacf06de781f
> 
> Fix warning related to gettext: 
> https://git.deluge-torrent.org/deluge/commit/?h=develop&id=d6c96d629183e8bab2167ef56457f994017e7c85
> 
> 
> BR/Rob

This fix my issue, thanks

$ deluge
Unable to initialize gettext/locale!
'ngettext'
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/deluge/i18n/util.py",
  line 11
      builtins.__dict__['_n'] = builtins.__dict__['ngettext']

OK rsadowski@
> 
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/net/deluge/Makefile,v
> retrieving revision 1.12
> diff -u -p -u -p -r1.12 Makefile
> --- Makefile  23 Feb 2021 19:39:31 -0000      1.12
> +++ Makefile  11 Oct 2021 10:17:18 -0000
> @@ -4,7 +4,7 @@ COMMENT =     bittorrent client
>  
>  DISTNAME =           deluge-${MODPY_EGG_VERSION}
>  MODPY_EGG_VERSION =  2.0.3
> -REVISION =           2
> +REVISION =           3
>  
>  CATEGORIES = net
>  
> cvs server: Diffing pkg
> Index: patches/patch-deluge_i18n_util_py
> ===================================================================
> RCS file: patches/patch-deluge_i18n_util_py
> diff -N patches/patch-deluge_i18n_util_py
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-deluge_i18n_util_py 11 Oct 2021 10:17:18 -0000
> @@ -0,0 +1,14 @@
> +$OpenBSD$
> +
> +Index: deluge/i18n/util.py
> +--- deluge/i18n/util.py.orig
> ++++ deluge/i18n/util.py
> +@@ -114,7 +114,7 @@ def setup_translation():
> +         # Workaround for Python 2 unicode gettext (keyword removed in Py3).
> +         kwargs = {} if not deluge.common.PY2 else {'unicode': True}
> + 
> +-        gettext.install(I18N_DOMAIN, translations_path, names='ngettext', 
> **kwargs)
> ++        gettext.install(I18N_DOMAIN, translations_path, names=['ngettext'], 
> **kwargs)
> +         builtins.__dict__['_n'] = builtins.__dict__['ngettext']
> + 
> +         libintl = None
> Index: patches/patch-deluge_log_py
> ===================================================================
> RCS file: patches/patch-deluge_log_py
> diff -N patches/patch-deluge_log_py
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-deluge_log_py       11 Oct 2021 10:17:18 -0000
> @@ -0,0 +1,35 @@
> +$OpenBSD$
> +
> +Index: deluge/log.py
> +--- deluge/log.py.orig
> ++++ deluge/log.py
> +@@ -86,9 +86,9 @@ class Logging(LoggingLoggerClass):
> +     def exception(self, msg, *args, **kwargs):
> +         yield LoggingLoggerClass.exception(self, msg, *args, **kwargs)
> + 
> +-    def findCaller(self, stack_info=False):  # NOQA: N802
> ++    def findCaller(self, *args, **kwargs):  # NOQA: N802
> +         f = logging.currentframe().f_back
> +-        rv = '(unknown file)', 0, '(unknown function)'
> ++        rv = ('(unknown file)', 0, '(unknown function)', None)
> +         while hasattr(f, 'f_code'):
> +             co = f.f_code
> +             filename = os.path.normcase(co.co_filename)
> +@@ -98,12 +98,12 @@ class Logging(LoggingLoggerClass):
> +             ):
> +                 f = f.f_back
> +                 continue
> +-            if common.PY2:
> +-                rv = (filename, f.f_lineno, co.co_name)
> +-            else:
> +-                rv = (filename, f.f_lineno, co.co_name, None)
> ++            rv = (filename, f.f_lineno, co.co_name, None)
> +             break
> +-        return rv
> ++        if common.PY2:
> ++            return rv[:-1]
> ++        else:
> ++            return rv
> + 
> + 
> + levels = {


Reply via email to