>From 65301e0739f8c86cf96403d6426551df3c3f3ac3 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 3 Aug 2022 15:51:35 +0200 Subject: [PATCH 07/12] gnulib-tool.py: Fix unjustified "incompatible license" warnings. * pygnulib/GLTestDir.py (GLTestDir.execute): Don't emit a warning when the dependency module has a license such as "public domain" or "unlimited". --- ChangeLog | 5 +++++ gnulib-tool.py | 2 +- pygnulib/GLTestDir.py | 35 +++++++++++++++++++---------------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f88a72f90..c334581d4b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2022-08-03 Bruno Haible + gnulib-tool.py: Fix unjustified "incompatible license" warnings. + * pygnulib/GLTestDir.py (GLTestDir.execute): Don't emit a warning when + the dependency module has a license such as "public domain" or + "unlimited". + gnulib-tool.py: Follow gnulib-tool changes, part 22. Follow gnulib-tool change 2016-10-15 Bruno Haible diff --git a/gnulib-tool.py b/gnulib-tool.py index 2ac522aa05..0e5914a402 100755 --- a/gnulib-tool.py +++ b/gnulib-tool.py @@ -24,7 +24,7 @@ # - Line length is not limited to 79 characters. # - Line breaking before or after binary operators? Better before, like in GNU. # You can use this command to check the style: -# $ pycodestyle --max-line-length=128 --ignore=E265,W503,E241,E711,E712,E201,E202 gnulib-tool.py pygnulib/*.py +# $ pycodestyle --max-line-length=136 --ignore=E265,W503,E241,E711,E712,E201,E202 gnulib-tool.py pygnulib/*.py #=============================================================================== diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py index f0a1a43883..83555faad7 100644 --- a/pygnulib/GLTestDir.py +++ b/pygnulib/GLTestDir.py @@ -184,25 +184,28 @@ class GLTestDir(object): self.config.disableTestFlag(TESTS['tests']) for requested_module in base_modules: requested_licence = requested_module.getLicense() - # Here we use self.moduletable.transitive_closure([module]), not just - # module.getDependencies, so that we also detect weird situations like - # an LGPL module which depends on a GPLed build tool module which depends - # on a GPL module. if requested_licence != 'GPL': - modules = self.moduletable.transitive_closure( - [requested_module]) + # Here we use self.moduletable.transitive_closure([module]), not + # just module.getDependencies, so that we also detect weird + # situations like an LGPL module which depends on a GPLed build + # tool module which depends on a GPL module. + modules = self.moduletable.transitive_closure([requested_module]) for module in modules: license = module.getLicense() - errormsg = 'module %s depends on a module ' % requested_module - errormsg += 'with an incompatible license: %s\n' % module - if requested_licence == 'GPLv2+': - if license not in ['GPLv2+', 'LGPLv2+']: - sys.stderr.write(errormsg) - elif requested_licence in ['LGPL']: - if license not in ['LGPL', 'LGPLv2+']: - sys.stderr.write(errormsg) - elif requested_licence in ['LGPLv2+']: - if license not in ['LGPLv2+']: + if license not in ['GPLv2+ build tool', 'GPLed build tool', + 'public domain', 'unlimited', 'unmodifiable license text']: + incompatible = False + if requested_licence == 'GPLv2+': + if license not in ['GPLv2+', 'LGPLv2+']: + incompatible = True + elif requested_licence in ['LGPL']: + if license not in ['LGPL', 'LGPLv2+']: + incompatible = True + elif requested_licence in ['LGPLv2+']: + if license not in ['LGPLv2+']: + incompatible = True + if incompatible: + errormsg = 'module %s depends on a module with an incompatible license: %s\n' % (requested_module, module) sys.stderr.write(errormsg) self.config.setTestFlags(saved_testflags) -- 2.34.1