+2024-04-19 Collin Funk <collin.funk1@gmail.com>
+
+ gnulib-tool.py: Simplify data structures for dependencies.
+ * pygnulib/GLModuleSystem.py (GLModuleTable.__init__): Use a defaultdict
+ for dependers to remove the base initialization case.
+ (GLModuleTable.addConditional): Use a set to disallow duplicates instead
+ of performing list lookups.
+
2024-04-19 Bruno Haible <bruno@clisp.org>
gnulib-tool.py: Simplify running some commands in a given directory.
import sys
import hashlib
import subprocess as sp
+from collections import defaultdict
from . import constants
from .GLError import GLError
from .GLConfig import GLConfig
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()
+ self.dependers = defaultdict(set)
self.conditionals = dict()
self.unconditionals = set()
self.base_modules = []
% type(condition).__name__)
if str(module) not in self.unconditionals:
# No unconditional dependency to the given module is known at this point.
- if str(module) not in self.dependers:
- self.dependers[str(module)] = []
- if str(parent) not in self.dependers[str(module)]:
- self.dependers[str(module)].append(str(parent))
+ self.dependers[str(module)].add(str(parent))
key = '%s---%s' % (str(parent), str(module))
self.conditionals[key] = condition