From 1e7d11c689a927e9730a101f2f9050b84eb5216e Mon Sep 17 00:00:00 2001
From: Matthew Wild <mwild1@gmail.com>
Date: Mon, 23 Apr 2012 14:15:07 +0100
Subject: moduleapi: module:depends(): Load shared modules onto the current
 host even if they are loaded globally already

---
 core/moduleapi.lua | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index 2223f4d0..e680f615 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -120,6 +120,9 @@ function api:depends(name)
 		end);
 	end
 	local mod = modulemanager.get_module(self.host, name) or modulemanager.get_module("*", name);
+	if mod and mod.module.host == "*" and modulemanager.module_has_method(mod, "add_host") then
+		mod = nil; -- This is a shared module, so we still want to load it on our host
+	end
 	if not mod then
 		local err;
 		mod, err = modulemanager.load(self.host, name);
-- 
cgit v1.2.3