summaryrefslogtreecommitdiff
path: root/xmake/modules/private/action/require/impl/install_packages.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-11-27 00:45:33 +0800
committerruki <[email protected]>2024-11-27 00:45:33 +0800
commit35422e3877f65a126177f1f25ea712eda2f47ff5 (patch)
treebd651702b02fb5fb5dabf35719c5bf238156e568 /xmake/modules/private/action/require/impl/install_packages.lua
parentc4d249edd48667214a08900e5e9f6b2a7222552a (diff)
improve tips
Diffstat (limited to 'xmake/modules/private/action/require/impl/install_packages.lua')
-rw-r--r--xmake/modules/private/action/require/impl/install_packages.lua21
1 files changed, 1 insertions, 20 deletions
diff --git a/xmake/modules/private/action/require/impl/install_packages.lua b/xmake/modules/private/action/require/impl/install_packages.lua
index 005ca0fe5..8dbff89aa 100644
--- a/xmake/modules/private/action/require/impl/install_packages.lua
+++ b/xmake/modules/private/action/require/impl/install_packages.lua
@@ -29,7 +29,6 @@ import("utils.progress")
import("net.fasturl")
import("private.action.require.impl.package")
import("private.action.require.impl.lock_packages")
-import("private.action.require.impl.search_packages")
import("private.action.require.impl.register_packages")
import("private.action.require.impl.actions.check", {alias = "action_check"})
import("private.action.require.impl.actions.install", {alias = "action_install"})
@@ -682,24 +681,6 @@ function _get_package_installdeps(packages)
return installdeps
end
--- get possible package
-function _get_possible_package(packagename)
- local packages_possible = search_packages("*", {description = false})
- if packages_possible then
- packages_possible = packages_possible["*"]
- end
- local result
- local distance_min
- for name, info in pairs(packages_possible) do
- local distance = packagename:levenshtein(info.name)
- if distance_min == nil or distance < distance_min and distance < 5 then
- distance_min = distance
- result = info
- end
- end
- return result
-end
-
-- install packages
function _install_packages(requires, opt)
opt = opt or {}
@@ -765,7 +746,7 @@ function _install_packages(requires, opt)
cprint("${bright color.warning}note: ${clear}the following packages were not found in any repository (check if they are spelled correctly):")
for _, instance in ipairs(packages_unknown) do
local tips
- local possible_package = _get_possible_package(instance:name())
+ local possible_package = package.get_possible_package(instance:name())
if possible_package then
tips = string.format(", maybe ${bright}%s %s${clear} in %s", possible_package.name, possible_package.version, possible_package.reponame)
end