2022-08-07 Bruno Haible <bruno@clisp.org>
+ gnulib-tool.py: Fix some regex uses.
+ * pygnulib/GLModuleSystem.py (GLModuleTable.transitive_closure): Match
+ the regex against all lines of the snippet, not only the first line.
+ * pygnulib/GLEmiter.py (GLEmiter.autoconfSnippet): Likewise.
+
gnulib-tool.py: Make regex uses more straightforward.
* pygnulib/constants.py: Don't use the "minimal matching" *? construct
when it makes no difference (because we're matching a single line only
else:
# Don't indent AM_GNU_GETTEXT_VERSION line, as that confuses
# autopoint through at least GNU gettext version 0.18.2.
- snippet = re.compile('^ *AM_GNU_GETTEXT_VERSION').sub('AM_GNU_GETTEXT_VERSION', snippet)
+ snippet = re.compile('^ *AM_GNU_GETTEXT_VERSION', re.M).sub('AM_GNU_GETTEXT_VERSION', snippet)
emit += snippet
if str(module) == 'alloca' and libtool and not disable_libtool:
emit += 'changequote(,)dnl\n'
if self.config['conddeps']:
automake_snippet = \
module.getAutomakeSnippet_Conditional()
- pattern = re.compile('^if')
+ pattern = re.compile('^if', re.M)
if not pattern.findall(automake_snippet):
self.addUnconditional(module)
conditional = self.isConditional(module)