]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Follow gnulib-tool changes, part 23.
authorBruno Haible <bruno@clisp.org>
Wed, 3 Aug 2022 14:49:15 +0000 (16:49 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 3 Aug 2022 14:50:03 +0000 (16:50 +0200)
Follow gnulib-tool changes
2016-11-11  Bruno Haible  <bruno@clisp.org>
gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
2016-12-02  Nikos Mavrogiannopoulos <nmav@gnutls.org>
gnulib-tool (func_import): Adhere to the license guideline ...
2016-12-02  Daiki Ueno  <ueno@gnu.org>
gnulib-tool (func_import): Relax the regex ...

* gnulib-tool.py: For --lgpl, accept value 3orGPLv2.
* pygnulib/GLInfo.py (GLInfo.usage): Update.
* pygnulib/GLConfig.py (GLConfig.setLGPL): Update argument check.
* pygnulib/GLImport.py (GLImport.__init__, GLImport.gnulib_cache):
Update gl_LGPL handling.
(GLImport.prepare): Update license compatibility checks and license
header rewriting.
* pygnulib/GLTestDir.py (GLTestDir.execute): Update license
compatibility checks. Handle also the licenses GPLv3+, GPL, LGPLv3+.

ChangeLog
gnulib-tool.py
gnulib-tool.py.TODO
pygnulib/GLConfig.py
pygnulib/GLImport.py
pygnulib/GLInfo.py
pygnulib/GLTestDir.py

index c334581d4b15c6845f91bb4e110ce394b0c8c7a5..b0d9b08a6282db1a1509407f0e8ea47521765b83 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 2022-08-03  Bruno Haible  <bruno@clisp.org>
 
+       gnulib-tool.py: Follow gnulib-tool changes, part 23.
+       Follow gnulib-tool changes
+       2016-11-11  Bruno Haible  <bruno@clisp.org>
+       gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
+       2016-12-02  Nikos Mavrogiannopoulos <nmav@gnutls.org>
+       gnulib-tool (func_import): Adhere to the license guideline ...
+       2016-12-02  Daiki Ueno  <ueno@gnu.org>
+       gnulib-tool (func_import): Relax the regex ...
+       * gnulib-tool.py: For --lgpl, accept value 3orGPLv2.
+       * pygnulib/GLInfo.py (GLInfo.usage): Update.
+       * pygnulib/GLConfig.py (GLConfig.setLGPL): Update argument check.
+       * pygnulib/GLImport.py (GLImport.__init__, GLImport.gnulib_cache):
+       Update gl_LGPL handling.
+       (GLImport.prepare): Update license compatibility checks and license
+       header rewriting.
+       * pygnulib/GLTestDir.py (GLTestDir.execute): Update license
+       compatibility checks. Handle also the licenses GPLv3+, GPL, LGPLv3+.
+
        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
index 0e5914a402793918771d5701b1e8da228f9e67c9..0864d0d8c263ba9a16606c11b87ca4f95d307ab1 100755 (executable)
@@ -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=136 --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,E221 gnulib-tool.py pygnulib/*.py
 
 
 #===============================================================================
@@ -330,8 +330,9 @@ def main():
     # lgpl
     parser.add_argument('--lgpl',
                         dest='lgpl',
-                        default=False,
-                        type=int,
+                        default=None,
+                        action='append',
+                        choices=['2', '3orGPLv2', '3'],
                         nargs='?')
     # makefile
     parser.add_argument("--makefile-name",
@@ -545,10 +546,12 @@ def main():
                 elif index == 6:
                     testflags += [constants.TESTS['all-tests']]
     lgpl = cmdargs.lgpl
+    if lgpl != None:
+        lgpl = lgpl[-1]
+        if lgpl == None:
+            lgpl = True
     libtool = cmdargs.libtool
     makefile = cmdargs.makefile
-    if lgpl == None:
-        lgpl = True
     avoids = cmdargs.avoids
     if avoids != None:
         avoids = [ module
index d5030c8231ba09d5a4ff2005c4d5c4120e4bd19d..d6ba01657e5e014a34a42ed55f0eee422960ade8 100644 (file)
@@ -1015,47 +1015,6 @@ Date:   Sun Feb 19 15:15:11 2017 +0100
 
 --------------------------------------------------------------------------------
 
-commit 31a08abd323ebffea3d4fb2d5a66f801fe8b3031
-Author: Daiki Ueno <ueno@gnu.org>
-Date:   Fri Dec 2 17:16:50 2016 +0100
-
-    gnulib-tool: fix the previous change
-
-    * gnulib-tool (func_import): Relax the regex used for "LGPLv3+ or
-    GPLv2" rewriting.
-
-commit 27d1d32a202b6b2115d5c2e287e3f5f1090032e5
-Author: Daiki Ueno <ueno@gnu.org>
-Date:   Fri Dec 2 16:56:11 2016 +0100
-
-    gnulib-tool: fix the previous change
-
-    * gnulib-tool (func_import): Relax the regex for the end marker of
-    original license text.
-
-commit 1aa6e23bd2487a7c3bd07cf693e6d968f74d951a
-Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-Date:   Mon Nov 21 21:15:25 2016 +0100
-
-    gnulib-tool: properly list the LGPL3orGPLv2 license
-
-    * gnulib-tool (func_import): Adhere to the license guideline when
-    rewriting the license text to "LGPLv3+ or GPLv2":
-    https://www.gnu.org/prep/maintain/maintain.html#Licensing-of-GNU-Packages
-
-commit 567bbf7b7b14b31385801b1fee47acfc5b6d2b01
-Author: Bruno Haible <bruno@clisp.org>
-Date:   Sun Nov 13 04:12:26 2016 +0100
-
-    gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license.
-
-    * gnulib-tool (--lgpl): Accept value 3orGPLv2.
-    (func_import): Extend determination of license_incompatibilities.
-    (func_create_testdir): Extend table of license compatibility. Handle
-    also the licenses GPLv3+, GPL, LGPLv3+.
-
---------------------------------------------------------------------------------
-
 commit 9bdf6c8a0cdeb13c12e4b65dee9538c5468dbe1d
 Author: Bruno Haible <bruno@clisp.org>
 Date:   Sun Aug 19 14:06:50 2012 +0200
index dc0cce34903643f1bcf45704ccef4e00a6f501b3..d126b35dbec50f82db654791d7187de09b508b90 100644 (file)
@@ -784,21 +784,21 @@ class GLConfig(object):
     # Define lgpl methods.
     def getLGPL(self):
         '''Check for abort if modules aren't available under the LGPL.
-        Default value is False, which means that lgpl is disabled.'''
+        Default value is None, which means that lgpl is disabled.'''
         return self.table['lgpl']
 
     def setLGPL(self, lgpl):
         '''Abort if modules aren't available under the LGPL.
-        Default value is False, which means that lgpl is disabled.'''
-        if (type(lgpl) is int and 2 <= lgpl <= 3) or type(lgpl) is bool:
+        Default value is None, which means that lgpl is disabled.'''
+        if lgpl in [None, True, '2', '3orGPLv2', '3']:
             self.table['lgpl'] = lgpl
-        else:  # if lgpl is not False, 2 or 3
+        else:
             raise TypeError('invalid LGPL version: %s' % repr(lgpl))
 
     def resetLGPL(self):
         '''Disable abort if modules aren't available under the LGPL.
-        Default value is False, which means that lgpl is disabled.'''
-        self.table['lgpl'] = False
+        Default value is None, which means that lgpl is disabled.'''
+        self.table['lgpl'] = None
 
     def getIncludeGuardPrefix(self):
         '''Return include_guard_prefix to use inside GLEmiter class.'''
index 046cf4745da8f2e2c91aecfdb1ff715778334142..04b3fddaabfbaaa2c22b4fc770047f1517dd3ce6 100644 (file)
@@ -175,10 +175,10 @@ class GLImport(object):
             tempdict = dict(zip(keys, values))
             if 'gl_LGPL' in tempdict:
                 lgpl = cleaner(tempdict['gl_LGPL'])
-                if lgpl.isdecimal():
-                    self.cache.setLGPL(int(self.cache['lgpl']))
+                if lgpl != '':
+                    self.cache.setLGPL(lgpl)
             else:  # if 'gl_LGPL' not in tempdict
-                self.cache.setLGPL(False)
+                self.cache.setLGPL(None)
             if tempdict['gl_LIB']:
                 self.cache.setLibName(cleaner(tempdict['gl_LIB']))
             if tempdict['gl_LOCAL_DIR']:
@@ -533,11 +533,11 @@ class GLImport(object):
         if self.config.checkTestFlag(TESTS['tests']):
             emit += 'gl_WITH_TESTS\n'
         emit += 'gl_LIB([%s])\n' % libname
-        if lgpl != False:
+        if lgpl != None:
             if lgpl == True:
                 emit += 'gl_LGPL\n'
             else:  # if lgpl != True
-                emit += 'gl_LGPL([%d])\n' % lgpl
+                emit += 'gl_LGPL([%s])\n' % lgpl
         emit += 'gl_MAKEFILE_NAME([%s])\n' % makefile
         if conddeps:
             emit += 'gl_CONDITIONAL_DEPENDENCIES\n'
@@ -849,17 +849,18 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
         compatibilities['all'] = ['GPLv2+ build tool', 'GPLed build tool',
                                   'public domain', 'unlimited',
                                   'unmodifiable license text']
-        compatibilities[3] = ['LGPL', 'LGPLv2+', 'LGPLv3+']
-        compatibilities[2] = ['LGPLv2+']
+        compatibilities['3']        = ['LGPLv2+', 'LGPLv3+ or GPLv2', 'LGPLv3+', 'LGPL']
+        compatibilities['3orGPLv2'] = ['LGPLv2+', 'LGPLv3+ or GPLv2']
+        compatibilities['2']        = ['LGPLv2+']
         if lgpl:
             for module in main_modules:
                 license = module.getLicense()
                 if license not in compatibilities['all']:
-                    if lgpl == 3 or lgpl == True:
-                        if license not in compatibilities[3]:
+                    if lgpl == True:
+                        if license not in compatibilities['3']:
                             listing.append(tuple([str(module), license]))
-                    elif lgpl == 2:
-                        if license not in compatibilities[2]:
+                    else:
+                        if license not in compatibilities[lgpl]:
                             listing.append(tuple([str(module), license]))
             if listing:
                 raise GLError(11, listing)
@@ -889,18 +890,35 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
         sed_transform_main_lib_file = sed_transform_lib_file
         if copyrights:
             if lgpl:  # if lgpl is enabled
-                if lgpl == 3:
+                if lgpl == True or lgpl == '3':
                     sed_transform_main_lib_file += '''
             s/GNU General/GNU Lesser General/g
             s/General Public License/Lesser General Public License/g
-            s/Lesser Lesser General Public License/Lesser General Public''' \
-                        + ' License/g'
-                elif lgpl == 2:
+            s/Lesser Lesser General Public License/Lesser General Public License/g'''
+                elif lgpl == '3orGPLv2':
+                    sed_transform_main_lib_file += '''
+            /^ *This program is free software/i\\
+   This program is free software: you can redistribute it and\\/or\\
+   modify it under the terms of either:\\
+\\
+     * the GNU Lesser General Public License as published by the Free\\
+       Software Foundation; either version 3 of the License, or (at your\\
+       option) any later version.\\
+\\
+   or\\
+\\
+     * the GNU General Public License as published by the Free\\
+       Software Foundation; either version 2 of the License, or (at your\\
+       option) any later version.\\
+\\
+   or both in parallel, as here.
+            /^ *This program is free software/,/^$/d
+            '''
+                elif lgpl == '2':
                     sed_transform_main_lib_file += '''
             s/GNU General/GNU Lesser General/g
             s/General Public License/Lesser General Public License/g
-            s/Lesser Lesser General Public License/Lesser General Public''' \
-                        + '''License/g
+            s/Lesser Lesser General Public License/Lesser General Public License/g
             s/version [23]\\([ ,]\\)/version 2.1\\1/g'''
             else:  # if lgpl is disabled
                 sed_transform_main_lib_file += lgpl2gpl
index 79c1ba0cf1eeb6f77747843ec2b90a9bd11755c4..720e357c90b5747491934e4737dffb75c62dc797 100644 (file)
@@ -251,7 +251,8 @@ Options for --import, --add/remove-import:
                             placed (default \"tests\").
       --aux-dir=DIRECTORY   Directory relative to --dir where auxiliary build
                             tools are placed (default comes from configure.ac).
-      --lgpl[=2|=3]         Abort if modules aren't available under the LGPL.
+      --lgpl[=2|=3orGPLv2|=3]
+                            Abort if modules aren't available under the LGPL.
                             Also modify license template from GPL to LGPL.
                             The version number of the LGPL can be specified;
                             the default is currently LGPLv3.
index 83555faad77f833e37b364e5aa3f4108ca558e0f..29c3010ce083681089ca09255f7a4bf03f03f7fa 100644 (file)
@@ -195,13 +195,19 @@ class GLTestDir(object):
                     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+']:
+                        if requested_licence == 'GPLv3+' or requested_licence == 'GPL':
+                            if license not in ['LGPLv2+', 'LGPLv3+ or GPLv2', 'LGPLv3+', 'LGPL', 'GPLv2+', 'GPLv3+', 'GPL']:
                                 incompatible = True
-                        elif requested_licence in ['LGPL']:
-                            if license not in ['LGPL', 'LGPLv2+']:
+                        elif requested_licence == 'GPLv2+':
+                            if license not in ['LGPLv2+', 'LGPLv3+ or GPLv2', 'GPLv2+']:
                                 incompatible = True
-                        elif requested_licence in ['LGPLv2+']:
+                        elif requested_licence == 'LGPLv3+' or requested_licence == 'LGPL':
+                            if license not in ['LGPLv2+', 'LGPLv3+ or GPLv2', 'LGPLv3+', 'LGPL']:
+                                incompatible = True
+                        elif requested_licence == 'LGPLv3+ or GPLv2':
+                            if license not in ['LGPLv2+', 'LGPLv3+ or GPLv2']:
+                                incompatible = True
+                        elif requested_licence == 'LGPLv2+':
                             if license not in ['LGPLv2+']:
                                 incompatible = True
                         if incompatible: