]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Fix broken 'for' loop.
authorBruno Haible <bruno@clisp.org>
Wed, 3 Aug 2022 15:55:24 +0000 (17:55 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 3 Aug 2022 16:09:34 +0000 (18:09 +0200)
* gnulib-tool.py (main): Canonicalize inctests before creating the
GLConfig. Rewrite a broken 'for' loop.
* pygnulib/GLConfig.py (GLConfig.setTestFlags): Remove unused statement.

ChangeLog
gnulib-tool.py
pygnulib/GLConfig.py

index b0d9b08a6282db1a1509407f0e8ea47521765b83..3447f433ac94b9cd55f1e8292928f6bd870276b2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2022-08-03  Bruno Haible  <bruno@clisp.org>
 
+       gnulib-tool.py: Fix broken 'for' loop.
+       * gnulib-tool.py (main): Canonicalize inctests before creating the
+       GLConfig. Rewrite a broken 'for' loop.
+       * pygnulib/GLConfig.py (GLConfig.setTestFlags): Remove unused statement.
+
        gnulib-tool.py: Follow gnulib-tool changes, part 23.
        Follow gnulib-tool changes
        2016-11-11  Bruno Haible  <bruno@clisp.org>
index 0864d0d8c263ba9a16606c11b87ca4f95d307ab1..cbef01b3b24d97acda39b48c36ce238707b98f97 100755 (executable)
@@ -523,28 +523,27 @@ def main():
     dryrun = cmdargs.dryrun
     verbose = -cmdargs.quiet + cmdargs.verbose
     inctests = cmdargs.inctests
-    flags = [cmdargs.inctests, cmdargs.obsolete, cmdargs.cxx,
-             cmdargs.longrunning, cmdargs.privileged, cmdargs.unportable,
-             cmdargs.alltests]
-    testflags = list()
-    for flag in flags:
-        index = flags.index(flag)
-        if flag != None:
-            if flag:
-                if index == 0:
-                    testflags += [constants.TESTS['tests']]
-                elif index == 1:
-                    testflags += [constants.TESTS['obsolete']]
-                elif index == 2:
-                    testflags += [constants.TESTS['cxx-tests']]
-                elif index == 3:
-                    testflags += [constants.TESTS['longrunning-tests']]
-                elif index == 4:
-                    testflags += [constants.TESTS['privileged-tests']]
-                elif index == 5:
-                    testflags += [constants.TESTS['unportable-tests']]
-                elif index == 6:
-                    testflags += [constants.TESTS['all-tests']]
+    # Canonicalize the inctests variable.
+    if inctests == None:
+        if mode in ['import', 'add-import', 'remove-import', 'update']:
+            inctests = False
+        elif mode in ['create-testdir', 'create-megatestdir', 'test', 'megatest']:
+            inctests = True
+    testflags = []
+    if inctests:
+        testflags += [constants.TESTS['tests']]
+    if cmdargs.obsolete:
+        testflags += [constants.TESTS['obsolete']]
+    if cmdargs.cxx:
+        testflags += [constants.TESTS['cxx-tests']]
+    if cmdargs.longrunning:
+        testflags += [constants.TESTS['longrunning-tests']]
+    if cmdargs.privileged:
+        testflags += [constants.TESTS['privileged-tests']]
+    if cmdargs.unportable:
+        testflags += [constants.TESTS['unportable-tests']]
+    if cmdargs.alltests:
+        testflags += [constants.TESTS['all-tests']]
     lgpl = cmdargs.lgpl
     if lgpl != None:
         lgpl = lgpl[-1]
@@ -589,13 +588,6 @@ def main():
         dryrun=dryrun,
     )
 
-    # Canonicalize the inctests variable.
-    if inctests == None:
-        if mode in ['import', 'add-import', 'remove-import', 'update']:
-            config.disableTestFlag(TESTS['tests'])
-        elif mode in ['create-testdir', 'create-megatestdir', 'test', 'megatest']:
-            config.enableTestFlag(TESTS['tests'])
-
     # Work in the given mode.
     if mode in ['list']:
         modulesystem = classes.GLModuleSystem(config)
index d126b35dbec50f82db654791d7187de09b508b90..f59b883a9123a74e10f3136eb59375fc42b696b7 100644 (file)
@@ -712,7 +712,6 @@ class GLConfig(object):
     def setTestFlags(self, testflags):
         '''Specify test flags. You can get flags from TESTS variable.'''
         if type(testflags) is list or type(testflags) is tuple:
-            old_testflags = self.table['testflags']
             self.table['testflags'] = list()
             for flag in testflags:
                 try:  # Try to enable each flag