summaryrefslogtreecommitdiff
path: root/scripts/context/stubs/unix/luatools
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2009-12-24 17:55:00 +0100
committerHans Hagen <pragma@wxs.nl>2009-12-24 17:55:00 +0100
commitce29b6101810724ac7e6b7db8990152358a12d2f (patch)
treebba2bbc78d942aabb062fb0a0161544e6b665c44 /scripts/context/stubs/unix/luatools
parent78ee07252af9126a45b146030034f4c769265121 (diff)
downloadcontext-ce29b6101810724ac7e6b7db8990152358a12d2f.tar.gz
beta 2009.12.24 17:55
Diffstat (limited to 'scripts/context/stubs/unix/luatools')
-rwxr-xr-xscripts/context/stubs/unix/luatools45
1 files changed, 26 insertions, 19 deletions
diff --git a/scripts/context/stubs/unix/luatools b/scripts/context/stubs/unix/luatools
index a74302b52..8568595a6 100755
--- a/scripts/context/stubs/unix/luatools
+++ b/scripts/context/stubs/unix/luatools
@@ -1722,21 +1722,23 @@ function os.resultof(command)
end
end
---~ os.type : windows | unix (new, we already guessed os.platform)
---~ os.name : windows | msdos | linux | macosx | solaris | .. | generic (new)
+--~ os.type : windows | unix (new, we already guessed os.platform)
+--~ os.name : windows | msdos | linux | macosx | solaris | .. | generic (new)
+--~ os.platform : extended os.name with architecture
if not io.fileseparator then
if find(os.getenv("PATH"),";") then
- io.fileseparator, io.pathseparator, os.platform = "\\", ";", os.type or "windows"
+ io.fileseparator, io.pathseparator, os.type = "\\", ";", os.type or "mswin"
else
- io.fileseparator, io.pathseparator, os.platform = "/" , ":", os.type or "unix"
+ io.fileseparator, io.pathseparator, os.type = "/" , ":", os.type or "unix"
end
end
-os.platform = os.platform or os.type or (io.pathseparator == ";" and "windows") or "unix"
+os.type = os.type or (io.pathseparator == ";" and "windows") or "unix"
+os.name = os.name or (os.type == "windows" and "mswin" ) or "linux"
function os.launch(str)
- if os.platform == "windows" then
+ if os.type == "windows" then
os.execute("start " .. str) -- os.spawn ?
else
os.execute(str .. " &") -- os.spawn ?
@@ -1778,18 +1780,20 @@ end
-- no need for function anymore as we have more clever code and helpers now
-os.platform = os.name
+os.platform = os.name or os.type or "linux"
os.libsuffix = 'so'
+os.binsuffix = ''
local name = os.name
-if name == "windows" or name == "mswin" or name == "win32" or name == "msdos" then
+if name == "windows" or name == "mswin" or name == "win32" or name == "msdos" or os.type == "windows" then
if os.getenv("PROCESSOR_ARCHITECTURE") == "AMD64" then
os.platform = "mswin-64"
else
os.platform = "mswin"
end
os.libsuffix = 'dll'
+ os.binsuffix = 'exe'
else
local architecture = os.getenv("HOSTTYPE") or ""
if architecture == "" then
@@ -4558,7 +4562,7 @@ resolvers.generators.notfound = { nil }
resolvers.cacheversion = '1.0.1'
resolvers.cnfname = 'texmf.cnf'
resolvers.luaname = 'texmfcnf.lua'
-resolvers.homedir = os.env[os.platform == "windows" and 'USERPROFILE'] or os.env['HOME'] or '~'
+resolvers.homedir = os.env[os.type == "windows" and 'USERPROFILE'] or os.env['HOME'] or '~'
resolvers.cnfdefault = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c}'
local dummy_path_expr = "^!*unset/*$"
@@ -4969,8 +4973,8 @@ function resolvers.getownpath()
resolvers.ownpath = os.selfdir
else
local binary = resolvers.ownbin
- if os.platform == "windows" then
- binary = file.replacesuffix(binary,"exe")
+ if os.binsuffix ~= "" then
+ binary = file.replacesuffix(binary,os.binsuffix)
end
for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do
local b = file.join(p,binary)
@@ -6181,11 +6185,11 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan
dirlist[i] = file.dirname(filelist[i][2]) .. "/"
end
end
- local doscan
if trace_detail then
logs.report("fileio","checking filename '%s'",filename)
end
-- a bit messy ... esp the doscan setting here
+ local doscan
for k=1,#pathlist do
local path = pathlist[k]
if find(path,"^!!") then doscan = false else doscan = true end
@@ -6193,22 +6197,25 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan
done = false
-- using file list
if filelist then
+ local expression
-- compare list entries with permitted pattern -- /xx /xx//
if not find(pathname,"/$") then
- pathname = pathname .. "/"
+ expression = pathname .. "/"
+ else
+ expression = pathname
end
- pathname = gsub(pathname,"([%-%.])","%%%1") -- this also influences
- pathname = gsub(pathname,"//+$", '/.*') -- later usage of pathname
- pathname = gsub(pathname,"//", '/.-/') -- not ok for /// but harmless
- local expr = "^" .. pathname .. "$"
+ expression = gsub(expression,"([%-%.])","%%%1") -- this also influences
+ expression = gsub(expression,"//+$", '/.*') -- later usage of pathname
+ expression = gsub(expression,"//", '/.-/') -- not ok for /// but harmless
+ expression = "^" .. expression .. "$"
if trace_detail then
- logs.report("fileio","using pattern %s for path %s",expr,path)
+ logs.report("fileio","using pattern '%s' for path '%s'",expression,pathname)
end
for k=1,#filelist do
local fl = filelist[k]
local f = fl[2]
local d = dirlist[k]
- if find(d,expr) then
+ if find(d,expression) then
--- todo, test for readable
result[#result+1] = fl[3]
resolvers.register_in_trees(f) -- for tracing used files