Open mishaturnbull opened 1 year ago
Yup, unfortunately this was an experiment that didn't go quite as planned. I was hoping that the Sphinx extension was essentially standalone and just needed to be pulled out and repackaged to work outside of Zephyr. As you discovered, it's not that simple, and I haven't taken any further steps to fix it.
That said, I definitely still want this to work and would gladly welcome a PR!
Hey there -- so, I made a fork to work on and made a couple edits to the plugin to make it work. I've gotten it to build HTML successfully (allegedly):
misha@minisrv ~/Projects/photothing/doc (develop *%)
>>> make html
Running Sphinx v6.2.1
making output directory... done
myst v2.0.0: MdParserConfig(commonmark_only=False, gfm_only=False, enable_extensions=set(), disable_syntax=[], all_links_external=False, url_schemes=('http', 'https', 'mailto', 'ftp'), ref_domains=None, fence_as_directive=set(), number_code_blocks=[], title_to_header=False, heading_anchors=0, heading_slug_func=None, html_meta={}, footnote_transition=True, words_per_minute=200, substitutions={}, linkify_fuzzy_links=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area', enable_checkboxes=False, suppress_warnings=[], highlight_code_blocks=True)
Building Kconfig database...... done
building [mo]: targets for 0 po files that are out of date
writing output...
building [html]: targets for 15 source files that are out of date
updating environment: [new config] 15 added, 0 changed, 0 removed
reading sources... [100%] manpages/tvwmake
/home/misha/Projects/photothing/doc/dev/api/index.rst:42: CRITICAL: /home/misha/Projects/photothing/src/format/tvwrapper.h:13: 'libxml/xmlmemory.h' file not found
/home/misha/Projects/photothing/doc/dev/api/index.rst:46: CRITICAL: /home/misha/Projects/photothing/src/format/tvwrapper.h:13: 'libxml/xmlmemory.h' file not found
/home/misha/Projects/photothing/doc/dev/api/index.rst:50: CRITICAL: /home/misha/Projects/photothing/src/format/tvw_i.h:17: 'libxml/xmlmemory.h' file not found
/home/misha/Projects/photothing/doc/dev/api/index.rst:54: CRITICAL: /home/misha/Projects/photothing/src/format/tvwrapper.h:13: 'libxml/xmlmemory.h' file not found
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] manpages/tvwmake
generating indices... genindex done
writing additional pages... search done
copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 4 warnings.
The HTML pages are in _build/html.
\hawkmoth
, and are the effect of Sphinx being bullied into autodoc'ing C code instead of Python. Those errors were there before I started messing with Kconfig stuff :) \
However, when I view the actual HTML output that's supposed to have the search bar, I get nothing:
The source of that page is:
Kconfigs
========
.. kconfig:search::
This text comes after the search directive
I'm still trying to figure out why exactly this is happening. I was able to see the _build/html/kconfig.json
file, which contained (what seemed to me to be) the Kconfig database used by this plugin, though for some reason the search bar is taking the week off.
If you happen to have a project sitting around that is/was supposed to use this extension at some point, would you mind taking a look to see if it does the same for you?
p.s. repo is here: https://github.com/mishaturnbull/sphinx-kconfig
important parts of conf.py
:
# if you've got your version of sphinx-kconfig installed, may have to override sys.path to wherever the other clone went (or just multi-remote, if that's your thing):
import os
sys.path.insert(0, "/path/to/cloned/sphinx-kconfig")
extensions.append('sphinx_kconfig')
kconfig_generate_db = True
kconfig_root_path = "../Kconfig" # or wherever your root Kconfig file is
Update: I suspect this might be an issue on either my client or server end, due to this error message in the browser console: Will hunt around for how to fix this locally.
Update: got it working! PR to be opened after work. :)
Nice! This is super exciting and I'm looking forward to it!
Well, I lied a bit -- it's still somewhere between very delicate and flat-out broken. Issue is I can't figure out how Sphinx decides where to put the JS file -- either under /_static/
, or /_static/scripts/
, so the JS can't always find the kconfig database. Still in work, though!
Edit: bit of a hack, but the script will now search upwards for the database (limit of 4 tries to prevent trying to run up a server tree). PR open! #2
Hi there -- thanks for doing this! Exactly what I needed for my project!
One hiccup, though. It seems that this extension relies on the presence of Zephyr as a whole in order to run happily. I'm currently getting the following error when building:
Importing it directly from Python yields a bit more info:
On inspection, it seems that the extension relies on Zephyr for some functions (
grep -i zephyr
), though I haven't yet fully understood what. I'm happy to do my best to hack those parts out and make a PR, but before I do that, wondering if this is a known issue with a known fix?Thanks again!