From 9d722ddced2e46a06255be8eb24a54015f611af7 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 7 Aug 2022 13:40:07 +0200 Subject: 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. --- pygnulib/GLModuleSystem.py | 2 +- pygnulib/constants.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'pygnulib') diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py index afc7a472cf..e1b62ec56c 100644 --- a/pygnulib/GLModuleSystem.py +++ b/pygnulib/GLModuleSystem.py @@ -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 diff --git a/pygnulib/constants.py b/pygnulib/constants.py index 46c0cbc152..ba0ebc9942 100644 --- a/pygnulib/constants.py +++ b/pygnulib/constants.py @@ -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) -- cgit v1.2.1