From 1372dc1631053fa72bbf5755cbc89f63cbffec33 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sun, 2 Jun 2024 05:29:33 -0700 Subject: [PATCH] gnulib-tool.py: Fix regular expression (regr. today). * pygnulib/main.py (main) [import]: Match all characters until '#' or end of line, whichever comes first. --- ChangeLog | 4 ++++ pygnulib/main.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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() -- 2.39.5