[lua-torch-sys] 01/04: New upstream version 0~20160920-g512e61a

Zhou Mo cdluminate-guest at moszumanska.debian.org
Sun Oct 2 16:06:49 UTC 2016


This is an automated email from the git hooks/post-receive script.

cdluminate-guest pushed a commit to branch master
in repository lua-torch-sys.

commit afdc9f2fdde77de2c5c06b49fe397aec74bdc4d7
Author: Zhou Mo <cdluminate at gmail.com>
Date:   Sun Oct 2 16:03:42 2016 +0000

    New upstream version 0~20160920-g512e61a
---
 init.lua           | 28 ++++++++++++++++++++++++----
 sys-1.1-0.rockspec |  1 +
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/init.lua b/init.lua
index 4596a92..75f1722 100644
--- a/init.lua
+++ b/init.lua
@@ -48,11 +48,12 @@ sys.execute = execute
 -- this call is typically more robust than the one above (on some systems)
 --------------------------------------------------------------------------------
 function sys.fexecute(cmd, readwhat)
+   readwhat = readwhat or '*all'
    local tmpfile = os.tmpname()
    local cmd = cmd .. ' 1>'.. tmpfile..' 2>' .. tmpfile
    os.execute(cmd)
    local file = _G.assert(io.open(tmpfile))
-   local s = file:read('*all')
+   local s= file:read(readwhat)
    file:close()
    s = s:gsub('^%s*',''):gsub('%s*$','')
    os.execute('rm ' .. tmpfile)
@@ -68,10 +69,11 @@ function sys.uname()
    if paths.dirp('C:\\') then
       return 'windows'
    else
-      local os = execute('uname -a')
+      local ffi = require 'ffi'
+      local os = ffi.os
       if os:find('Linux') then
          return 'linux'
-      elseif os:find('Darwin') then
+      elseif os:find('OSX') then
          return 'macos'
       else
          return '?'
@@ -91,7 +93,25 @@ sys.lla = function(d) d = d or ' ' return execute('ls -la '..d) end
 --------------------------------------------------------------------------------
 -- prefix
 --------------------------------------------------------------------------------
-sys.prefix = execute('which lua'):gsub('//','/'):gsub('/bin/lua\n','')
+local function find_prefix()
+   if arg then
+      for i, v in pairs(arg) do
+	 if type(i) == "number" and type(v) == "string" and i <= 0 then
+	    local lua_path = paths.basename(v)
+	    if lua_path == "luajit" or lua_path == "lua" then
+	       local bin_dir = paths.dirname(v)
+	       if paths.basename(bin_dir) == "bin" then
+		  return paths.dirname(bin_dir)
+	       else
+		  return bin_dir
+	       end
+	    end
+	 end
+      end
+   end
+   return ""
+end
+sys.prefix = find_prefix()
 
 --------------------------------------------------------------------------------
 -- always returns the path of the file running
diff --git a/sys-1.1-0.rockspec b/sys-1.1-0.rockspec
index c362988..417fb3d 100644
--- a/sys-1.1-0.rockspec
+++ b/sys-1.1-0.rockspec
@@ -16,6 +16,7 @@ Provides system functionalities for Torch.
 
 dependencies = {
    "torch >= 7.0",
+   "luaffi"
 }
 
 build = {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/lua-torch-sys.git



More information about the debian-science-commits mailing list