]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Fix regular expression (regr. today).
authorCollin Funk <collin.funk1@gmail.com>
Sun, 2 Jun 2024 12:29:33 +0000 (05:29 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Sun, 2 Jun 2024 12:29:33 +0000 (05:29 -0700)
* pygnulib/main.py (main) [import]: Match all characters until '#' or
end of line, whichever comes first.

ChangeLog
pygnulib/main.py

index 3a982c49887629f42f27024dc4b75dcce860bf90..f076c168b0d62eed924504ebe3bb865b35ec8dcd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2024-06-02  Collin Funk  <collin.funk1@gmail.com>
 
+       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
index 616713585860bc3a4d273f226363db71101e8ad4..c1c2cd2c1e6e41b4bb836a759b7613d78e3e14ad 100644 (file)
@@ -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()