Bug 267188 - textproc/py-m2r: Fails to build: AttributeError: module 'mistune' has no attribute 'BlockGrammar (textproc/py-mistune0)
Summary: textproc/py-m2r: Fails to build: AttributeError: module 'mistune' has no attr...
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Po-Chuan Hsieh
URL:
Keywords: needs-patch, needs-qa
Depends on: 263956
Blocks:
  Show dependency treegraph
 
Reported: 2022-10-18 22:41 UTC by jo
Modified: 2023-06-30 15:39 UTC (History)
5 users (show)

See Also:
john: maintainer-feedback+


Attachments
textproc/py-mistune{,0}: Register mutual conflict (1.15 KB, patch)
2023-01-03 12:31 UTC, John W. O'Brien
john: maintainer-approval? (sunpoet)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jo 2022-10-18 22:41:02 UTC
While building jupyter-lab, trimmed for brevity:


----->8----------->8----------->8----------->8------

[...]
===>  Installing for py39-docutils-0.17.1,1
===>   Registering installation for py39-docutils-0.17.1,1 as automatic
[...]
===>   Returning to build of py39-m2r-0.2.1_2
===>   py39-m2r-0.2.1_2 depends on package: py39-mistune0>=0 - not found
[...]
===>  Configuring for py39-mistune0-0.8.4
running config
===>  Building for py39-mistune0-0.8.4
running build
running build_py
creating build
creating build/lib
copying mistune.py -> build/lib
===>  Staging for py39-mistune0-0.8.4
===>   py39-mistune0-0.8.4 depends on package: py39-setuptools>=63.1.0 - found
===>   py39-mistune0-0.8.4 depends on file: /usr/local/bin/python3.9 - found
===>   Generating temporary packing list
running install
/usr/local/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running build
running build_py
running install_lib
creating /tmp/usr/ports/textproc/py-mistune0/work-py39/stage/usr/local/lib/python3.9
creating /tmp/usr/ports/textproc/py-mistune0/work-py39/stage/usr/local/lib/python3.9/site-packages
copying build/lib/mistune.py -> /tmp/usr/ports/textproc/py-mistune0/work-py39/stage/usr/local/lib/python3.9/site-packages
byte-compiling /tmp/usr/ports/textproc/py-mistune0/work-py39/stage/usr/local/lib/python3.9/site-packages/mistune.py to mistune.cpython-39.pyc
writing byte-compilation script '/tmp/tmp8ege10me.py'
/usr/local/bin/python3.9 /tmp/tmp8ege10me.py
removing /tmp/tmp8ege10me.py
running install_egg_info
running egg_info
writing mistune.egg-info/PKG-INFO
writing dependency_links to mistune.egg-info/dependency_links.txt
writing top-level names to mistune.egg-info/top_level.txt
listing git files failed - pretending there aren't any
reading manifest file 'mistune.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching 'mistune.c'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyo' found under directory 'tests'
adding license file 'LICENSE'
writing manifest file 'mistune.egg-info/SOURCES.txt'
Copying mistune.egg-info to /tmp/usr/ports/textproc/py-mistune0/work-py39/stage/usr/local/lib/python3.9/site-packages/mistune-0.8.4-py3.9.egg-info
running install_scripts
writing list of installed files to '/tmp/usr/ports/textproc/py-mistune0/work-py39/.PLIST.pymodtmp'
===> Creating unique files: Move MAN files needing SUFFIX
===> Creating unique files: Move files needing SUFFIX
====> Compressing man pages (compress-man)
===>  Installing for py39-mistune0-0.8.4
===>   Registering installation for py39-mistune0-0.8.4 as automatic
[builder] Installing py39-mistune0-0.8.4...
===>   py39-m2r-0.2.1_2 depends on package: py39-mistune0>=0 - found
===>   Returning to build of py39-m2r-0.2.1_2
===>   py39-m2r-0.2.1_2 depends on package: py39-setuptools>=63.1.0 - found
===>   py39-m2r-0.2.1_2 depends on file: /usr/local/bin/python3.9 - found
===>   Generating temporary packing list
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 14, in <module>
    from m2r import parse_from_file
  File "/tmp/usr/ports/textproc/py-m2r/work-py39/m2r-0.2.1/m2r.py", line 59, in <module>
    class RestBlockGrammar(mistune.BlockGrammar):
AttributeError: module 'mistune' has no attribute 'BlockGrammar'
*** Error code 1

Stop.
make[6]: stopped in /usr/ports/textproc/py-m2r
*** Error code 1

Stop.
make[5]: stopped in /usr/ports/devel/py-Automat
*** Error code 1

Stop.
make[4]: stopped in /usr/ports/devel/py-twisted
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/devel/py-twisted
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/net-mgmt/py-prometheus-client
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/devel/py-jupyter-server
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/py-jupyterlab


----->8----------->8----------->8----------->8------


I don't know what this means... Python is not my strong suit.
Also not urgent for me to find a solution... I'm gonna ditch jupyter, it's too much of a pain. But thought it might be worth reporting.
Comment 1 John W. O'Brien 2022-10-20 00:02:13 UTC
Thank you for the report.

A corresponding bug reported upstream [0] blames breaking changes in mistune 2.x for this error. I see that neither textproc/py-mistune0 nor textproc/py-mistune mention the other in CONFLICTS. textproc/py-mistune0 installs as a module in site-packages/mistune.py while textproc/py-mistune installs as a package in site-packages/mistune/. Consequently, pkgng detects no conflict when both are installed. The Python import logic seems to prefer packages over modules. If py39-mistune-2.0.4 is installed on your build system, m2r will use it instead of its stated dependency, py39-mistune0-0.8.4.

In the short-term it will be necessary for sunpoet to update the two mistune ports to conflict with each other. Longer term, m2r would have to add support mistune 2.x. Unfortunately, m2r may now be abandonware. The last release was four years ago, almost to the day (2018-10-11 [1]), and the last commit in the canonical repository was over three years ago (2019-06-04 [2]). Unless something changes upstream, the fate of textproc/py-m2r is inseparable from the fate of textproc/py-mistune0.

[0] https://github.com/miyakogi/m2r/issues/66
[1] https://github.com/miyakogi/m2r/releases/tag/v0.2.1
[2] https://github.com/miyakogi/m2r/commit/66f4a5a500cdd9fc59085106bff082c9cadafaf3
Comment 2 Rainer Hurling freebsd_committer freebsd_triage 2023-01-03 07:53:55 UTC
(In reply to John W. O'Brien from comment #1)

The same error happens with the newest update of textproc/py-m2r to v0.3.1 [1], if textproc/py-mistune0 and textproc/py-mistune are both installed.

[1] https://cgit.freebsd.org/ports/commit/?id=ac0c7ff164c538f9a220dca7bb50e4272d2bca5a
Comment 3 John W. O'Brien 2023-01-03 12:27:36 UTC
(In reply to Rainer Hurling from comment #2)

m2r's author has explicitly limited mistune support to "<2" [0], and indicated that 0.3.1 will be the project's terminal release [1].

[0] https://github.com/miyakogi/m2r/commit/de7be7969ae8baf73c71c8dff5271f5af2b63500
[1] https://github.com/miyakogi/m2r/commit/f23d0031af40f89ce588f2ba1ff14bed2629f8ac
Comment 4 John W. O'Brien 2023-01-03 12:31:19 UTC
Created attachment 239232 [details]
textproc/py-mistune{,0}: Register mutual conflict

Due to the "import" behavior described in comment #1, installing textproc/py-mistune0 and textproc/py-mistune concurrently is always an error because the Python import logic will always use the latter. If textproc/py-mistune0 is desired, it must be the only port installed for the given version of Python. This patch registers the mutual conflict.
Comment 5 John W. O'Brien 2023-06-30 14:02:26 UTC
This bug is now OBE due to the fix for bug #263956.

$ pkg info -x m2r mistune
py310-m2r-0.3.1_1
py311-m2r-0.3.1_1
py38-m2r-0.3.1_1
py39-m2r-0.3.1_1
py310-mistune-3.0.1
py310-mistune0-0.8.4_1
py311-mistune-3.0.1
py311-mistune0-0.8.4_1
py38-mistune-3.0.1
py38-mistune0-0.8.4_1
py39-mistune-3.0.1
py39-mistune0-0.8.4_1
$ for v in 8 9 10 11; do python3.$v -c 'import m2r' && echo py3$v OK; done
py38 OK
py39 OK
py310 OK
py311 OK