From: Collin Funk Date: Sun, 2 Jun 2024 12:29:33 +0000 (-0700) Subject: gnulib-tool.py: Fix regular expression (regr. today). X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=1372dc1631053fa72bbf5755cbc89f63cbffec33;p=gnulib.git gnulib-tool.py: Fix regular expression (regr. today). * pygnulib/main.py (main) [import]: Match all characters until '#' or end of line, whichever comes first. --- diff --git a/ChangeLog b/ChangeLog index 3a982c4988..f076c168b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2024-06-02 Collin Funk + gnulib-tool.py: Fix regular expression (regr. today). + * pygnulib/main.py (main) [import]: Match all characters until '#' or + end of line, whichever comes first. + gnulib-tool.py: Fix crash when no ACLOCAL_AMFLAGS is found. * pygnulib/main.py (main) [import]: Use a regular expression to match the ACLOCAL_AMFLAGS Makefile.am variable. Properly handle the case where diff --git a/pygnulib/main.py b/pygnulib/main.py index 6167135858..c1c2cd2c1e 100644 --- a/pygnulib/main.py +++ b/pygnulib/main.py @@ -987,7 +987,7 @@ def main(temp_directory: str) -> None: if os.path.isfile(filepath): with open(filepath, mode='r', newline='\n', encoding='utf-8') as file: data = file.read() - pattern = re.compile(r'^ACLOCAL_AMFLAGS[\t ]*=[\t ]*([^#]+?)$', re.MULTILINE) + pattern = re.compile(r'^ACLOCAL_AMFLAGS[\t ]*=[\t ]*(.+?)[\t ]*(?:#|$)', re.MULTILINE) match = re.search(pattern, data) if match: aclocal_amflags = match.group(1).split()