]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Make regex uses more straightforward.
authorBruno Haible <bruno@clisp.org>
Sun, 7 Aug 2022 11:11:07 +0000 (13:11 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 7 Aug 2022 21:04:04 +0000 (23:04 +0200)
* pygnulib/GLEmiter.py: Don't use flag re.S on regular expressions on
regular expressions with no '.'.
* pygnulib/GLImport.py: Likewise.

ChangeLog
pygnulib/GLEmiter.py
pygnulib/GLImport.py

index 5396f935a357db5f78aee4a76e6dd1239e91e309..bcaedf98e402c52441e1d1576f8e2ba015044f7e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-08-07  Bruno Haible  <bruno@clisp.org>
+
+       gnulib-tool.py: Make regex uses more straightforward.
+       * pygnulib/GLEmiter.py: Don't use flag re.S on regular expressions on
+       regular expressions with no '.'.
+       * pygnulib/GLImport.py: Likewise.
+
 2022-08-06  Bruno Haible  <bruno@clisp.org>
 
        gnulib-tool: In the VC files messages, omit the destination directory.
index b6c31fa603d21f04ea1a4c3a719fff8068985262..f85ef30d52442e3d5788e079a392795b937e652a 100644 (file)
@@ -750,7 +750,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
             #  * https://debbugs.gnu.org/10997
             #  * https://debbugs.gnu.org/11030
             # So we need this workaround.
-            pattern = re.compile('^pkgdata_DATA *\\+=', re.S | re.M)
+            pattern = re.compile('^pkgdata_DATA *\\+=', re.M)
             if pattern.findall(allsnippets):
                 emit += 'pkgdata_DATA =\n'
             emit += 'EXTRA_DIST =\n'
@@ -1032,7 +1032,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
         #  * https://debbugs.gnu.org/10997
         #  * https://debbugs.gnu.org/11030
         # So we need this workaround.
-        pattern = re.compile('^pkgdata_DATA *\\+=', re.S | re.M)
+        pattern = re.compile('^pkgdata_DATA *\\+=', re.M)
         if bool(pattern.findall(main_snippets)) or bool(pattern.findall(longrun_snippets)):
             emit += 'pkgdata_DATA =\n'
 
index 935a6625938d5e67f64eccf9515c8d8c0f0f1b25..7a6312ec399f7e6565a96446db182b123608e5a2 100644 (file)
@@ -100,7 +100,7 @@ class GLImport(object):
         if match:
             result = cleaner(match)[0]
             self.cache.setAuxDir(joinpath(self.config['destdir'], result))
-        pattern = re.compile(r'A[CM]_PROG_LIBTOOL', re.S | re.M)
+        pattern = re.compile(r'A[CM]_PROG_LIBTOOL', re.M)
         guessed_libtool = bool(pattern.findall(data))
         if self.config['auxdir'] == None:
             self.config.setAuxDir(self.cache['auxdir'])
@@ -1439,9 +1439,9 @@ in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library.''')
         with codecs.open(configure_ac, 'rb', 'UTF-8') as file:
             data = file.read()
         match_result1 = \
-            bool(re.compile('^ *AC_PROG_CC_STDC', re.S | re.M).findall(data))
+            bool(re.compile('^ *AC_PROG_CC_STDC', re.M).findall(data))
         match_result2 = \
-            bool(re.compile('^ *AC_PROG_CC_C99', re.S | re.M).findall(data))
+            bool(re.compile('^ *AC_PROG_CC_C99', re.M).findall(data))
         if match_result1:
             position_early_after = 'AC_PROG_CC_STDC'
         elif match_result2: