mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 20:08:17 +00:00
@@ -516,6 +516,7 @@ if(NOT BUSTED_OUTPUT_TYPE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_program(LUACHECK_PRG luacheck)
|
find_program(LUACHECK_PRG luacheck)
|
||||||
|
find_program(FLAKE8_PRG flake8)
|
||||||
find_program(GPERF_PRG gperf)
|
find_program(GPERF_PRG gperf)
|
||||||
|
|
||||||
include(InstallHelpers)
|
include(InstallHelpers)
|
||||||
@@ -667,6 +668,15 @@ else()
|
|||||||
COMMENT "lualint: LUACHECK_PRG not defined")
|
COMMENT "lualint: LUACHECK_PRG not defined")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(FLAKE8_PRG)
|
||||||
|
add_custom_target(pylint
|
||||||
|
COMMAND ${FLAKE8_PRG} contrib/ scripts/ src/ test/
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
else()
|
||||||
|
add_custom_target(pylint false
|
||||||
|
COMMENT "flake8: FLAKE8_PRG not defined")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CPACK_PACKAGE_NAME "Neovim")
|
set(CPACK_PACKAGE_NAME "Neovim")
|
||||||
set(CPACK_PACKAGE_VENDOR "neovim.io")
|
set(CPACK_PACKAGE_VENDOR "neovim.io")
|
||||||
set(CPACK_PACKAGE_VERSION ${NVIM_VERSION_MEDIUM})
|
set(CPACK_PACKAGE_VERSION ${NVIM_VERSION_MEDIUM})
|
||||||
|
7
Makefile
7
Makefile
@@ -138,6 +138,9 @@ functionaltest-lua: | nvim
|
|||||||
lualint: | build/.ran-cmake deps
|
lualint: | build/.ran-cmake deps
|
||||||
$(BUILD_CMD) -C build lualint
|
$(BUILD_CMD) -C build lualint
|
||||||
|
|
||||||
|
pylint: | build/.ran-cmake deps
|
||||||
|
$(BUILD_CMD) -C build pylint
|
||||||
|
|
||||||
unittest: | nvim
|
unittest: | nvim
|
||||||
+$(BUILD_CMD) -C build unittest
|
+$(BUILD_CMD) -C build unittest
|
||||||
|
|
||||||
@@ -179,6 +182,6 @@ appimage:
|
|||||||
appimage-%:
|
appimage-%:
|
||||||
bash scripts/genappimage.sh $*
|
bash scripts/genappimage.sh $*
|
||||||
|
|
||||||
lint: check-single-includes clint lualint
|
lint: check-single-includes clint lualint pylint
|
||||||
|
|
||||||
.PHONY: test lualint functionaltest unittest lint clint clean distclean nvim libnvim cmake deps install appimage checkprefix
|
.PHONY: test lualint pylint functionaltest unittest lint clint clean distclean nvim libnvim cmake deps install appimage checkprefix
|
||||||
|
@@ -4,6 +4,7 @@ set -e
|
|||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
if [[ "${CI_TARGET}" == lint ]]; then
|
if [[ "${CI_TARGET}" == lint ]]; then
|
||||||
|
python -m pip -q install --user --upgrade flake8
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@@ -9,26 +9,24 @@ source "${CI_DIR}/common/build.sh"
|
|||||||
source "${CI_DIR}/common/suite.sh"
|
source "${CI_DIR}/common/suite.sh"
|
||||||
|
|
||||||
enter_suite 'clint'
|
enter_suite 'clint'
|
||||||
|
|
||||||
run_test 'make clint-full' clint
|
run_test 'make clint-full' clint
|
||||||
|
|
||||||
exit_suite --continue
|
exit_suite --continue
|
||||||
|
|
||||||
enter_suite 'lualint'
|
enter_suite 'lualint'
|
||||||
|
|
||||||
run_test 'make lualint' lualint
|
run_test 'make lualint' lualint
|
||||||
|
exit_suite --continue
|
||||||
|
|
||||||
|
enter_suite 'pylint'
|
||||||
|
run_test 'make pylint' pylint
|
||||||
exit_suite --continue
|
exit_suite --continue
|
||||||
|
|
||||||
enter_suite single-includes
|
enter_suite single-includes
|
||||||
|
|
||||||
CLICOLOR_FORCE=1 run_test_wd \
|
CLICOLOR_FORCE=1 run_test_wd \
|
||||||
--allow-hang \
|
--allow-hang \
|
||||||
10s \
|
10s \
|
||||||
'make check-single-includes' \
|
'make check-single-includes' \
|
||||||
'csi_clean' \
|
'csi_clean' \
|
||||||
single-includes
|
single-includes
|
||||||
|
|
||||||
exit_suite --continue
|
exit_suite --continue
|
||||||
|
|
||||||
end_tests
|
end_tests
|
||||||
|
@@ -22,8 +22,6 @@ def main(argv):
|
|||||||
args = argparser.parse_args(argv)
|
args = argparser.parse_args(argv)
|
||||||
|
|
||||||
with args.file:
|
with args.file:
|
||||||
include_dirs = []
|
|
||||||
|
|
||||||
iwyu = Popen(['include-what-you-use', '-xc'] + args.iwyu_args + ['/dev/stdin'],
|
iwyu = Popen(['include-what-you-use', '-xc'] + args.iwyu_args + ['/dev/stdin'],
|
||||||
stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||||
|
|
||||||
|
@@ -81,12 +81,12 @@ SITENAVI_PLAIN = '<p>' + SITENAVI_LINKS_PLAIN + '</p>'
|
|||||||
SITENAVI_WEB = '<p>' + SITENAVI_LINKS_WEB + '</p>'
|
SITENAVI_WEB = '<p>' + SITENAVI_LINKS_WEB + '</p>'
|
||||||
|
|
||||||
SITENAVI_SEARCH = '<table width="100%"><tbody><tr><td>' + SITENAVI_LINKS_WEB + \
|
SITENAVI_SEARCH = '<table width="100%"><tbody><tr><td>' + SITENAVI_LINKS_WEB + \
|
||||||
'</td><td style="text-align: right; max-width: 25vw"><div class="gcse-searchbox">' \
|
'</td><td style="text-align: right; max-width: 25vw"><div class="gcse-searchbox">' \
|
||||||
'</div></td></tr></tbody></table><div class="gcse-searchresults"></div>'
|
'</div></td></tr></tbody></table><div class="gcse-searchresults"></div>'
|
||||||
|
|
||||||
TEXTSTART = """
|
TEXTSTART = """
|
||||||
<div id="d1">
|
<div id="d1">
|
||||||
<pre id="sp"> </pre>
|
<pre id="sp">""" + (" " * 80) + """</pre>
|
||||||
<div id="d2">
|
<div id="d2">
|
||||||
<pre>
|
<pre>
|
||||||
"""
|
"""
|
||||||
@@ -152,6 +152,7 @@ RE_SECTION = re.compile(r'[-A-Z .][-A-Z0-9 .()]*(?=\s+\*)')
|
|||||||
RE_STARTAG = re.compile(r'\s\*([^ \t|]+)\*(?:\s|$)')
|
RE_STARTAG = re.compile(r'\s\*([^ \t|]+)\*(?:\s|$)')
|
||||||
RE_LOCAL_ADD = re.compile(r'LOCAL ADDITIONS:\s+\*local-additions\*$')
|
RE_LOCAL_ADD = re.compile(r'LOCAL ADDITIONS:\s+\*local-additions\*$')
|
||||||
|
|
||||||
|
|
||||||
class Link(object):
|
class Link(object):
|
||||||
__slots__ = 'link_plain_same', 'link_pipe_same', \
|
__slots__ = 'link_plain_same', 'link_pipe_same', \
|
||||||
'link_plain_foreign', 'link_pipe_foreign', \
|
'link_plain_foreign', 'link_pipe_foreign', \
|
||||||
@@ -165,9 +166,10 @@ class Link(object):
|
|||||||
self.link_pipe_foreign = link_pipe_foreign
|
self.link_pipe_foreign = link_pipe_foreign
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
|
|
||||||
|
|
||||||
class VimH2H(object):
|
class VimH2H(object):
|
||||||
def __init__(self, tags, version=None, is_web_version=True):
|
def __init__(self, tags, version=None, is_web_version=True):
|
||||||
self._urls = { }
|
self._urls = {}
|
||||||
self._version = version
|
self._version = version
|
||||||
self._is_web_version = is_web_version
|
self._is_web_version = is_web_version
|
||||||
for line in RE_NEWLINE.split(tags):
|
for line in RE_NEWLINE.split(tags):
|
||||||
@@ -183,6 +185,7 @@ class VimH2H(object):
|
|||||||
|
|
||||||
def do_add_tag(self, filename, tag):
|
def do_add_tag(self, filename, tag):
|
||||||
tag_quoted = urllib.parse.quote_plus(tag)
|
tag_quoted = urllib.parse.quote_plus(tag)
|
||||||
|
|
||||||
def mkpart1(doc):
|
def mkpart1(doc):
|
||||||
return '<a href="' + doc + '#' + tag_quoted + '" class="'
|
return '<a href="' + doc + '#' + tag_quoted + '" class="'
|
||||||
part1_same = mkpart1('')
|
part1_same = mkpart1('')
|
||||||
@@ -192,6 +195,7 @@ class VimH2H(object):
|
|||||||
doc = filename + '.html'
|
doc = filename + '.html'
|
||||||
part1_foreign = mkpart1(doc)
|
part1_foreign = mkpart1(doc)
|
||||||
part2 = '">' + html_escape[tag] + '</a>'
|
part2 = '">' + html_escape[tag] + '</a>'
|
||||||
|
|
||||||
def mklinks(cssclass):
|
def mklinks(cssclass):
|
||||||
return (part1_same + cssclass + part2,
|
return (part1_same + cssclass + part2,
|
||||||
part1_foreign + cssclass + part2)
|
part1_foreign + cssclass + part2)
|
||||||
@@ -199,9 +203,12 @@ class VimH2H(object):
|
|||||||
m = RE_LINKWORD.match(tag)
|
m = RE_LINKWORD.match(tag)
|
||||||
if m:
|
if m:
|
||||||
opt, ctrl, special = m.groups()
|
opt, ctrl, special = m.groups()
|
||||||
if opt is not None: cssclass_plain = 'o'
|
if opt is not None:
|
||||||
elif ctrl is not None: cssclass_plain = 'k'
|
cssclass_plain = 'o'
|
||||||
elif special is not None: cssclass_plain = 's'
|
elif ctrl is not None:
|
||||||
|
cssclass_plain = 'k'
|
||||||
|
elif special is not None:
|
||||||
|
cssclass_plain = 's'
|
||||||
links_plain = mklinks(cssclass_plain)
|
links_plain = mklinks(cssclass_plain)
|
||||||
links_pipe = mklinks('l')
|
links_pipe = mklinks('l')
|
||||||
self._urls[tag] = Link(
|
self._urls[tag] = Link(
|
||||||
@@ -213,18 +220,23 @@ class VimH2H(object):
|
|||||||
links = self._urls.get(tag)
|
links = self._urls.get(tag)
|
||||||
if links is not None:
|
if links is not None:
|
||||||
if links.filename == curr_filename:
|
if links.filename == curr_filename:
|
||||||
if css_class == 'l': return links.link_pipe_same
|
if css_class == 'l':
|
||||||
else: return links.link_plain_same
|
return links.link_pipe_same
|
||||||
else:
|
else:
|
||||||
if css_class == 'l': return links.link_pipe_foreign
|
return links.link_plain_same
|
||||||
else: return links.link_plain_foreign
|
else:
|
||||||
|
if css_class == 'l':
|
||||||
|
return links.link_pipe_foreign
|
||||||
|
else:
|
||||||
|
return links.link_plain_foreign
|
||||||
elif css_class is not None:
|
elif css_class is not None:
|
||||||
return '<span class="' + css_class + '">' + html_escape[tag] + \
|
return '<span class="' + css_class + '">' + html_escape[tag] + \
|
||||||
'</span>'
|
'</span>'
|
||||||
else: return html_escape[tag]
|
else:
|
||||||
|
return html_escape[tag]
|
||||||
|
|
||||||
def to_html(self, filename, contents, encoding):
|
def to_html(self, filename, contents, encoding):
|
||||||
out = [ ]
|
out = []
|
||||||
|
|
||||||
inexample = 0
|
inexample = 0
|
||||||
filename = str(filename)
|
filename = str(filename)
|
||||||
@@ -247,7 +259,8 @@ class VimH2H(object):
|
|||||||
if inexample == 2:
|
if inexample == 2:
|
||||||
if RE_EG_END.match(line):
|
if RE_EG_END.match(line):
|
||||||
inexample = 0
|
inexample = 0
|
||||||
if line[0] == '<': line = line[1:]
|
if line[0] == '<':
|
||||||
|
line = line[1:]
|
||||||
else:
|
else:
|
||||||
out.extend(('<span class="e">', html_escape[line],
|
out.extend(('<span class="e">', html_escape[line],
|
||||||
'</span>\n'))
|
'</span>\n'))
|
||||||
@@ -300,7 +313,8 @@ class VimH2H(object):
|
|||||||
if lastpos < len(line):
|
if lastpos < len(line):
|
||||||
out.append(html_escape[line[lastpos:]])
|
out.append(html_escape[line[lastpos:]])
|
||||||
out.append('\n')
|
out.append('\n')
|
||||||
if inexample == 1: inexample = 2
|
if inexample == 1:
|
||||||
|
inexample = 2
|
||||||
|
|
||||||
header = []
|
header = []
|
||||||
header.append(HEAD.format(encoding=encoding, filename=filename))
|
header.append(HEAD.format(encoding=encoding, filename=filename))
|
||||||
@@ -318,6 +332,7 @@ class VimH2H(object):
|
|||||||
header.append(TEXTSTART)
|
header.append(TEXTSTART)
|
||||||
return ''.join(chain(header, out, (FOOTER, sitenavi_footer, FOOTER2)))
|
return ''.join(chain(header, out, (FOOTER, sitenavi_footer, FOOTER2)))
|
||||||
|
|
||||||
|
|
||||||
class HtmlEscCache(dict):
|
class HtmlEscCache(dict):
|
||||||
def __missing__(self, key):
|
def __missing__(self, key):
|
||||||
r = key.replace('&', '&') \
|
r = key.replace('&', '&') \
|
||||||
@@ -326,11 +341,10 @@ class HtmlEscCache(dict):
|
|||||||
self[key] = r
|
self[key] = r
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
html_escape = HtmlEscCache()
|
html_escape = HtmlEscCache()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def slurp(filename):
|
def slurp(filename):
|
||||||
try:
|
try:
|
||||||
with open(filename, encoding='UTF-8') as f:
|
with open(filename, encoding='UTF-8') as f:
|
||||||
@@ -340,17 +354,20 @@ def slurp(filename):
|
|||||||
with open(filename, encoding='latin-1') as f:
|
with open(filename, encoding='latin-1') as f:
|
||||||
return f.read(), 'latin-1'
|
return f.read(), 'latin-1'
|
||||||
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
return "usage: " + sys.argv[0] + " IN_DIR OUT_DIR [BASENAMES...]"
|
return "usage: " + sys.argv[0] + " IN_DIR OUT_DIR [BASENAMES...]"
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) < 3: sys.exit(usage())
|
if len(sys.argv) < 3:
|
||||||
|
sys.exit(usage())
|
||||||
|
|
||||||
in_dir = sys.argv[1]
|
in_dir = sys.argv[1]
|
||||||
out_dir = sys.argv[2]
|
out_dir = sys.argv[2]
|
||||||
basenames = sys.argv[3:]
|
basenames = sys.argv[3:]
|
||||||
|
|
||||||
print( "Processing tags...")
|
print("Processing tags...")
|
||||||
h2h = VimH2H(slurp(os.path.join(in_dir, 'tags'))[0], is_web_version=False)
|
h2h = VimH2H(slurp(os.path.join(in_dir, 'tags'))[0], is_web_version=False)
|
||||||
|
|
||||||
if len(basenames) == 0:
|
if len(basenames) == 0:
|
||||||
@@ -358,9 +375,9 @@ def main():
|
|||||||
|
|
||||||
for basename in basenames:
|
for basename in basenames:
|
||||||
if os.path.splitext(basename)[1] != '.txt' and basename != 'tags':
|
if os.path.splitext(basename)[1] != '.txt' and basename != 'tags':
|
||||||
print( "Ignoring " + basename)
|
print("Ignoring " + basename)
|
||||||
continue
|
continue
|
||||||
print( "Processing " + basename + "...")
|
print("Processing " + basename + "...")
|
||||||
path = os.path.join(in_dir, basename)
|
path = os.path.join(in_dir, basename)
|
||||||
text, encoding = slurp(path)
|
text, encoding = slurp(path)
|
||||||
outpath = os.path.join(out_dir, basename + '.html')
|
outpath = os.path.join(out_dir, basename + '.html')
|
||||||
@@ -368,4 +385,5 @@ def main():
|
|||||||
of.write(h2h.to_html(basename, text, encoding))
|
of.write(h2h.to_html(basename, text, encoding))
|
||||||
of.close()
|
of.close()
|
||||||
|
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
@@ -36,7 +36,6 @@ import shutil
|
|||||||
import textwrap
|
import textwrap
|
||||||
import subprocess
|
import subprocess
|
||||||
import collections
|
import collections
|
||||||
import pprint
|
|
||||||
|
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
|
|
||||||
@@ -62,7 +61,7 @@ CONFIG = {
|
|||||||
# String used to find the start of the generated part of the doc.
|
# String used to find the start of the generated part of the doc.
|
||||||
'section_start_token': '*api-global*',
|
'section_start_token': '*api-global*',
|
||||||
# Section ordering.
|
# Section ordering.
|
||||||
'section_order' : [
|
'section_order': [
|
||||||
'vim.c',
|
'vim.c',
|
||||||
'buffer.c',
|
'buffer.c',
|
||||||
'window.c',
|
'window.c',
|
||||||
@@ -82,12 +81,12 @@ CONFIG = {
|
|||||||
# Module name overrides (for Lua).
|
# Module name overrides (for Lua).
|
||||||
'module_override': {},
|
'module_override': {},
|
||||||
# Append the docs for these modules, do not start a new section.
|
# Append the docs for these modules, do not start a new section.
|
||||||
'append_only' : [],
|
'append_only': [],
|
||||||
},
|
},
|
||||||
'lua': {
|
'lua': {
|
||||||
'filename': 'if_lua.txt',
|
'filename': 'if_lua.txt',
|
||||||
'section_start_token': '*lua-vim*',
|
'section_start_token': '*lua-vim*',
|
||||||
'section_order' : [
|
'section_order': [
|
||||||
'vim.lua',
|
'vim.lua',
|
||||||
'shared.lua',
|
'shared.lua',
|
||||||
],
|
],
|
||||||
@@ -99,9 +98,10 @@ CONFIG = {
|
|||||||
'func_name_prefix': '',
|
'func_name_prefix': '',
|
||||||
'section_name': {},
|
'section_name': {},
|
||||||
'module_override': {
|
'module_override': {
|
||||||
'shared': 'vim', # `shared` functions are exposed on the `vim` module.
|
# `shared` functions are exposed on the `vim` module.
|
||||||
|
'shared': 'vim',
|
||||||
},
|
},
|
||||||
'append_only' : [
|
'append_only': [
|
||||||
'shared.lua',
|
'shared.lua',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -121,6 +121,7 @@ annotation_map = {
|
|||||||
# deprecated functions.
|
# deprecated functions.
|
||||||
xrefs = set()
|
xrefs = set()
|
||||||
|
|
||||||
|
|
||||||
def debug_this(s, n):
|
def debug_this(s, n):
|
||||||
o = n if isinstance(n, str) else n.toprettyxml(indent=' ', newl='\n')
|
o = n if isinstance(n, str) else n.toprettyxml(indent=' ', newl='\n')
|
||||||
name = '' if isinstance(n, str) else n.nodeName
|
name = '' if isinstance(n, str) else n.nodeName
|
||||||
@@ -191,7 +192,7 @@ def len_lastline(text):
|
|||||||
if -1 == lastnl:
|
if -1 == lastnl:
|
||||||
return len(text)
|
return len(text)
|
||||||
if '\n' == text[-1]:
|
if '\n' == text[-1]:
|
||||||
return lastnl - (1+ text.rfind('\n', 0, lastnl))
|
return lastnl - (1 + text.rfind('\n', 0, lastnl))
|
||||||
return len(text) - (1 + lastnl)
|
return len(text) - (1 + lastnl)
|
||||||
|
|
||||||
|
|
||||||
@@ -209,6 +210,7 @@ def is_inline(n):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def doc_wrap(text, prefix='', width=70, func=False, indent=None):
|
def doc_wrap(text, prefix='', width=70, func=False, indent=None):
|
||||||
"""Wraps text to `width`.
|
"""Wraps text to `width`.
|
||||||
|
|
||||||
@@ -237,8 +239,8 @@ def doc_wrap(text, prefix='', width=70, func=False, indent=None):
|
|||||||
if indent_only:
|
if indent_only:
|
||||||
prefix = indent
|
prefix = indent
|
||||||
|
|
||||||
tw = textwrap.TextWrapper(break_long_words = False,
|
tw = textwrap.TextWrapper(break_long_words=False,
|
||||||
break_on_hyphens = False,
|
break_on_hyphens=False,
|
||||||
width=width,
|
width=width,
|
||||||
initial_indent=prefix,
|
initial_indent=prefix,
|
||||||
subsequent_indent=indent)
|
subsequent_indent=indent)
|
||||||
@@ -292,8 +294,9 @@ def render_params(parent, width=62):
|
|||||||
out += '{}{}\n'.format(name, desc)
|
out += '{}{}\n'.format(name, desc)
|
||||||
return out.rstrip()
|
return out.rstrip()
|
||||||
|
|
||||||
# Renders a node as Vim help text, recursively traversing all descendants.
|
|
||||||
def render_node(n, text, prefix='', indent='', width=62):
|
def render_node(n, text, prefix='', indent='', width=62):
|
||||||
|
"""Renders a node as Vim help text, recursively traversing all descendants."""
|
||||||
text = ''
|
text = ''
|
||||||
# space_preceding = (len(text) > 0 and ' ' == text[-1][-1])
|
# space_preceding = (len(text) > 0 and ' ' == text[-1][-1])
|
||||||
# text += (int(not space_preceding) * ' ')
|
# text += (int(not space_preceding) * ' ')
|
||||||
@@ -317,7 +320,11 @@ def render_node(n, text, prefix='', indent='', width=62):
|
|||||||
text += ' [verbatim] {}'.format(get_text(n))
|
text += ' [verbatim] {}'.format(get_text(n))
|
||||||
elif n.nodeName == 'listitem':
|
elif n.nodeName == 'listitem':
|
||||||
for c in n.childNodes:
|
for c in n.childNodes:
|
||||||
text += indent + prefix + render_node(c, text, indent=indent+(' ' * len(prefix)), width=width)
|
text += (
|
||||||
|
indent
|
||||||
|
+ prefix
|
||||||
|
+ render_node(c, text, indent=indent + (' ' * len(prefix)), width=width)
|
||||||
|
)
|
||||||
elif n.nodeName in ('para', 'heading'):
|
elif n.nodeName in ('para', 'heading'):
|
||||||
for c in n.childNodes:
|
for c in n.childNodes:
|
||||||
text += render_node(c, text, indent=indent, width=width)
|
text += render_node(c, text, indent=indent, width=width)
|
||||||
@@ -356,6 +363,7 @@ def render_node(n, text, prefix='', indent='', width=62):
|
|||||||
n.nodeName, n.toprettyxml(indent=' ', newl='\n')))
|
n.nodeName, n.toprettyxml(indent=' ', newl='\n')))
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
def render_para(parent, indent='', width=62):
|
def render_para(parent, indent='', width=62):
|
||||||
"""Renders Doxygen <para> containing arbitrary nodes.
|
"""Renders Doxygen <para> containing arbitrary nodes.
|
||||||
|
|
||||||
@@ -407,11 +415,13 @@ def render_para(parent, indent='', width=62):
|
|||||||
if len(groups['return']) > 0:
|
if len(groups['return']) > 0:
|
||||||
chunks.append('\nReturn: ~')
|
chunks.append('\nReturn: ~')
|
||||||
for child in groups['return']:
|
for child in groups['return']:
|
||||||
chunks.append(render_node(child, chunks[-1][-1], indent=indent, width=width))
|
chunks.append(render_node(
|
||||||
|
child, chunks[-1][-1], indent=indent, width=width))
|
||||||
if len(groups['seealso']) > 0:
|
if len(groups['seealso']) > 0:
|
||||||
chunks.append('\nSee also: ~')
|
chunks.append('\nSee also: ~')
|
||||||
for child in groups['seealso']:
|
for child in groups['seealso']:
|
||||||
chunks.append(render_node(child, chunks[-1][-1], indent=indent, width=width))
|
chunks.append(render_node(
|
||||||
|
child, chunks[-1][-1], indent=indent, width=width))
|
||||||
for child in groups['xrefs']:
|
for child in groups['xrefs']:
|
||||||
title = get_text(get_child(child, 'xreftitle'))
|
title = get_text(get_child(child, 'xreftitle'))
|
||||||
xrefs.add(title)
|
xrefs.add(title)
|
||||||
@@ -587,6 +597,7 @@ def delete_lines_below(filename, tokenstr):
|
|||||||
with open(filename, 'wt') as fp:
|
with open(filename, 'wt') as fp:
|
||||||
fp.writelines(lines[0:i])
|
fp.writelines(lines[0:i])
|
||||||
|
|
||||||
|
|
||||||
def gen_docs(config):
|
def gen_docs(config):
|
||||||
"""Generate documentation.
|
"""Generate documentation.
|
||||||
|
|
||||||
@@ -619,7 +630,8 @@ def gen_docs(config):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
groupname = get_text(find_first(compound, 'name'))
|
groupname = get_text(find_first(compound, 'name'))
|
||||||
groupxml = os.path.join(base, '%s.xml' % compound.getAttribute('refid'))
|
groupxml = os.path.join(base, '%s.xml' %
|
||||||
|
compound.getAttribute('refid'))
|
||||||
|
|
||||||
desc = find_first(minidom.parse(groupxml), 'detaileddescription')
|
desc = find_first(minidom.parse(groupxml), 'detaileddescription')
|
||||||
if desc:
|
if desc:
|
||||||
@@ -680,12 +692,15 @@ def gen_docs(config):
|
|||||||
i = 0
|
i = 0
|
||||||
for filename in CONFIG[mode]['section_order']:
|
for filename in CONFIG[mode]['section_order']:
|
||||||
if filename not in sections:
|
if filename not in sections:
|
||||||
raise RuntimeError('found new module "{}"; update the "section_order" map'.format(filename))
|
raise RuntimeError(
|
||||||
|
'found new module "{}"; update the "section_order" map'.format(
|
||||||
|
filename))
|
||||||
title, helptag, section_doc = sections.pop(filename)
|
title, helptag, section_doc = sections.pop(filename)
|
||||||
i += 1
|
i += 1
|
||||||
if filename not in CONFIG[mode]['append_only']:
|
if filename not in CONFIG[mode]['append_only']:
|
||||||
docs += sep
|
docs += sep
|
||||||
docs += '\n%s%s' % (title, helptag.rjust(text_width - len(title)))
|
docs += '\n%s%s' % (title,
|
||||||
|
helptag.rjust(text_width - len(title)))
|
||||||
docs += section_doc
|
docs += section_doc
|
||||||
docs += '\n\n\n'
|
docs += '\n\n\n'
|
||||||
|
|
||||||
|
@@ -63,10 +63,10 @@ fname = sys.argv[1]
|
|||||||
try:
|
try:
|
||||||
filt = sys.argv[2]
|
filt = sys.argv[2]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
filt = lambda entry: True
|
def filt(entry): return True
|
||||||
else:
|
else:
|
||||||
_filt = filt
|
_filt = filt
|
||||||
filt = lambda entry: eval(_filt, globals(), {'entry': entry})
|
def filt(entry): return eval(_filt, globals(), {'entry': entry})
|
||||||
|
|
||||||
poswidth = len(str(os.stat(fname).st_size or 1000))
|
poswidth = len(str(os.stat(fname).st_size or 1000))
|
||||||
|
|
||||||
|
@@ -97,7 +97,8 @@ def main(progname, cfname, only_static, move_all):
|
|||||||
if not generated_existed:
|
if not generated_existed:
|
||||||
lines[include_line:include_line] = [
|
lines[include_line:include_line] = [
|
||||||
'#ifdef INCLUDE_GENERATED_DECLARATIONS\n',
|
'#ifdef INCLUDE_GENERATED_DECLARATIONS\n',
|
||||||
'# include "{0}.generated.h"\n'.format(os.path.relpath(fname, relname)),
|
'# include "{0}.generated.h"\n'.format(
|
||||||
|
os.path.relpath(fname, relname)),
|
||||||
'#endif\n',
|
'#endif\n',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
13
src/clint.py
13
src/clint.py
@@ -2610,9 +2610,13 @@ def CheckBraces(filename, clean_lines, linenum, error):
|
|||||||
'Brace starting function body must be placed on its own line')
|
'Brace starting function body must be placed on its own line')
|
||||||
else:
|
else:
|
||||||
func_start_linenum = end_linenum + 1
|
func_start_linenum = end_linenum + 1
|
||||||
while not clean_lines.lines[func_start_linenum] == '{':
|
while not clean_lines.lines[func_start_linenum] == "{":
|
||||||
attrline = Match(r'^((?!# *define).*?)(?:FUNC_ATTR|FUNC_API|REAL_FATTR)_\w+(?:\(\d+(, \d+)*\))?',
|
attrline = Match(
|
||||||
clean_lines.lines[func_start_linenum])
|
r'^((?!# *define).*?)'
|
||||||
|
r'(?:FUNC_ATTR|FUNC_API|REAL_FATTR)_\w+'
|
||||||
|
r'(?:\(\d+(, \d+)*\))?',
|
||||||
|
clean_lines.lines[func_start_linenum],
|
||||||
|
)
|
||||||
if attrline:
|
if attrline:
|
||||||
if len(attrline.group(1)) != 2:
|
if len(attrline.group(1)) != 2:
|
||||||
error(filename, func_start_linenum,
|
error(filename, func_start_linenum,
|
||||||
@@ -3182,7 +3186,8 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension,
|
|||||||
r'|li_(?:next|prev|tv))\b', line)
|
r'|li_(?:next|prev|tv))\b', line)
|
||||||
if match:
|
if match:
|
||||||
error(filename, linenum, 'runtime/deprecated', 4,
|
error(filename, linenum, 'runtime/deprecated', 4,
|
||||||
'Accessing list_T internals directly is prohibited (hint: see commit d46e37cb4c71)')
|
'Accessing list_T internals directly is prohibited '
|
||||||
|
'(hint: see commit d46e37cb4c71)')
|
||||||
|
|
||||||
# Check for suspicious usage of "if" like
|
# Check for suspicious usage of "if" like
|
||||||
# } if (a == b) {
|
# } if (a == b) {
|
||||||
|
@@ -8,6 +8,7 @@ import locale
|
|||||||
import io
|
import io
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def set_output_encoding(enc=None):
|
def set_output_encoding(enc=None):
|
||||||
"""Set the encoding of stdout and stderr
|
"""Set the encoding of stdout and stderr
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ def set_output_encoding(enc=None):
|
|||||||
writer = io.open(fo.fileno(), mode='w', newline='', **kw)
|
writer = io.open(fo.fileno(), mode='w', newline='', **kw)
|
||||||
write = writer.write # save the original write() function
|
write = writer.write # save the original write() function
|
||||||
enc = locale.getpreferredencoding()
|
enc = locale.getpreferredencoding()
|
||||||
|
|
||||||
def convwrite(s):
|
def convwrite(s):
|
||||||
if isinstance(s, bytes):
|
if isinstance(s, bytes):
|
||||||
write(s.decode(enc)) # convert to unistr
|
write(s.decode(enc)) # convert to unistr
|
||||||
|
Reference in New Issue
Block a user