]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Make regex uses more straightforward.
authorBruno Haible <bruno@clisp.org>
Sun, 7 Aug 2022 11:40:07 +0000 (13:40 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 7 Aug 2022 21:04:09 +0000 (23:04 +0200)
* pygnulib/constants.py: Don't use the "minimal matching" *? construct
when it makes no difference (because we're matching a single line only
and flag re.M is not specified).
* pygnulib/GLModuleSystem.py: Likewise.

ChangeLog
pygnulib/GLModuleSystem.py
pygnulib/constants.py

index 0e162e8d0a0d02cf4de433544d0a21a88b6fa1e5..f50e756d600794688383df1638bf584059947f13 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2022-08-07  Bruno Haible  <bruno@clisp.org>
 
+       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
+       and flag re.M is not specified).
+       * pygnulib/GLModuleSystem.py: Likewise.
+
        gnulib-tool.py: Make regex uses more straightforward.
        * pygnulib/GLModuleSystem.py: Don't use flag re.S on regular expressions
        that are meant to match a single line only, and remove the use of the
index afc7a472cf94d5f625ebd0387b28eff7ebe3a9c4..e1b62ec56cdde13348f855488ca346ff6c5d75f2 100644 (file)
@@ -280,7 +280,7 @@ Include:|Link:|License:|Maintainer:)'
         '''GLModule.getName() -> str
 
         Return the name of the module.'''
-        pattern = re.compile(joinpath('modules', '(.*?)$'))
+        pattern = re.compile(joinpath('modules', '(.*)$'))
         result = pattern.findall(self.module)[0]
         return result
 
index 46c0cbc152d21cb47527938ee7c9f502d2526e4e..ba0ebc9942fe74dcaf3136f669ed21e5e2206a1d 100644 (file)
@@ -412,7 +412,7 @@ def filter_filelist(separator, filelist,
     listing = list()
     for filename in filelist:
         if filename.startswith(prefix) and filename.endswith(suffix):
-            pattern = re.compile('^%s(.*?)%s$'
+            pattern = re.compile('^%s(.*)%s$'
                                  % (removed_prefix, removed_suffix))
             result = pattern.sub('%s\\1%s'
                                  % (added_prefix, added_suffix), filename)