From 81b8c4d5565dbbea10eb3561063d2e8da52148d7 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 7 Aug 2022 22:53:32 +0200 Subject: 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. --- gnulib-tool.py.TODO | 1 - 1 file changed, 1 deletion(-) (limited to 'gnulib-tool.py.TODO') diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO index a46da5e2ad..9efcda510d 100644 --- a/gnulib-tool.py.TODO +++ b/gnulib-tool.py.TODO @@ -37,7 +37,6 @@ Implement the options: Remove exit() in GLImport.py. Optimize: - - GLModuleSystem: Parse each module description only once. - os.chdir around subprocess creation -> cwd=... argument instead. -------------------------------------------------------------------------------- -- cgit v1.2.1