aboutsummaryrefslogtreecommitdiff
path: root/src/luarocks/cfg.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/luarocks/cfg.lua')
-rw-r--r--src/luarocks/cfg.lua19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
index 60239d3f..e7356c16 100644
--- a/src/luarocks/cfg.lua
+++ b/src/luarocks/cfg.lua
@@ -362,6 +362,7 @@ local defaults = {
362 FIND = "find", 362 FIND = "find",
363 TEST = "test", 363 TEST = "test",
364 CHMOD = "chmod", 364 CHMOD = "chmod",
365 MKTEMP = "mktemp",
365 366
366 ZIP = "zip", 367 ZIP = "zip",
367 UNZIP = "unzip -n", 368 UNZIP = "unzip -n",
@@ -604,13 +605,11 @@ defaults.variables.LUA = site_config.LUA_DIR_SET and (defaults.variables.LUA_BIN
604-- Add built-in modules to rocks_provided 605-- Add built-in modules to rocks_provided
605defaults.rocks_provided["lua"] = cfg.lua_version.."-1" 606defaults.rocks_provided["lua"] = cfg.lua_version.."-1"
606 607
607if cfg.lua_version >= "5.2" then 608if bit32 then -- Lua 5.2+
608 -- Lua 5.2+
609 defaults.rocks_provided["bit32"] = cfg.lua_version.."-1" 609 defaults.rocks_provided["bit32"] = cfg.lua_version.."-1"
610end 610end
611 611
612if cfg.lua_version >= "5.3" then 612if utf8 then -- Lua 5.3+
613 -- Lua 5.3+
614 defaults.rocks_provided["utf8"] = cfg.lua_version.."-1" 613 defaults.rocks_provided["utf8"] = cfg.lua_version.."-1"
615end 614end
616 615
@@ -668,17 +667,23 @@ function cfg.make_paths_from_tree(tree)
668 return lua_path, lib_path, bin_path 667 return lua_path, lib_path, bin_path
669end 668end
670 669
671function cfg.package_paths() 670function cfg.package_paths(current)
672 local new_path, new_cpath, new_bin = {}, {}, {} 671 local new_path, new_cpath, new_bin = {}, {}, {}
673 for _,tree in ipairs(cfg.rocks_trees) do 672 local function add_tree_to_paths(tree)
674 local lua_path, lib_path, bin_path = cfg.make_paths_from_tree(tree) 673 local lua_path, lib_path, bin_path = cfg.make_paths_from_tree(tree)
675 table.insert(new_path, lua_path.."/?.lua") 674 table.insert(new_path, lua_path.."/?.lua")
676 table.insert(new_path, lua_path.."/?/init.lua") 675 table.insert(new_path, lua_path.."/?/init.lua")
677 table.insert(new_cpath, lib_path.."/?."..cfg.lib_extension) 676 table.insert(new_cpath, lib_path.."/?."..cfg.lib_extension)
678 table.insert(new_bin, bin_path) 677 table.insert(new_bin, bin_path)
679 end 678 end
679 if current then
680 add_tree_to_paths(current)
681 end
682 for _,tree in ipairs(cfg.rocks_trees) do
683 add_tree_to_paths(tree)
684 end
680 if extra_luarocks_module_dir then 685 if extra_luarocks_module_dir then
681 table.insert(new_path, extra_luarocks_module_dir) 686 table.insert(new_path, extra_luarocks_module_dir)
682 end 687 end
683 return table.concat(new_path, ";"), table.concat(new_cpath, ";"), table.concat(new_bin, cfg.export_path_separator) 688 return table.concat(new_path, ";"), table.concat(new_cpath, ";"), table.concat(new_bin, cfg.export_path_separator)
684end 689end