From 4bdc4f1708b6dbf87f80761287e478de3b0c5200 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 24 Mar 2024 12:06:50 +0100 Subject: [PATCH] gnulib-tool.py: Fix output of notices. * pygnulib/GLTestDir.py (GLTestDir.execute): Don't print notices if the verbosity is < -1. Strip newlines from each notice. * pygnulib/GLImport.py (GLImport.prepare): Don't print notices if the verbosity is < -1. Strip only newlines, not spaces. --- ChangeLog | 8 ++++++++ pygnulib/GLImport.py | 16 ++++++++-------- pygnulib/GLTestDir.py | 30 ++++++++++++++++-------------- 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6f2c22b9b6..305da4bbbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-03-24 Bruno Haible + + gnulib-tool.py: Fix output of notices. + * pygnulib/GLTestDir.py (GLTestDir.execute): Don't print notices if the + verbosity is < -1. Strip newlines from each notice. + * pygnulib/GLImport.py (GLImport.prepare): Don't print notices if the + verbosity is < -1. Strip only newlines, not spaces. + 2024-03-23 Bruno Haible gnulib-tool.py: Fix the modules indentation in --create-testdir' output. diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py index 85ec0a61db..d417137df6 100644 --- a/pygnulib/GLImport.py +++ b/pygnulib/GLImport.py @@ -939,14 +939,14 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix raise GLError(11, listing) # Print notices from modules. - for module in main_modules: - notice = module.getNotice() - notice = notice.strip() - if notice: - print('Notice from module %s:' % str(module)) - pattern = re.compile('^(.*?)$', re.S | re.M) - notice = pattern.sub(' \\1', notice) - print(notice) + if verbose >= -1: + for module in main_modules: + notice = module.getNotice().strip('\n') + if notice: + print('Notice from module %s:' % str(module)) + pattern = re.compile('^(.*?)$', re.S | re.M) + notice = pattern.sub(' \\1', notice) + print(notice) # Determine script to apply to imported library files. sed_transform_lib_file = '' diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py index c618241bc9..d6d6a9f954 100644 --- a/pygnulib/GLTestDir.py +++ b/pygnulib/GLTestDir.py @@ -312,21 +312,23 @@ class GLTestDir(object): # Show banner notice of every module. if single_configure: - for module in main_modules: - notice = module.getNotice() - if notice: - print('Notice from module %s:' % str(module)) - pattern = re.compile('^(.*)$', re.M) - notice = pattern.sub(' \\1', notice) - print(notice) + if verbose >= -1: + for module in main_modules: + notice = module.getNotice().strip('\n') + if notice: + print('Notice from module %s:' % str(module)) + pattern = re.compile('^(.*)$', re.M) + notice = pattern.sub(' \\1', notice) + print(notice) else: # if not single_configure - for module in modules: - notice = module.getNotice() - if notice: - print('Notice from module %s:' % str(module)) - pattern = re.compile('^(.*)$', re.M) - notice = pattern.sub(' \\1', notice) - print(notice) + if verbose >= -1: + for module in modules: + notice = module.getNotice().strip('\n') + if notice: + print('Notice from module %s:' % str(module)) + pattern = re.compile('^(.*)$', re.M) + notice = pattern.sub(' \\1', notice) + print(notice) # Determine final file list. if single_configure: -- 2.39.5