fix(gen_vimdoc.py): handle missing luajit

This commit is contained in:
Justin M. Keyes 2022-09-25 13:45:41 +02:00
parent 3169fc54a1
commit 1b60b5ec94
2 changed files with 16 additions and 5 deletions

View File

@ -295,14 +295,16 @@ annotation_map = {
# or if `cond()` is callable and returns True. # or if `cond()` is callable and returns True.
def debug_this(o, cond=True): def debug_this(o, cond=True):
name = '' name = ''
if cond is False:
return
if not isinstance(o, str): if not isinstance(o, str):
try: try:
name = o.nodeName name = o.nodeName
o = o.toprettyxml(indent=' ', newl='\n') o = o.toprettyxml(indent=' ', newl='\n')
except Exception: except Exception:
pass pass
if ((callable(cond) and cond()) if (cond is True
or (not callable(cond) and cond) or (callable(cond) and cond())
or (not callable(cond) and cond in o)): or (not callable(cond) and cond in o)):
raise RuntimeError('xxx: {}\n{}'.format(name, o)) raise RuntimeError('xxx: {}\n{}'.format(name, o))
@ -887,7 +889,7 @@ def extract_from_xml(filename, target, width, fmt_vimhelp):
def fmt_doxygen_xml_as_vimhelp(filename, target): def fmt_doxygen_xml_as_vimhelp(filename, target):
"""Entrypoint for generating Vim :help from from Doxygen XML. """Entrypoint for generating Vim :help from from Doxygen XML.
Returns 3 items: Returns 2 items:
1. Vim help text for functions found in `filename`. 1. Vim help text for functions found in `filename`.
2. Vim help text for deprecated functions. 2. Vim help text for deprecated functions.
""" """
@ -1094,7 +1096,11 @@ def main(config, args):
fn_map_full.update(fn_map) fn_map_full.update(fn_map)
if len(sections) == 0: if len(sections) == 0:
fail(f'no sections for target: {target}') if target == 'lua':
fail(f'no sections for target: {target} (this usually means'
+ ' "luajit" was not found by scripts/lua2dox_filter)')
else:
fail(f'no sections for target: {target}')
if len(sections) > len(CONFIG[target]['section_order']): if len(sections) > len(CONFIG[target]['section_order']):
raise RuntimeError( raise RuntimeError(
'found new modules "{}"; update the "section_order" map'.format( 'found new modules "{}"; update the "section_order" map'.format(

View File

@ -36,6 +36,10 @@ test_executable(){
##! \brief sets the lua interpreter ##! \brief sets the lua interpreter
set_lua(){ set_lua(){
if test -z "${EXE}"; then
test_executable '.deps/usr/bin/luajit'
fi
if test -z "${EXE}"; then if test -z "${EXE}"; then
test_executable 'luajit' test_executable 'luajit'
fi fi
@ -73,7 +77,8 @@ do_readlink(){
set_lua set_lua
if test -z "${EXE}" if test -z "${EXE}"
then then
echo "no lua interpreter available" echo "no lua interpreter found"
exit 1
else else
BASENAME=`basename "$0"` BASENAME=`basename "$0"`
do_readlink "$0" do_readlink "$0"