Jeremie Courreges-Anglas <[email protected]> writes:

> On Sun, May 10 2020, [email protected] (Grégoire Jadi) wrote:
>
>> Hi,
>>
>> An upgrade to py-CherryPy broke the webserver feature of
>> games/mnemosyne.
>>
>> Mnemosyne used the wsgiserver from py-CherryPy which was moved to
>> py-cheroot. As far as I could tell, that was the only use of py-CherryPy
>> in Mnemosyne codebase.
>>
>> The attached patch replace the depency from py-CherryPy to py-cheroot
>> and update the two uses accordingly.
>>
>> I was able to use the webserver and sync features with my own database.
>
> Changes make sense to me.  I'll commit it post-unlock unless another
> committer with interest in mnemosyne wants to take care of this.

Thanks.

>> NB: I tried to upgrade mnemosyne to the latest version but it uses
>> QtWebEngine from qt5 which isn't provided. education/anki, suffers from
>> the same issue. :(
>
> I think rsadowski@ is working on a qtwebengine port.

Ok, cool.

> Updated diff which:
> - explains why this can't be updated to a newer version for now
> (qtwebengine)
> - adds a comment and a link to upstream bug report to the patches
> - moves HOMEPAGE to https
>
> Thanks! :)
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/games/mnemosyne/Makefile,v
> retrieving revision 1.39
> diff -u -p -r1.39 Makefile
> --- Makefile  12 Jul 2019 20:46:21 -0000      1.39
> +++ Makefile  13 May 2020 00:12:49 -0000
> @@ -2,13 +2,14 @@
>
>  COMMENT=     flash-card tool which optimises your learning process
>
> +# Newer versions moved to Qt5 and need qtwebengine
>  MODPY_EGG_VERSION = 2.3.6
>  DISTNAME=    Mnemosyne-${MODPY_EGG_VERSION}
>  PKGNAME=     ${DISTNAME:L}
>  CATEGORIES=  games education
> -REVISION=    2
> +REVISION=    3
>
> -HOMEPAGE=    http://www.mnemosyne-proj.org/
> +HOMEPAGE=    https://www.mnemosyne-proj.org/
>
>  # GPLv2
>  PERMIT_PACKAGE=      Yes
> @@ -23,7 +24,7 @@ RUN_DEPENDS=        x11/py-qt4 \
>               textproc/py-xml \
>               graphics/py-Pillow \
>               graphics/py-matplotlib \
> -             www/py-CherryPy \
> +             www/py-cheroot \
>               www/py-webob>=1.3.1 \
>               devel/desktop-file-utils
>
> Index: patches/patch-mnemosyne_web_server_web_server_py
> ===================================================================
> RCS file: patches/patch-mnemosyne_web_server_web_server_py
> diff -N patches/patch-mnemosyne_web_server_web_server_py
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-mnemosyne_web_server_web_server_py  13 May 2020 00:12:49 
> -0000
> @@ -0,0 +1,26 @@
> +$OpenBSD$
> +
> +The cherrypy project moved their WSGI server to py-cheroot.
> +https://bugs.launchpad.net/mnemosyne-proj/+bug/1659314
> +
> +Index: mnemosyne/web_server/web_server.py
> +--- mnemosyne/web_server/web_server.py.orig
> ++++ mnemosyne/web_server/web_server.py
> +@@ -13,7 +13,7 @@ import threading
> + from webob import Request
> + from webob.static import FileApp
> + 
> +-from cherrypy import wsgiserver
> ++from cheroot import wsgi
> + 
> + from mnemosyne.libmnemosyne import Mnemosyne
> + from mnemosyne.libmnemosyne.utils import localhost_IP
> +@@ -69,7 +69,7 @@ class WebServer(Component):
> +         self.is_just_started = True
> +         self.is_mnemosyne_loaded = False
> +         self.is_shutting_down = False
> +-        self.wsgi_server = wsgiserver.CherryPyWSGIServer(\
> ++        self.wsgi_server = wsgi.Server(\
> +             ("0.0.0.0", port), self.wsgi_app, server_name="localhost",
> +             numthreads=1, timeout=5)
> +         # We need to set the timeout relatively low, otherwise it will take
> Index: patches/patch-openSM2sync_server_py
> ===================================================================
> RCS file: patches/patch-openSM2sync_server_py
> diff -N patches/patch-openSM2sync_server_py
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-openSM2sync_server_py       13 May 2020 00:12:49 -0000
> @@ -0,0 +1,19 @@
> +$OpenBSD$
> +
> +The cherrypy project moved their WSGI server to py-cheroot.
> +https://bugs.launchpad.net/mnemosyne-proj/+bug/1659314
> +
> +Index: openSM2sync/server.py
> +--- openSM2sync/server.py.orig
> ++++ openSM2sync/server.py
> +@@ -105,8 +105,8 @@ class Server(Partner):
> +         self.machine_id = machine_id
> +         # We only use 1 thread, such that subsequent requests don't run into
> +         # SQLite access problems.
> +-        from cherrypy import wsgiserver
> +-        self.wsgi_server = wsgiserver.CherryPyWSGIServer\
> ++        from cheroot import wsgi
> ++        self.wsgi_server = wsgi.Server\
> +             (("0.0.0.0", port), self.wsgi_app, server_name="localhost",
> +             numthreads=1, timeout=1000)
> +         Partner.__init__(self, ui)
> Index: patches/patch-setup_py
> ===================================================================
> RCS file: /cvs/ports/games/mnemosyne/patches/patch-setup_py,v
> retrieving revision 1.5
> diff -u -p -r1.5 patch-setup_py
> --- patches/patch-setup_py    9 Jul 2014 13:36:24 -0000       1.5
> +++ patches/patch-setup_py    13 May 2020 00:12:49 -0000
> @@ -1,6 +1,12 @@
>  $OpenBSD: patch-setup_py,v 1.5 2014/07/09 13:36:24 bcallah Exp $
> ---- setup.py.orig    Mon Jul  7 18:57:46 2014
> -+++ setup.py Mon Jul  7 18:58:02 2014
> +
> +Second hunk:
> +The cherrypy project moved their WSGI server to py-cheroot.
> +https://bugs.launchpad.net/mnemosyne-proj/+bug/1659314
> +
> +Index: setup.py
> +--- setup.py.orig
> ++++ setup.py
>  @@ -125,8 +125,7 @@ elif sys.platform == "darwin": # For py2app.
>   else:
>       base_path = os.path.join(sys.exec_prefix, "lib", "python" + 
> sys.version[:3],
> @@ -11,3 +17,12 @@ $OpenBSD: patch-setup_py,v 1.5 2014/07/0
>   # Translations.
>   if sys.platform == "win32":
>       for mo in [x for x in glob.glob(os.path.join("mo", "*")) \
> +@@ -155,7 +154,7 @@ setup_requires = []
> + 
> + py2app_options = {
> + "argv_emulation": True,
> +-"includes": "sip,numpy,cherrypy,cPickle,md5,logging,shutil,xml.sax",
> ++"includes": "sip,numpy,cheroot,cPickle,md5,logging,shutil,xml.sax",
> + "iconfile": "pixmaps/mnemosyne.icns",
> + "qt_plugins": ["sqldrivers", "imageformats"],
> + "packages": "mnemosyne, mnemosyne.pyqt_ui, mnemosyne.libmnemosyne, \

Reply via email to