+2024-06-02 Collin Funk <collin.funk1@gmail.com>
+
+ 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
+ none is found.
+
2024-05-31 Bruno Haible <bruno@clisp.org>
windows-once: Improve comments.
if os.path.isfile(filepath):
with open(filepath, mode='r', newline='\n', encoding='utf-8') as file:
data = file.read()
- data = data.split('ACLOCAL_AMFLAGS')[1]
- data = data[data.find('=') + 1 : data.find('\n')]
- aclocal_amflags = data.split()
+ pattern = re.compile(r'^ACLOCAL_AMFLAGS[\t ]*=[\t ]*([^#]+?)$', re.MULTILINE)
+ match = re.search(pattern, data)
+ if match:
+ aclocal_amflags = match.group(1).split()
+ else:
+ aclocal_amflags = []
for aclocal_amflag in aclocal_amflags:
if dirisnext:
# Ignore absolute directory pathnames, like /usr/local/share/aclocal.