docs: use build/bin/nvim instead of nvim in gen_vimdoc (#22398)

Problem:

`nvim` could point to stable release missing the `nvim -l`
functionality.

Solution:

Require to build nvim first and use `build/bin/nvim`
This commit is contained in:
Mathias Fußenegger 2023-02-25 16:35:45 +01:00 committed by GitHub
parent f0f27e9aef
commit 2708507e87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,6 +42,7 @@ import subprocess
import collections
import msgpack
import logging
from pathlib import Path
from xml.dom import minidom
@ -55,19 +56,19 @@ if sys.version_info < MIN_PYTHON_VERSION:
doxygen_version = tuple((int(i) for i in subprocess.check_output(["doxygen", "-v"],
universal_newlines=True).split()[0].split('.')))
# Until 0.9 is released, need this hacky way to check that "nvim -l foo.lua" works.
nvim_version = list(line for line in subprocess.check_output(['nvim', '-h'], universal_newlines=True).split('\n')
if '-l ' in line)
if doxygen_version < MIN_DOXYGEN_VERSION:
print("\nRequires doxygen {}.{}.{}+".format(*MIN_DOXYGEN_VERSION))
print("Your doxygen version is {}.{}.{}\n".format(*doxygen_version))
sys.exit(1)
if len(nvim_version) == 0:
print("\nRequires 'nvim -l' feature, see https://github.com/neovim/neovim/pull/18706")
# Need a `nvim` that supports `-l`, so use the local build
nvim = Path(__file__).parent / "../build/bin/nvim"
if not nvim.exists():
print("\nYou need to build Neovim first to build the documentation.")
sys.exit(1)
# DEBUG = ('DEBUG' in os.environ)
INCLUDE_C_DECL = ('INCLUDE_C_DECL' in os.environ)
INCLUDE_DEPRECATED = ('INCLUDE_DEPRECATED' in os.environ)
@ -1163,7 +1164,7 @@ def main(doxygen_config, args):
def filter_source(filename):
name, extension = os.path.splitext(filename)
if extension == '.lua':
p = subprocess.run(['nvim', '-l', lua2dox, filename], stdout=subprocess.PIPE)
p = subprocess.run([str(nvim), '-l', lua2dox, filename], stdout=subprocess.PIPE)
op = ('?' if 0 != p.returncode else p.stdout.decode('utf-8'))
print(op)
else: