# HG changeset patch # User Kim Alvefur # Date 1540480270 -7200 # Node ID e4c09e335bd9ed22cea4eb28d658046e0006f363 # Parent ed5a5ddcef1708fc86a4ab6e88612177b6acbe05 moduleapi: Prevent loading disabled module as dependency of enabled one Explicitly disabled module should stay disabled. diff -r ed5a5ddcef17 -r e4c09e335bd9 core/moduleapi.lua --- a/core/moduleapi.lua Thu Oct 25 21:59:17 2018 +0200 +++ b/core/moduleapi.lua Thu Oct 25 17:11:10 2018 +0200 @@ -129,6 +129,9 @@ function api:depends(name) local modulemanager = require"core.modulemanager"; + if self:get_option_inherited_set("modules_disabled", {}):contains(name) then + error("Dependency on disabled module mod_"..name); + end if not self.dependencies then self.dependencies = {}; self:hook("module-reloaded", function (event) @@ -145,9 +148,6 @@ end end); end - if self:get_option_inherited_set("modules_disabled", {}):contains(name) then - self:log("warn", "Loading prerequisite mod_%s despite it being disabled", name); - end local mod = modulemanager.get_module(self.host, name) or modulemanager.get_module("*", name); if mod and mod.module.host == "*" and self.host ~= "*" and modulemanager.module_has_method(mod, "add_host") then