From: Collin Funk Date: Tue, 16 Apr 2024 15:21:27 +0000 (-0700) Subject: gnulib-tool.py: Make data structures more clear. X-Git-Tag: v1.0~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5097cf4b4e51aba7124510ed8edd6fb323213ae6;p=thirdparty%2Fgnulib.git gnulib-tool.py: Make data structures more clear. * pygnulib/GLModuleSystem.py (GLModuleTable.__init__): Use a set to represent the unconditional modules instead of a dictionary. Remove redundant comments. (GLModuleTable.addUnconditional): Add the module to a set instead of using it as a key to the dictionary. --- diff --git a/ChangeLog b/ChangeLog index b14171a863..56dade056b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2024-04-16 Collin Funk + + gnulib-tool.py: Make data structures more clear. + * pygnulib/GLModuleSystem.py (GLModuleTable.__init__): Use a set to + represent the unconditional modules instead of a dictionary. Remove + redundant comments. + (GLModuleTable.addUnconditional): Add the module to a set instead of + using it as a key to the dictionary. + 2024-04-16 Bruno Haible setpayloadl: Add tests. diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py index 82b3c2f6e5..11f8934026 100644 --- a/pygnulib/GLModuleSystem.py +++ b/pygnulib/GLModuleSystem.py @@ -727,13 +727,13 @@ class GLModuleTable: returns the condition when B should be enabled as a dependency of A, once the m4 code for A has been executed. ''' - self.dependers = dict() # Dependencies - self.conditionals = dict() # Conditional modules - self.unconditionals = dict() # Unconditional modules - self.base_modules = [] # Base modules - self.main_modules = [] # Main modules - self.tests_modules = [] # Tests modules - self.final_modules = [] # Final modules + self.dependers = dict() + self.conditionals = dict() + self.unconditionals = set() + self.base_modules = [] + self.main_modules = [] + self.tests_modules = [] + self.final_modules = [] if type(config) is not GLConfig: raise TypeError('config must be a GLConfig, not %s' % type(config).__name__) @@ -781,7 +781,7 @@ class GLModuleTable: if type(module) is not GLModule: raise TypeError('module must be a GLModule, not %s' % type(module).__name__) - self.unconditionals[str(module)] = True + self.unconditionals.add(str(module)) if str(module) in self.dependers: self.dependers.pop(str(module))