From 618538b8e81c4232782bfc108d5d9fbf68b322d4 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 15 Apr 2025 22:21:04 +0200 Subject: [PATCH] gnulib-tool.py: Fix exception during --update with changed macro-prefix. * pygnulib/GLImport.py (GLImport.__init__): Support the case that the expected ${macro_prefix}_FILE_LIST definition was not found. --- ChangeLog | 6 ++++++ pygnulib/GLImport.py | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e07f4b01ca..7d255be3a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2025-04-15 Bruno Haible + + gnulib-tool.py: Fix exception during --update with changed macro-prefix. + * pygnulib/GLImport.py (GLImport.__init__): Support the case that the + expected ${macro_prefix}_FILE_LIST definition was not found. + 2025-04-15 Bruno Haible trim tests: Avoid test failures on macOS 15.4. diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py index 27d8b749ed..9344c8fa9d 100644 --- a/pygnulib/GLImport.py +++ b/pygnulib/GLImport.py @@ -231,7 +231,12 @@ class GLImport: data = file.read() regex = r'AC_DEFUN\(\[%s_FILE_LIST\], \[(.*?)\]\)' % self.cache['macro_prefix'] pattern = re.compile(regex, re.S | re.M) - self.cache.setFiles(pattern.findall(data)[-1].strip().split()) + matches = pattern.findall(data) + if matches: + files = matches[-1].strip().split() + else: + files = [] + self.cache.setFiles(files) # The self.config['localpath'] defaults to the cached one. Recall that # the cached one is relative to self.config['destdir'], whereas the one -- 2.39.5