From 80949983d7ebf1f26c9ac96badddb9db276847bb Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Wed, 5 Jun 2024 20:21:51 -0700 Subject: [PATCH] gnulib-tool.py: Don't perform unnecessary configure.ac scanning. * pygnulib/GLImport.py (GLImport.execute): Use re.search() instead of re.findall() since we only care about finding one match. Remove unnecessary bool() calls. --- ChangeLog | 7 +++++++ pygnulib/GLImport.py | 6 ++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index eec970671b..3c932f4f73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-06-05 Collin Funk + + gnulib-tool.py: Don't perform unnecessary configure.ac scanning. + * pygnulib/GLImport.py (GLImport.execute): Use re.search() instead of + re.findall() since we only care about finding one match. Remove + unnecessary bool() calls. + 2024-06-05 Bruno Haible setenv: On native Windows, don't modify _environ directly. diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py index e67cbbe5a2..df541a8b77 100644 --- a/pygnulib/GLImport.py +++ b/pygnulib/GLImport.py @@ -1392,10 +1392,8 @@ in _a_LDFLAGS or _la_LDFLAGS when linking a library.''') # Detect position_early_after. with open(configure_ac, mode='r', newline='\n', encoding='utf-8') as file: data = file.read() - match_result1 = \ - bool(re.compile(r'^ *AC_PROG_CC_STDC', re.M).findall(data)) - match_result2 = \ - bool(re.compile(r'^ *AC_PROG_CC_C99', re.M).findall(data)) + match_result1 = re.compile(r'^ *AC_PROG_CC_STDC', re.MULTILINE).search(data) + match_result2 = re.compile(r'^ *AC_PROG_CC_C99', re.MULTILINE).search(data) if match_result1: print(' - replace AC_PROG_CC_STDC with AC_PROG_CC in %s,' % (configure_ac)) position_early_after = 'AC_PROG_CC_STDC' -- 2.39.5