]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Don't fail when given a bad module name.
authorCollin Funk <collin.funk1@gmail.com>
Sun, 21 Apr 2024 03:29:44 +0000 (20:29 -0700)
committerBruno Haible <bruno@clisp.org>
Sun, 21 Apr 2024 11:27:05 +0000 (13:27 +0200)
* pygnulib/GLTestDir.py (GLTestDir.execute): Don't include None in the
list of GLModule objects.
* pygnulib/GLModuleSystem.py (GLModuleSystem.find): Document the meaning
of the None return.

ChangeLog
pygnulib/GLModuleSystem.py
pygnulib/GLTestDir.py

index 930743d67db937e9064c714c16af7db3c7fcc1c4..c57a2392a8b632e15b79061e76125f23a14c1e73 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-04-21  Collin Funk  <collin.funk1@gmail.com>
+
+       gnulib-tool.py: Don't fail when given a bad module name.
+       * pygnulib/GLTestDir.py (GLTestDir.execute): Don't include None in the
+       list of GLModule objects.
+       * pygnulib/GLModuleSystem.py (GLModuleSystem.find): Document the meaning
+       of the None return.
+
 2024-04-21  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Update type hints and docstring.
index 301592a79d22c005474951f1bce5f4540af251ae..c28f2ddd73448394ca4df459ebe9c40320f0237c 100644 (file)
@@ -88,7 +88,9 @@ class GLModuleSystem:
         return result
 
     def find(self, module: str) -> GLModule | None:
-        '''Find the given module.'''
+        '''Return the GLModule object given the module name,
+        or None if the module description file with that name does not exist.
+        - module, The name of the module.'''
         if type(module) is not str:
             raise TypeError('module must be a string, not %s'
                             % type(module).__name__)
index 8bbef2a311558c12a212dfeb112fa95f7bce3124..9673a5bd26fb7ed3e890f319993a41cb52892334 100644 (file)
@@ -185,9 +185,12 @@ class GLTestDir:
                                                    'mountlist', 'lib-ignore']]
 
         # Canonicalize the list of specified modules.
-        specified_modules = sorted(set(specified_modules))
-        specified_modules = [ self.modulesystem.find(m)
-                              for m in specified_modules ]
+        modules = set()
+        for name in specified_modules:
+            module = self.modulesystem.find(name)
+            if module is not None:
+                modules.add(module)
+        specified_modules = sorted(modules)
 
         # Test modules which invoke AC_CONFIG_FILES cannot be used with
         # --with-tests --single-configure. Avoid them.