diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2011-08-14 13:45:51 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2011-08-14 13:52:23 -0300 |
commit | dd8d607cd77677f509304bba1737664243a89fd0 (patch) | |
tree | 0ee8bdfa0522f9715daf6f9520e5a9d98ff7f1c7 | |
parent | 4159b2c0fab5e3f273854d064196aecbb7434520 (diff) | |
download | luarocks-dd8d607cd77677f509304bba1737664243a89fd0.tar.gz luarocks-dd8d607cd77677f509304bba1737664243a89fd0.tar.bz2 luarocks-dd8d607cd77677f509304bba1737664243a89fd0.zip |
Abstract away configuration issue over to cfg.
-rw-r--r-- | src/luarocks/cfg.lua | 6 | ||||
-rw-r--r-- | src/luarocks/path.lua | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 25f22e26..ace0dbf1 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua | |||
@@ -190,6 +190,8 @@ if detected.windows then | |||
190 | lib = { "?.dll", "lib?.dll" }, | 190 | lib = { "?.dll", "lib?.dll" }, |
191 | include = { "?.h" } | 191 | include = { "?.h" } |
192 | } | 192 | } |
193 | defaults.export_lua_path = "SET LUA_PATH=%s" | ||
194 | defaults.export_lua_cpath = "SET LUA_CPATH=%s" | ||
193 | defaults.local_cache = home.."/cache/luarocks" | 195 | defaults.local_cache = home.."/cache/luarocks" |
194 | end | 196 | end |
195 | 197 | ||
@@ -223,6 +225,8 @@ if detected.mingw32 then | |||
223 | lib = { "?.dll", "lib?.dll" }, | 225 | lib = { "?.dll", "lib?.dll" }, |
224 | include = { "?.h" } | 226 | include = { "?.h" } |
225 | } | 227 | } |
228 | defaults.export_lua_path = "SET LUA_PATH=%s" | ||
229 | defaults.export_lua_cpath = "SET LUA_CPATH=%s" | ||
226 | defaults.local_cache = home.."/cache/luarocks" | 230 | defaults.local_cache = home.."/cache/luarocks" |
227 | end | 231 | end |
228 | 232 | ||
@@ -251,6 +255,8 @@ if detected.unix then | |||
251 | lib = { "lib?.so", "lib?.so.*" }, | 255 | lib = { "lib?.so", "lib?.so.*" }, |
252 | include = { "?.h" } | 256 | include = { "?.h" } |
253 | } | 257 | } |
258 | defaults.export_lua_path = "export LUA_PATH='%s'" | ||
259 | defaults.export_lua_cpath = "export LUA_CPATH='%s'" | ||
254 | defaults.local_cache = home.."/.cache/luarocks" | 260 | defaults.local_cache = home.."/.cache/luarocks" |
255 | if not defaults.variables.CFLAGS:match("-fPIC") then | 261 | if not defaults.variables.CFLAGS:match("-fPIC") then |
256 | defaults.variables.CFLAGS = defaults.variables.CFLAGS.." -fPIC" | 262 | defaults.variables.CFLAGS = defaults.variables.CFLAGS.." -fPIC" |
diff --git a/src/luarocks/path.lua b/src/luarocks/path.lua index 83b84530..fe241aa5 100644 --- a/src/luarocks/path.lua +++ b/src/luarocks/path.lua | |||
@@ -302,16 +302,10 @@ function versioned_name(file, prefix, name, version) | |||
302 | end | 302 | end |
303 | 303 | ||
304 | --- Driver function for "path" command. | 304 | --- Driver function for "path" command. |
305 | -- This platform distinction is not in fs to avoid depending on that module here. | ||
306 | -- @return boolean This function always succeeds. | 305 | -- @return boolean This function always succeeds. |
307 | function run(...) | 306 | function run(...) |
308 | if cfg.is_platform("unix") then | 307 | util.printout(cfg.export_lua_path:format(package.path)) |
309 | util.printout("export LUA_PATH='"..package.path.."'") | 308 | util.printout(cfg.export_lua_cpath:format(package.path)) |
310 | util.printout("export LUA_CPATH='"..package.cpath.."'") | ||
311 | elseif cfg.is_platform("windows") then | ||
312 | util.printout("SET LUA_PATH="..package.path) | ||
313 | util.printout("SET LUA_CPATH="..package.cpath) | ||
314 | end | ||
315 | return true | 309 | return true |
316 | end | 310 | end |
317 | 311 | ||