Bug 263922

Summary: www/py-lektor: lektor server fails on flask (safe_join)
Product: Ports & Packages Reporter: Bjoern A. Zeeb <bz>
Component: Individual Port(s)Assignee: Vinícius Zavam <egypcio>
Status: Closed FIXED    
Severity: Affects Only Me CC: bz, contact, darwick
Priority: --- Flags: egypcio: maintainer-feedback+
Version: Latest   
Hardware: amd64   
OS: Any   
Bug Depends on:    
Bug Blocks: 264991    
Attachments:
Description Flags
www/lektor: Update to 3.3.4 contact: maintainer-approval?

Description Bjoern A. Zeeb freebsd_committer freebsd_triage 2022-05-11 14:39:40 UTC
% lektor server
Traceback (most recent call last):
  File "/usr/local/bin/lektor", line 33, in <module>
    sys.exit(load_entry_point('Lektor==3.2.2', 'console_scripts', 'lektor')())
  File "/usr/local/lib/python3.8/site-packages/lektor/cli.py", line 766, in main
    cli.main(args=args, prog_name=name)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/lektor/cli.py", line 471, in server_cmd
    from lektor.devserver import run_server
  File "/usr/local/lib/python3.8/site-packages/lektor/devserver.py", line 9, in <module>
    from lektor.admin import WebAdmin
  File "/usr/local/lib/python3.8/site-packages/lektor/admin/__init__.py", line 1, in <module>
    from .webui import WebAdmin
  File "/usr/local/lib/python3.8/site-packages/lektor/admin/webui.py", line 7, in <module>
    from flask.helpers import safe_join
ImportError: cannot import name 'safe_join' from 'flask.helpers' (/usr/local/lib/python3.8/site-packages/flask/helpers.py)
Comment 1 Evilham 2022-06-07 10:38:16 UTC
Created attachment 234518 [details]
www/lektor: Update to 3.3.4

Can confirm the bug, it is dealt with in the latest version of Lektor, this patch updates the port to it: 3.3.4 as of this comment.

Amongst many bugfixes like this one and improvements.

See all changes since 3.2.2:
https://github.com/lektor/lektor/blob/master/CHANGES.md#332-2022-03-01

I add a dummy setup.py since currently the python build infra seems to depend on it; if there is a better way I'd be happy to adapt it, but the current documentation doesn't point at it :-(
Comment 2 Evilham 2022-06-07 10:40:21 UTC
Also, instead of blocking this by the requirement of devel/py-inifile>=0.4.1, we patch that in setup.cfg (else running fails since it cannot be resolved).

That version ought to land on the ports tree at some point but is not functionally important for lektor:
https://github.com/mitsuhiko/python-inifile/compare/0.4...0.4.1
Comment 3 Bjoern A. Zeeb freebsd_committer freebsd_triage 2022-06-15 21:27:47 UTC
Thanks a lot for the update.  Will this be committed?
Comment 4 Mr. Zsolt 2022-07-22 18:23:27 UTC
Dear Maintainer, Thanks for the patch info, used the patch I successfully patched and upgraded lektor and the server now starts. But please note that this is only done when databases/py-sqlite3 port is installed, else the lektor server will not start because of the missing module. You should also add it to the dependencies.
Comment 5 commit-hook freebsd_committer freebsd_triage 2022-07-28 19:58:23 UTC
A commit in branch main references this bug:

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

commit 6f42cda176b25bb14eb4c60b1f243fa932c82c7b
Author:     Vinícius Zavam <egypcio@FreeBSD.org>
AuthorDate: 2022-07-28 19:51:25 +0000
Commit:     Vinícius Zavam <egypcio@FreeBSD.org>
CommitDate: 2022-07-28 19:58:09 +0000

    www/py-lektor: update 3.2.2_3 to 3.3.6, and fix 'safe_join' import

      * https://github.com/lektor/lektor/blob/v3.3.6/CHANGES.md

    PR:             263922, 264991
    Reported by:    bz@, p5B2EA84B3 <p5B2EA84B3 % t-online.de>
    Tested by:      Evilham <contact % evilham.com>, Mr. Zsolt <darwick % cyberground.hu>

 www/py-lektor/Makefile | 7 ++++---
 www/py-lektor/distinfo | 6 +++---
 2 files changed, 7 insertions(+), 6 deletions(-)
Comment 6 Vinícius Zavam freebsd_committer freebsd_triage 2022-07-28 20:01:08 UTC
# lektor server
 * Project path: /tmp/tmp.9vvYYKRe/pn/pn.lektorproject
 * Output path: /root/.cache/lektor/builds/d4c371ee228b57890a9d5ad39ced93da
Started source info update
/usr/local/lib/python3.9/site-packages/werkzeug/serving.py:716: ResourceWarning: unclosed <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('0.0.0.0', 0)>
  self.socket = socket.fromfd(fd, address_family, socket.SOCK_STREAM)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
 * Running on http://127.0.0.1:5000 (Press CTRL+C to quit)
Finished source info update in 0.05 sec
Started build
U index.html
U projects/index.html
U about/index.html
U blog/index.html
U static/style.css
U blog/first-post/index.html
Finished build in 0.15 sec
Started prune
Finished prune in 0.00 sec