diff options
| author | ruki <[email protected]> | 2025-01-07 23:19:03 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-01-07 23:19:03 +0800 |
| commit | bd6ded54efbea8fe01040941ce8d39951a8431c9 (patch) | |
| tree | dd9666e69463dfb7e0c69400c41e06c95293d659 /xmake/core/package/package.lua | |
| parent | 9021afe5a0fd56abc7683409c921fd60de786588 (diff) | |
fix package with 3rd namespace
Diffstat (limited to 'xmake/core/package/package.lua')
| -rw-r--r-- | xmake/core/package/package.lua | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index d3032f15b..05be6af8c 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -55,12 +55,24 @@ local sandbox_module = require("sandbox/modules/import/core/sandbox/module") -- new an instance function _instance.new(name, info, opt) opt = opt or {} - local instance = table.inherit(_instance) local parts = name:split("::", {plain = true}) - instance._NAME = parts[#parts] - table.remove(parts) - if #parts > 0 then - instance._NAMESPACE = table.concat(parts, "::") + local instance = table.inherit(_instance) + local managers = package._memcache():get("managers") + if managers == nil and #parts == 2 then + managers = hashset.new() + for _, dir in ipairs(os.dirs(path.join(os.programdir(), "modules/package/manager/*"))) do + managers:insert(path.filename(dir)) + end + package._memcache():set("managers", managers) + end + if #parts == 2 and managers and managers:has(parts[1]) then + instance._NAME = name + else + instance._NAME = parts[#parts] + table.remove(parts) + if #parts > 0 then + instance._NAMESPACE = table.concat(parts, "::") + end end instance._INFO = info instance._REPO = opt.repo |
