From 4bc532627dc59265abaf4d30e9c5c04d71fe7a6f Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 16 Mar 2021 13:46:57 -0300 Subject: manif: remove dead code --- src/luarocks/manif.lua | 44 -------------------------------------------- 1 file changed, 44 deletions(-) (limited to 'src') diff --git a/src/luarocks/manif.lua b/src/luarocks/manif.lua index f643bc80..5790ef18 100644 --- a/src/luarocks/manif.lua +++ b/src/luarocks/manif.lua @@ -181,50 +181,6 @@ function manif.get_next_provider(item_type, item_name, repo) end end ---- Given a name of a module or a command provided by a package, figure out --- which file provides it. --- @param name string: package name. --- @param version string: package version. --- @param item_type string: "module" or "command". --- @param item_name string: module or command name. --- @param root string or nil: A local root dir for a rocks tree. If not given, the default is used. --- @return (string, string): rock manifest subtree the file comes from ("bin", "lua", or "lib") --- and path to the providing file relatively to that subtree. -function manif.get_providing_file(name, version, item_type, item_name, repo) - local rocks_dir = path.rocks_dir(repo or cfg.root_dir) - local manifest = manif.load_manifest(rocks_dir) - - local entry_table = manifest.repository[name][version][1] - local file_path = entry_table[item_type .. "s"][item_name] - - if item_type == "command" then - return "bin", file_path - end - - -- A module can be in "lua" or "lib". Decide based on extension first: - -- most likely Lua modules are in "lua/" and C modules are in "lib/". - if file_path:match("%." .. cfg.lua_extension .. "$") then - return "lua", file_path - elseif file_path:match("%." .. cfg.lib_extension .. "$") then - return "lib", file_path - end - - -- Fallback to rock manifest scanning. - local rock_manifest = manif.load_rock_manifest(name, version, repo and repo.root) - local subtree = rock_manifest.lib - - for path_part in file_path:gmatch("[^/]+") do - if type(subtree) == "table" then - subtree = subtree[path_part] - else - -- Assume it's in "lua/" if it's not in "lib/". - return "lua", file_path - end - end - - return type(subtree) == "string" and "lib" or "lua", file_path -end - --- Get all versions of a package listed in a manifest file. -- @param name string: a package name. -- @param deps_mode string: "one", to use only the currently -- cgit v1.2.3-55-g6feb