mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +00:00
fix: section_name must be a dict {filename:name}
else it was triggering an error during regeneration of the files.
This commit is contained in:
@@ -48,6 +48,7 @@ import textwrap
|
|||||||
import subprocess
|
import subprocess
|
||||||
import collections
|
import collections
|
||||||
import msgpack
|
import msgpack
|
||||||
|
import logging
|
||||||
|
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
|
|
||||||
@@ -57,10 +58,18 @@ if sys.version_info < MIN_PYTHON_VERSION:
|
|||||||
print("requires Python {}.{}+".format(*MIN_PYTHON_VERSION))
|
print("requires Python {}.{}+".format(*MIN_PYTHON_VERSION))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
DEBUG = ('DEBUG' in os.environ)
|
# DEBUG = ('DEBUG' in os.environ)
|
||||||
INCLUDE_C_DECL = ('INCLUDE_C_DECL' in os.environ)
|
INCLUDE_C_DECL = ('INCLUDE_C_DECL' in os.environ)
|
||||||
INCLUDE_DEPRECATED = ('INCLUDE_DEPRECATED' in os.environ)
|
INCLUDE_DEPRECATED = ('INCLUDE_DEPRECATED' in os.environ)
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
LOG_LEVELS = {
|
||||||
|
logging.getLevelName(level): level for level in [
|
||||||
|
logging.DEBUG, logging.INFO, logging.ERROR
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
fmt_vimhelp = False # HACK
|
fmt_vimhelp = False # HACK
|
||||||
text_width = 78
|
text_width = 78
|
||||||
script_path = os.path.abspath(__file__)
|
script_path = os.path.abspath(__file__)
|
||||||
@@ -157,7 +166,7 @@ CONFIG = {
|
|||||||
]),
|
]),
|
||||||
'file_patterns': '*.lua',
|
'file_patterns': '*.lua',
|
||||||
'fn_name_prefix': '',
|
'fn_name_prefix': '',
|
||||||
'section_name': {},
|
'section_name': {'lsp.lua': 'lsp'},
|
||||||
'section_fmt': lambda name: (
|
'section_fmt': lambda name: (
|
||||||
'Lua module: vim.lsp'
|
'Lua module: vim.lsp'
|
||||||
if name.lower() == 'lsp'
|
if name.lower() == 'lsp'
|
||||||
@@ -726,8 +735,8 @@ def extract_from_xml(filename, target, width):
|
|||||||
if desc:
|
if desc:
|
||||||
for child in desc.childNodes:
|
for child in desc.childNodes:
|
||||||
paras.append(para_as_map(child))
|
paras.append(para_as_map(child))
|
||||||
if DEBUG:
|
log.debug(
|
||||||
print(textwrap.indent(
|
textwrap.indent(
|
||||||
re.sub(r'\n\s*\n+', '\n',
|
re.sub(r'\n\s*\n+', '\n',
|
||||||
desc.toprettyxml(indent=' ', newl='\n')), ' ' * 16))
|
desc.toprettyxml(indent=' ', newl='\n')), ' ' * 16))
|
||||||
|
|
||||||
@@ -885,12 +894,13 @@ def main(config, args):
|
|||||||
os.remove(mpack_file)
|
os.remove(mpack_file)
|
||||||
|
|
||||||
output_dir = out_dir.format(target=target)
|
output_dir = out_dir.format(target=target)
|
||||||
|
debug = args.log_level >= logging.DEBUG
|
||||||
p = subprocess.Popen(
|
p = subprocess.Popen(
|
||||||
['doxygen', '-'],
|
['doxygen', '-'],
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
# silence warnings
|
# silence warnings
|
||||||
# runtime/lua/vim/lsp.lua:209: warning: argument 'foo' not found
|
# runtime/lua/vim/lsp.lua:209: warning: argument 'foo' not found
|
||||||
stderr=(subprocess.STDOUT if DEBUG else subprocess.DEVNULL))
|
stderr=(subprocess.STDOUT if debug else subprocess.DEVNULL))
|
||||||
p.communicate(
|
p.communicate(
|
||||||
config.format(
|
config.format(
|
||||||
input=CONFIG[target]['files'],
|
input=CONFIG[target]['files'],
|
||||||
@@ -1039,6 +1049,10 @@ def filter_source(filename):
|
|||||||
def parse_args():
|
def parse_args():
|
||||||
targets = ', '.join(CONFIG.keys())
|
targets = ', '.join(CONFIG.keys())
|
||||||
ap = argparse.ArgumentParser()
|
ap = argparse.ArgumentParser()
|
||||||
|
ap.add_argument(
|
||||||
|
"--log-level", "-l", choices=LOG_LEVELS.keys(),
|
||||||
|
default=logging.getLevelName(logging.ERROR), help="Set log verbosity"
|
||||||
|
)
|
||||||
ap.add_argument('source_filter', nargs='*',
|
ap.add_argument('source_filter', nargs='*',
|
||||||
help="Filter source file(s)")
|
help="Filter source file(s)")
|
||||||
ap.add_argument('-k', '--keep-tmpfiles', action='store_true',
|
ap.add_argument('-k', '--keep-tmpfiles', action='store_true',
|
||||||
@@ -1085,6 +1099,10 @@ Doxyfile = textwrap.dedent('''
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
|
print("Setting log level to %s" % args.log_level)
|
||||||
|
args.log_level = LOG_LEVELS[args.log_level]
|
||||||
|
log.setLevel(args.log_level)
|
||||||
|
|
||||||
if len(args.source_filter) > 0:
|
if len(args.source_filter) > 0:
|
||||||
filter_source(args.source_filter[0])
|
filter_source(args.source_filter[0])
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user