>From 6a795cb6b5c9f2b42058f444c61291f751c356e2 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 7 Aug 2022 13:49:49 +0200 Subject: [PATCH 09/19] gnulib-tool.py: Fix some regexes. * pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Use an equivalent regex as gnulib-tool. * pygnulib/GLTestDir.py (GLTestDir.execute): Likewise. --- ChangeLog | 5 +++++ pygnulib/GLEmiter.py | 2 +- pygnulib/GLTestDir.py | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a44504ae20..b052583c01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2022-08-07 Bruno Haible + gnulib-tool.py: Fix some regexes. + * pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Use an equivalent + regex as gnulib-tool. + * pygnulib/GLTestDir.py (GLTestDir.execute): Likewise. + 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. diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py index 9aa638d693..e0164ed7cc 100644 --- a/pygnulib/GLEmiter.py +++ b/pygnulib/GLEmiter.py @@ -801,7 +801,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [ # First test if allsnippets already specify an installation location. insnippets = False inmakefile = False - regex = '^[a-zA-Z0-9_]*_%sLIBRARIES *\\+{0,1}= *%s.%s' % (perhapsLT, libname, libext) + regex = '^[a-zA-Z0-9_]*_%sLIBRARIES *\\+{0,1}= *%s\\.%s' % (perhapsLT, libname, libext) pattern = re.compile(regex, re.M) insnippets = bool(pattern.findall(allsnippets)) # Then test if $sourcebase/Makefile.am (if it exists) specifies it. diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py index f8d9910ab7..9a3fde66ea 100644 --- a/pygnulib/GLTestDir.py +++ b/pygnulib/GLTestDir.py @@ -461,7 +461,7 @@ class GLTestDir(object): for line in snippet.split('\n') if line.strip() ] snippet = '\n'.join(lines) - pattern = re.compile('AC_REQUIRE\\(\\[([^()].*)\\]\\)', re.M) + pattern = re.compile('AC_REQUIRE\\(\\[([^()]*)\\]\\)', re.M) snippet = pattern.sub('\\1', snippet) snippet = snippet.strip() snippets += [snippet] @@ -578,7 +578,7 @@ class GLTestDir(object): for line in snippet.split('\n') if line.strip() ] snippet = '\n'.join(lines) - pattern = re.compile('AC_REQUIRE\\(\\[([^()].*)\\]\\)', re.M) + pattern = re.compile('AC_REQUIRE\\(\\[([^()]*)\\]\\)', re.M) snippet = pattern.sub('\\1', snippet) snippet = snippet.strip() snippets += [snippet] -- 2.34.1