]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Filter out dependencies that cannot be found.
authorCollin Funk <collin.funk1@gmail.com>
Sun, 12 May 2024 04:45:12 +0000 (21:45 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Sun, 12 May 2024 04:45:12 +0000 (21:45 -0700)
Reported by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00136.html>.

* pygnulib/GLModuleSystem.py (GLModule.getDependenciesWithConditions):
Reorder conditionals to avoid duplicate checks. Filter out None from the
gathered dependencies when gathering module dependencies. Let
GLModuleSystem.find() warn instead of crashing.

ChangeLog
pygnulib/GLModuleSystem.py

index a159f518dcadd7a2da421bfe769b705a10aaebbf..6154ef2bc87c86e7e363563781b631f4e92331ba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-05-11  Collin Funk  <collin.funk1@gmail.com>
+
+       gnulib-tool.py: Filter out dependencies that cannot be found.
+       Reported by Paul Eggert in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00136.html>.
+       * pygnulib/GLModuleSystem.py (GLModule.getDependenciesWithConditions):
+       Reorder conditionals to avoid duplicate checks. Filter out None from the
+       gathered dependencies when gathering module dependencies. Let
+       GLModuleSystem.find() warn instead of crashing.
+
 2024-05-11  Collin Funk  <collin.funk1@gmail.com>
 
        execinfo: Add tests.
index b25779d62edb0bf0d9dcdcf12d75120b787d65ce..872961ba91c4e10789a8991743da4ed5064b68e7 100644 (file)
@@ -538,17 +538,18 @@ class GLModule:
             result = []
             for line in lines:
                 match = pattern.search(line)
-                if match:
-                    module = line[0 : match.start()]
+                if not match:
+                    module_name = line
+                    condition = None
+                else:
+                    module_name = line[0 : match.start()]
                     condition = line[match.end() :]
                     condition = subend(']', '', condition)
-                else:
-                    module = line
-                    condition = None
-                if module != '':
                     if condition == 'true':
                         condition = None
-                    result.append(tuple([self.modulesystem.find(module), condition]))
+                module = self.modulesystem.find(module_name)
+                if module is not None:
+                    result.append((module, condition))
             self.cache['dependenciesWithCond'] = result
         return self.cache['dependenciesWithCond']