Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/env.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Fidjeland <andreas@fidjeland.io>2014-01-20 22:57:00 +0400
committerAndreas Fidjeland <andreas@fidjeland.io>2014-01-20 22:57:00 +0400
commit5a5245cbbbffb984ca770253c5c76081032655a0 (patch)
treefe4eac72bbd504969cbfbd6574066d9984f69d02
parent7e740b25db95239c4f23458c96c0c69464b122b2 (diff)
Local luarocks paths set up before base packages required
This means that the basic luarocks packages (dok, gnuplot, torch) can live in the local luarocks tree.
-rw-r--r--init.lua22
1 files changed, 11 insertions, 11 deletions
diff --git a/init.lua b/init.lua
index 4256e13..419e291 100644
--- a/init.lua
+++ b/init.lua
@@ -1,3 +1,4 @@
+require 'paths'
-- welcome message
print 'Torch 7.0 Copyright (C) 2001-2011 Idiap, NEC Labs, NYU'
@@ -270,11 +271,20 @@ function import(package, forced)
end
+-- setup local paths (for LuaRocks and Torch-pkg)
+local localinstalldir = paths.concat(paths.home,'.luarocks')
+if paths.dirp(localinstalldir) then
+ package.path = paths.concat(localinstalldir,'share','lua','5.1','?','init.lua') .. ';' .. package.path
+ package.path = paths.concat(localinstalldir,'share','lua','5.1','?.lua') .. ';' .. package.path
+ package.cpath = paths.concat(localinstalldir,'lib','lua','5.1','?.so') .. ';' .. package.cpath
+ package.cpath = paths.concat(localinstalldir,'lib','lua','5.1','?.dylib') .. ';' .. package.cpath
+end
+
+
function loaddefaultlibs(loadwithimport)
if loadwithimport == nil then loadwithimport = false end
if not loadwithimport then
-- preload basic libraries
- require 'paths'
require 'torch'
require 'gnuplot'
require 'dok'
@@ -293,13 +303,3 @@ for k,v in pairs(_G) do
_G._preloaded_[k] = true
end
-
--- setup local paths (for LuarRocks and Torch-pkg)
-local localinstalldir = paths.concat(paths.home,'.luarocks')
-if paths.dirp(localinstalldir) then
- package.path = paths.concat(localinstalldir,'share','lua','5.1','?','init.lua') .. ';' .. package.path
- package.path = paths.concat(localinstalldir,'share','lua','5.1','?.lua') .. ';' .. package.path
- package.cpath = paths.concat(localinstalldir,'lib','lua','5.1','?.so') .. ';' .. package.cpath
- package.cpath = paths.concat(localinstalldir,'lib','lua','5.1','?.dylib') .. ';' .. package.cpath
-end
-