diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 460ed549b..0d9374d40 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -275,7 +275,11 @@ class Build: self.dependency_overrides: PerMachine[T.Dict[T.Tuple, DependencyOverride]] = PerMachineDefaultable.default( environment.is_cross_build(), {}, {}) self.devenv: T.List[EnvironmentVariables] = [] - self.modules: T.List[str] = [] + self.modules: T.Set[str] = set() + """Used to track which modules are enabled in all subprojects. + + Needed for tracking whether a modules options needs to be exposed to the user. + """ def get_build_targets(self): build_targets = OrderedDict() diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index d7523e7ea..dd73522a0 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -632,8 +632,8 @@ class Interpreter(InterpreterBase, HoldableObject): ext_module = NotFoundExtensionModule(real_modname) else: ext_module = module.initialize(self) - assert isinstance(ext_module, (ExtensionModule, NewExtensionModule)), 'for mypy' - self.build.modules.append(real_modname) + assert isinstance(ext_module, (ExtensionModule, NewExtensionModule)) + self.build.modules.add(real_modname) if ext_module.INFO.added: FeatureNew.single_use(f'module {ext_module.INFO.name}', ext_module.INFO.added, self.subproject, location=node) if ext_module.INFO.deprecated: