]> Savannah Git Hosting - gnulib.git/commit
gnulib-tool.py: Fix section extraction from module descriptions.
authorBruno Haible <bruno@clisp.org>
Sun, 7 Aug 2022 20:53:32 +0000 (22:53 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 7 Aug 2022 21:04:30 +0000 (23:04 +0200)
commit81b8c4d5565dbbea10eb3561063d2e8da52148d7
tree2e1054c688f7d41bf10a9ea2527f9438b1979e74
parent586000e597d4ef7cba8de869a15ad5c922a2010c
gnulib-tool.py: Fix section extraction from module descriptions.

The code with   self.content.split(section)[-1]
was broken because it recognizes an indented section label.
Similar code with   ('\n' + self.content).split('\n' + section)[-1]
would still be broken because it recognizes an indented section label
in the first line of the file.
The code with   section_label_regex
was broken because sometimes it returns the second-to-last section with
the given label, not the last one.
Also, whitespace after the colon was not ignored.

* pygnulib/GLModuleSystem.py (GLModule.__init__): Dissect the module
description's contents immediately, once only, in a reliable way.
(GLModule.getDescription, GLModule.getComment): Simplify.
(GLModule.getStatus): Simplify. Return a string.
(GLModule.getStatuses): New function. Return a list.
(GLModule.getNotice, GLModule.getApplicability, GLModule.getFiles,
GLModule.getDependencies, GLModules.getAutoconfSnippet_Early,
GLModules.getAutoconfSnippet, GLModule.getAutomakeSnippet_Conditional,
GLModule.getInclude, GLModule.getLink, GLModule.getLicense_Raw):
Simplify.
(GLModule.getLicense): Remove whitespace after calling getLicense_Raw.
(GLModule.getMaintainer): Simplify.
(GLModuleTable.transitive_closure): Call getStatuses() instead of
getStatus().
* pygnulib/GLEmiter.py: Likewise.
* gnulib-tool.py (main): For --extract-description, --extract-comment,
--extract-status, --extract-notice, --extract-autoconf-snippet,
--extract-automake-snippet, --extract-include-directive,
--extract-link-directive, --extract-maintainer, don't add an extra
newline after the snippet.
ChangeLog
gnulib-tool.py
gnulib-tool.py.TODO
pygnulib/GLEmiter.py
pygnulib/GLModuleSystem.py