From f9ff066e21adcd12de167ceea5a4c64a1f012a6b Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sat, 20 Apr 2024 20:29:44 -0700 Subject: [PATCH] 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. --- ChangeLog | 8 ++++++++ pygnulib/GLModuleSystem.py | 4 +++- pygnulib/GLTestDir.py | 9 ++++++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ede5219a3..6523c89b87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-04-20 Collin Funk + + 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-20 Collin Funk gnulib-tool.py: Update type hints and docstring. diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py index 301592a79d..daee7b403e 100644 --- a/pygnulib/GLModuleSystem.py +++ b/pygnulib/GLModuleSystem.py @@ -88,7 +88,9 @@ def exists(self, module: str) -> bool: return result def find(self, module: str) -> GLModule | None: - '''Find the given module.''' + '''Return the GLModule object given the module name. If the module + description file could not be found None is returned. + - module, The name of the module.''' if type(module) is not str: raise TypeError('module must be a string, not %s' % type(module).__name__) diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py index 8bbef2a311..9673a5bd26 100644 --- a/pygnulib/GLTestDir.py +++ b/pygnulib/GLTestDir.py @@ -185,9 +185,12 @@ def execute(self) -> None: '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. -- 2.44.0