Bug 15865 - gi-docgen doesn't work since python3-markdown 3.8
Summary: gi-docgen doesn't work since python3-markdown 3.8
Status: RESOLVED WORKSFORME
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 5.3
Hardware: x86 Multiple
: Undecided normal
Target Milestone: 0.0.0
Assignee: Unassigned
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2025-05-16 14:50 UTC by Ross Burton
Modified: 2025-05-22 14:35 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Burton 2025-05-16 14:50:17 UTC
If I build glib-2.0 with api-documentation enabled after the python3-markdown 3.8 upgrade, it breaks:

| FAILED: docs/reference/glib/glib-2.0
| /work/ross/build/tmp/work/core2-32-poky-linux/glib-2.0/2.84.1/recipe-sysroot-native/usr/bin/gi-docgen generate --quiet --no-namespace-dir --fatal-warnings --add-include-path=/work/ross/build/tmp/work/core2-32-poky-linux/glib-2.0/2.84.1/build/docs/reference/../../girepository/introspection --config=docs/reference/glib/glib.toml --output-dir=docs/reference/glib/glib-2.0 --content-dir=/work/ross/build/tmp/work/core2-32-poky-linux/glib-2.0/2.84.1/glib-2.84.1/docs/reference/glib girepository/introspection/GLib-2.0.gir
| Traceback (most recent call last):
|   File "/work/ross/build/tmp/work/core2-32-poky-linux/glib-2.0/2.84.1/recipe-sysroot-native/usr/lib/python3.13/site-packages/gidocgen/gidocmain.py", line 78, in run
|     res = options.run_func(options)
|   File "/work/ross/build/tmp/work/core2-32-poky-linux/glib-2.0/2.84.1/recipe-sysroot-native/usr/lib/python3.13/site-packages/gidocgen/gdgenerate.py", line 3326, in run
|     gen_reference(conf, options, parser.get_repository(), templates_dir, theme_conf, content_dirs, output_dir)
|     ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|   File "/work/ross/build/tmp/work/core2-32-poky-linux/glib-2.0/2.84.1/recipe-sysroot-native/usr/lib/python3.13/site-packages/gidocgen/gdgenerate.py", line 3167, in gen_reference
|     content_files = gen_content_files(config, theme_config, content_dirs, ns_dir, jinja_env, namespace)
|   File "/work/ross/build/tmp/work/core2-32-poky-linux/glib-2.0/2.84.1/recipe-sysroot-native/usr/lib/python3.13/site-packages/gidocgen/gdgenerate.py", line 2793, in gen_content_files
|     md = markdown.Markdown(extensions=utils.MD_EXTENSIONS, extension_configs=utils.MD_EXTENSIONS_CONF)
|   File "/work/ross/build/tmp/work/core2-32-poky-linux/glib-2.0/2.84.1/recipe-sysroot-native/usr/lib/python3.13/site-packages/markdown/core.py", line 126, in __init__
|     self.registerExtensions(extensions=kwargs.get('extensions', []),
|     ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|                             configs=kwargs.get('extension_configs', {}))
|                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|   File "/work/ross/build/tmp/work/core2-32-poky-linux/glib-2.0/2.84.1/recipe-sysroot-native/usr/lib/python3.13/site-packages/markdown/core.py", line 179, in registerExtensions
|     ext = self.build_extension(ext, configs.get(ext, {}))
|   File "/work/ross/build/tmp/work/core2-32-poky-linux/glib-2.0/2.84.1/recipe-sysroot-native/usr/lib/python3.13/site-packages/markdown/core.py", line 225, in build_extension
|     module = importlib.import_module(ext_name)
|   File "/work/ross/build/tmp/work/core2-32-poky-linux/glib-2.0/2.84.1/recipe-sysroot-native/usr/lib/python3.13/importlib/__init__.py", line 88, in import_module
|     return _bootstrap._gcd_import(name[level:], package, level)
|            ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
|   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
|   File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
| ModuleNotFoundError: No module named 'codehilite'

Amusingly, if I build the git commit before the version being changed from 3.7 to 3.8, it works. This suggests it's not actually a code problem, which makes it even more interesting/mysterious/annoying.
Comment 1 Ross Burton 2025-05-20 12:48:31 UTC
I think this is due to old markdown directories in the build tree as it only appears if you upgrade without wiping tmpdir.
Comment 2 Randy MacLeod 2025-05-22 14:35:00 UTC
May have to clean glibc-2.0 recipe.