]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Make --with/--without-*-tests handling a little safer.
authorBruno Haible <bruno@clisp.org>
Thu, 4 Aug 2022 09:53:37 +0000 (11:53 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 4 Aug 2022 10:34:05 +0000 (12:34 +0200)
* pygnulib/GLConfig.py (__init__): Fix reset* invocations.
setInclTestCategories, setExclTestCategories): Revert to old value if
the new value is invalid.

ChangeLog
pygnulib/GLConfig.py

index 58cb2b610a1c993d35cdc11ee55e7f8d883d5896..705722bd14cd1ecb49f6510ccc5dc705795d96fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-08-04  Bruno Haible  <bruno@clisp.org>
+
+       gnulib-tool.py: Make --with/--without-*-tests handling a little safer.
+       * pygnulib/GLConfig.py (__init__): Fix reset* invocations.
+       setInclTestCategories, setExclTestCategories): Revert to old value if
+       the new value is invalid.
+
 2022-08-03  Bruno Haible  <bruno@clisp.org>
 
        gnulib-tool.py: Implement option --single-configure.
index 37b30753eaf81ab569618e880aad5adf1de1f66b..30ca391b0d5062aa9d1119681b3057c389f4e739 100644 (file)
@@ -119,11 +119,11 @@ class GLConfig(object):
         if files != None:
             self.setFiles(files)
         # test categories to include
-        self.resetInclTestCategories
+        self.resetInclTestCategories()
         if incl_test_categories != None:
             self.setInclTestCategories(incl_test_categories)
         # test categories to exclude
-        self.resetExclTestCategories
+        self.resetExclTestCategories()
         if excl_test_categories != None:
             self.setExclTestCategories(excl_test_categories)
         # libname
@@ -725,11 +725,13 @@ class GLConfig(object):
     def setInclTestCategories(self, categories):
         '''Specify the test categories that should be included.'''
         if type(categories) is list or type(categories) is tuple:
+            old_categories = self.table['incl_test_categories']
             self.table['incl_test_categories'] = list()
             for category in categories:
                 try:  # Try to enable each category
                     self.enableInclTestCategory(category)
                 except TypeError as error:
+                    self.table['incl_test_categories'] = old_categories
                     raise TypeError('each category must be one of TESTS integers')
         else:  # if type of categories is not list or tuple
             raise TypeError('categories must be a list or a tuple, not %s' %
@@ -771,11 +773,13 @@ class GLConfig(object):
     def setExclTestCategories(self, categories):
         '''Specify the test categories that should be excluded.'''
         if type(categories) is list or type(categories) is tuple:
+            old_categories = self.table['excl_test_categories']
             self.table['excl_test_categories'] = list()
             for category in categories:
                 try:  # Try to enable each category
                     self.enableExclTestCategory(category)
                 except TypeError as error:
+                    self.table['excl_test_categories'] = old_categories
                     raise TypeError('each category must be one of TESTS integers')
         else:  # if type of categories is not list or tuple
             raise TypeError('categories must be a list or a tuple, not %s' %