]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Fix some regex uses.
authorBruno Haible <bruno@clisp.org>
Sun, 7 Aug 2022 11:46:15 +0000 (13:46 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 7 Aug 2022 21:04:11 +0000 (23:04 +0200)
* 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.

ChangeLog
pygnulib/GLEmiter.py
pygnulib/GLModuleSystem.py

index f50e756d600794688383df1638bf584059947f13..a44504ae20887a1bcbf0a44b0e25cd6c26762586 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 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
index 02fa6654e725e65e6fb91619f03cf045f05b0e3d..9aa638d693625b39906026ccbddaeb38f8561395 100644 (file)
@@ -174,7 +174,7 @@ class GLEmiter(object):
             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'
index e1b62ec56cdde13348f855488ca346ff6c5d75f2..75316515b8ff29c06036e76b82f7a225452e8124 100644 (file)
@@ -1041,7 +1041,7 @@ class GLModuleTable(object):
                     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)