]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Fix exception during --update with changed macro-prefix.
authorBruno Haible <bruno@clisp.org>
Tue, 15 Apr 2025 20:21:04 +0000 (22:21 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 3 May 2025 14:01:16 +0000 (16:01 +0200)
* pygnulib/GLImport.py (GLImport.__init__): Support the case that the
expected ${macro_prefix}_FILE_LIST definition was not found.

ChangeLog
pygnulib/GLImport.py

index 081d60bbc8cdff36a879e4258cf5dda841ce53ab..03a8c70902329eac91535de4521ff4900f730d24 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-04-15  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        trim tests: Avoid test failures on macOS 15.4.
index da4f184a8831f1d452036c9f1cf0a9ffaeef88aa..3d454a0938573c1ad15bad77d43c21feffbcfa69 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2024 Free Software Foundation, Inc.
+# Copyright (C) 2002-2025 Free Software Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -228,7 +228,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