In gnulib-tool.py, error 3 is "configure file does not exist", not "module <module> doesn't exist".
2024-07-28 Bruno Haible <br...@clisp.org> gnulib-tool.py: Fix an exception message. * pygnulib/GLModuleSystem.py (GLModuleSystem.find): Raise error 23, not 3. * pygnulib/GLError.py: Provide an error message for error 23. * pygnulib/main.py: Likewise. diff --git a/pygnulib/GLError.py b/pygnulib/GLError.py index a6d7d8437d..15e24a8bf2 100644 --- a/pygnulib/GLError.py +++ b/pygnulib/GLError.py @@ -56,6 +56,7 @@ def __init__(self, errno: int, errinfo: Any = None) -> None: 20: could not patch test-driver script 21: Option --automake-subdir is only supported if the definition of AUTOMAKE_OPTIONS in Makefile.am contains 'subdir-objects'. 22: not overwriting destination directory: <directory> + 23: module <module> doesn't exist errinfo: additional information''' self.errno = errno self.errinfo = errinfo @@ -110,5 +111,7 @@ def __repr__(self) -> str: 'Makefile.am contains \'subdir-objects\'.') elif errno == 22: message = 'not overwriting destination directory: %s' % repr(errinfo) + elif errno == 23: + message = "module %s doesn't exist" % repr(errinfo) self.message = '[Errno %d] %s' % (errno, message) return self.message diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py index 02dacfcf9f..0eb875a499 100644 --- a/pygnulib/GLModuleSystem.py +++ b/pygnulib/GLModuleSystem.py @@ -113,7 +113,7 @@ def find(self, module_name: str) -> GLModule | None: return result else: # if not self.exists(module) if self.config['errors']: - raise GLError(3, module_name) + raise GLError(23, module_name) else: # if not self.config['errors'] sys.stderr.write('gnulib-tool: warning: ') sys.stderr.write("module %s doesn't exist\n" % module_name) diff --git a/pygnulib/main.py b/pygnulib/main.py index c1c2cd2c1e..9767f38676 100644 --- a/pygnulib/main.py +++ b/pygnulib/main.py @@ -1457,6 +1457,8 @@ def main_with_exception_handling() -> None: 'Makefile.am contains \'subdir-objects\'.') elif errno == 22: message += 'not overwriting destination directory: %s' % errinfo + elif errno == 23: + message += "module %s doesn't exist" % errinfo message += '\n%s: *** Stop.\n' % APP['name'] sys.stderr.write(message) sys.exit(1)