>From e7101c252c537dd198af9329d861c353241bcb61 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 4 Aug 2022 11:53:37 +0200 Subject: [PATCH 1/9] 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. --- ChangeLog | 7 +++++++ pygnulib/GLConfig.py | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58cb2b610a..705722bd14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2022-08-04 Bruno Haible + + 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 gnulib-tool.py: Implement option --single-configure. diff --git a/pygnulib/GLConfig.py b/pygnulib/GLConfig.py index 37b30753ea..30ca391b0d 100644 --- a/pygnulib/GLConfig.py +++ b/pygnulib/GLConfig.py @@ -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' % -- 2.34.1