diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-01-25 01:47:39 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-01-25 01:47:39 -0500 |
commit | a038fa80f5a4f6954fe3c0b39c8602c78a7898a2 (patch) | |
tree | dfe8506c7a56064b115416122f965a6abf9b4afa /tools/regenerate_docs.py | |
parent | a0d28e850e3f112d7161b367261295796dc04858 (diff) | |
download | meson-a038fa80f5a4f6954fe3c0b39c8602c78a7898a2.zip meson-a038fa80f5a4f6954fe3c0b39c8602c78a7898a2.tar.gz meson-a038fa80f5a4f6954fe3c0b39c8602c78a7898a2.tar.bz2 |
docs: fix command help regenerator on python 3.10
In https://github.com/python/cpython/pull/23858 the section header for
option flags was changed from "optional arguments" to "options" with the
rationale that they are not (necessarily) at all optional, while GNU
coreutils calls them options.
In fact, POSIX calls them options (-o) and option-arguments (-o val) and
operands ("positional arguments") so it is indeed a mess, but argparse
is not yet perfect.
Still, fix the documentation generator for now so that it is compatible
with python 3.10 as well.
Fixes traceback on building the docs with:
```
[1/4] Generating gen_docs with a custom command
FAILED: gen_docs.stamp
/home/eschwartz/git/meson/docs/../tools/regenerate_docs.py --output-dir /home/eschwartz/git/meson/docs/builddir --dummy-output-file gen_docs.stamp
Traceback (most recent call last):
File "/home/eschwartz/git/meson/docs/../tools/regenerate_docs.py", line 160, in <module>
regenerate_docs(output_dir=args.output_dir,
File "/home/eschwartz/git/meson/docs/../tools/regenerate_docs.py", line 146, in regenerate_docs
generate_hotdoc_includes(root_dir, output_dir)
File "/home/eschwartz/git/meson/docs/../tools/regenerate_docs.py", line 113, in generate_hotdoc_includes
cmd_data = get_commands_data(root_dir)
File "/home/eschwartz/git/meson/docs/../tools/regenerate_docs.py", line 106, in get_commands_data
cmd_data[cmd] = parse_cmd(cmd_output)
File "/home/eschwartz/git/meson/docs/../tools/regenerate_docs.py", line 65, in parse_cmd
assert arguments_start
AssertionError
```
Diffstat (limited to 'tools/regenerate_docs.py')
-rwxr-xr-x | tools/regenerate_docs.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/regenerate_docs.py b/tools/regenerate_docs.py index 2029314..887db9c 100755 --- a/tools/regenerate_docs.py +++ b/tools/regenerate_docs.py @@ -40,7 +40,7 @@ def _get_meson_output(root_dir: Path, args: T.List) -> str: def get_commands_data(root_dir: Path) -> T.Dict[str, T.Any]: usage_start_pattern = re.compile(r'^usage: ', re.MULTILINE) positional_start_pattern = re.compile(r'^positional arguments:[\t ]*[\r\n]+', re.MULTILINE) - options_start_pattern = re.compile(r'^optional arguments:[\t ]*[\r\n]+', re.MULTILINE) + options_start_pattern = re.compile(r'^(optional arguments|options):[\t ]*[\r\n]+', re.MULTILINE) commands_start_pattern = re.compile(r'^[A-Za-z ]*[Cc]ommands:[\t ]*[\r\n]+', re.MULTILINE) def get_next_start(iterators: T.Sequence[T.Any], end: T.Optional[int]) -> int: |