From 506efaea286d392d8c49a0c4cff49f06a791171b Mon Sep 17 00:00:00 2001 From: Reinhard Kotucha Date: Sun, 24 Feb 2008 23:01:28 +0000 Subject: New wrappers. git-svn-id: svn://tug.org/texlive/trunk@6751 c570f23f-e606-0410-a88d-b1316a301751 --- Master/bin/win32/epstopdf.texlua | 75 +++++++++++++++++++++--------- Master/bin/win32/fmtutil-sys.texlua | 85 +++++++++++++++++++++++++++------- Master/bin/win32/texdoctk.exe | Bin 10240 -> 0 bytes Master/bin/win32/texdoctk.texlua | 90 ++++++++++++++++++++++++++++++++++++ Master/bin/win32/updmap-sys.texlua | 88 +++++++++++++++++++++++++---------- Master/bin/win32/updmap.texlua | 76 +++++++++++++++++++++--------- 6 files changed, 327 insertions(+), 87 deletions(-) delete mode 100755 Master/bin/win32/texdoctk.exe create mode 100755 Master/bin/win32/texdoctk.texlua (limited to 'Master/bin') diff --git a/Master/bin/win32/epstopdf.texlua b/Master/bin/win32/epstopdf.texlua index 15604ae9392..b8b0c4ab870 100755 --- a/Master/bin/win32/epstopdf.texlua +++ b/Master/bin/win32/epstopdf.texlua @@ -1,14 +1,14 @@ -#!/xusr/bin/env texlua +#! /usr/bin/env texlua --*-Lua-*- -- $Id$ --- Copyright (C) 2007 Reinhard Kotucha. +-- Copyright (C) 2007 Reinhard Kotucha, Norbert Preining. -- You may freely use, modify and/or distribute this file. --- Wrapper for Perl scripts. +-- Wrapper for scripts. -function fixwin (args_unix) - if os.type == "windows" then +function fixwin(args_unix) + if os.type == 'windows' then local args_win={} -- new table args_win[0]=args_unix[1] for i=1, #args_unix do @@ -20,34 +20,65 @@ function fixwin (args_unix) end end -if string.find(arg[0], "/") then -- UNIX path - filename=select(1, string.gsub(arg[0], ".*/", "")) -elseif string.find(arg[0], "\\") then -- Windows path - filename=select(1, string.gsub(arg[0], ".*\\", "")) +if string.find(arg[0], '/') then -- UNIX path + filename=select(1, string.gsub(arg[0], '.*/', '')) +elseif string.find(arg[0], '\\') then -- Windows path + filename=select(1, string.gsub(arg[0], '.*\\', '')) else -- no path filename=arg[0] end -basename=select(1, string.gsub(filename, "\.texlua$", "")) +basename=select(1, string.gsub(filename, '\.texlua$', '')) -kpse.set_program_name(filename) +sys=false -if string.find(basename, "-sys$") then - basename=select(1, string.gsub(basename, "-sys$", "")) - os.setenv("TEXMFVAR", kpse.var_value("TEXMFSYSVAR")) - os.setenv("TEXMFCONFIG", kpse.var_value("TEXMFSYSCONFIG")) +if string.find(basename, '-sys$') then + basename=select(1, string.gsub(basename, '-sys$', '')) + sys=true end -TEXDIR=kpse.var_value("SELFAUTOPARENT") +kpse.set_program_name(filename, basename) +TEXDIR=kpse.var_value('SELFAUTOPARENT') +BINDIR=kpse.var_value('SELFAUTOLOC') -os.setenv("PERL5LIB", TEXDIR.."/tlpkg/tlperl/lib") -os.setenv("GS_LIB", TEXDIR.."/tlpkg/tlgs/lib") -os.setenv("PATH", TEXDIR.."/tlpkg/tlgs/bin;"..os.getenv("PATH")) +os.setenv('PERL5LIB', TEXDIR..'/tlpkg/tlperl/lib') +os.setenv('GS_LIB', TEXDIR..'/tlpkg/tlgs/lib') +os.setenv('PATH', TEXDIR..'/tlpkg/tlgs/bin;'..os.getenv('PATH')) -perlbin=TEXDIR.."/tlpkg/tlperl/bin/perl.exe" -script=kpse.find_file(basename..".pl", "texmfscripts") +if sys then + os.setenv('TEXMFVAR', kpse.var_value('TEXMFSYSVAR')) + os.setenv('TEXMFCONFIG', kpse.var_value('TEXMFSYSCONFIG')) + os.setenv('TEX_SYS_PROG', 'true') +end -command={perlbin, script} +if sys and lfs.isfile(BINDIR..'/'..basename..'.exe') then + command={BINDIR..'/'..basename..'.exe'} +elseif lfs.isfile(BINDIR..'/'..basename..'-bin.exe') + command={BINDIR..'/'..basename..'-bin.exe'} +elseif lfs.isdir(BINDIR..'/'..basename..'.pl') then + perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe' + script=BINDIR..'/'..basename..'.pl' + command={perlbin, script} +elseif kpse.find_file(basename..'.pl', 'texmfscripts') then + perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe' + script=kpse.find_file(basename..'.pl', 'texmfscripts') + command={perlbin, script} +elseif kpse.find_file(basename..'.rb', 'texmfscripts') then + script=kpse.find_file(basename..'.rb', 'texmfscripts') + command={'ruby', script} +elseif kpse.find_file(basename..'.py', 'texmfscripts') then + script=kpse.find_file(basename..'.py', 'texmfscripts') + command={'python', script} +elseif kpse.find_file(basename..'.texlua', 'texmfscripts') then + script=kpse.find_file(basename..'.texlua', 'texmfscripts') + command={'texlua', script} +elseif kpse.find_file(basename..'.lua', 'texmfscripts') then + script=kpse.find_file(basename..'.lua', 'texmfscripts') + command={'texlua', script} +else + os.stderr:write(filename..'.texlua: No interpreter found for '.. + basename..'\n') +end for i=1, #arg do command[#command+1]=arg[i] diff --git a/Master/bin/win32/fmtutil-sys.texlua b/Master/bin/win32/fmtutil-sys.texlua index f075b43e607..b8b0c4ab870 100755 --- a/Master/bin/win32/fmtutil-sys.texlua +++ b/Master/bin/win32/fmtutil-sys.texlua @@ -1,39 +1,90 @@ -#!/xusr/bin/env texlua +#! /usr/bin/env texlua --*-Lua-*- --- $Id: fmtutil-sys.texlua 6607 2008-02-11 15:37:39Z siepo $ +-- $Id$ --- Copyright (C) 2008 Reinhard Kotucha, Norbert Preining +-- Copyright (C) 2007 Reinhard Kotucha, Norbert Preining. -- You may freely use, modify and/or distribute this file. --- Wrapper for Perl scripts. +-- Wrapper for scripts. +function fixwin(args_unix) + if os.type == 'windows' then + local args_win={} -- new table + args_win[0]=args_unix[1] + for i=1, #args_unix do + args_win[i]='"'..args_unix[i]..'"' + end + return args_win + else + return args_unix + end +end -if string.find(arg[0], "/") then -- UNIX path - filename=select(1, string.gsub(arg[0], ".*/", "")) -elseif string.find(arg[0], "\\") then -- Windows path - filename=select(1, string.gsub(arg[0], ".*\\", "")) +if string.find(arg[0], '/') then -- UNIX path + filename=select(1, string.gsub(arg[0], '.*/', '')) +elseif string.find(arg[0], '\\') then -- Windows path + filename=select(1, string.gsub(arg[0], '.*\\', '')) else -- no path filename=arg[0] end -basename=select(1, string.gsub(filename, "\.texlua$", "")) +basename=select(1, string.gsub(filename, '\.texlua$', '')) + +sys=false + +if string.find(basename, '-sys$') then + basename=select(1, string.gsub(basename, '-sys$', '')) + sys=true +end --- basename="fmtutil-sys" +kpse.set_program_name(filename, basename) +TEXDIR=kpse.var_value('SELFAUTOPARENT') +BINDIR=kpse.var_value('SELFAUTOLOC') -kpse.set_program_name(filename) +os.setenv('PERL5LIB', TEXDIR..'/tlpkg/tlperl/lib') +os.setenv('GS_LIB', TEXDIR..'/tlpkg/tlgs/lib') +os.setenv('PATH', TEXDIR..'/tlpkg/tlgs/bin;'..os.getenv('PATH')) -if string.find(basename, "-sys$") then - basename=select(1, string.gsub(basename, "-sys$", "")) - os.setenv("TEXMFVAR", kpse.var_value("TEXMFSYSVAR")) - os.setenv("TEXMFCONFIG", kpse.var_value("TEXMFSYSCONFIG")) +if sys then + os.setenv('TEXMFVAR', kpse.var_value('TEXMFSYSVAR')) + os.setenv('TEXMFCONFIG', kpse.var_value('TEXMFSYSCONFIG')) + os.setenv('TEX_SYS_PROG', 'true') end -command = { "fmtutil.exe" } +if sys and lfs.isfile(BINDIR..'/'..basename..'.exe') then + command={BINDIR..'/'..basename..'.exe'} +elseif lfs.isfile(BINDIR..'/'..basename..'-bin.exe') + command={BINDIR..'/'..basename..'-bin.exe'} +elseif lfs.isdir(BINDIR..'/'..basename..'.pl') then + perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe' + script=BINDIR..'/'..basename..'.pl' + command={perlbin, script} +elseif kpse.find_file(basename..'.pl', 'texmfscripts') then + perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe' + script=kpse.find_file(basename..'.pl', 'texmfscripts') + command={perlbin, script} +elseif kpse.find_file(basename..'.rb', 'texmfscripts') then + script=kpse.find_file(basename..'.rb', 'texmfscripts') + command={'ruby', script} +elseif kpse.find_file(basename..'.py', 'texmfscripts') then + script=kpse.find_file(basename..'.py', 'texmfscripts') + command={'python', script} +elseif kpse.find_file(basename..'.texlua', 'texmfscripts') then + script=kpse.find_file(basename..'.texlua', 'texmfscripts') + command={'texlua', script} +elseif kpse.find_file(basename..'.lua', 'texmfscripts') then + script=kpse.find_file(basename..'.lua', 'texmfscripts') + command={'texlua', script} +else + os.stderr:write(filename..'.texlua: No interpreter found for '.. + basename..'\n') +end for i=1, #arg do command[#command+1]=arg[i] end +command=fixwin(command) + ret=os.spawn(command) os.exit(ret) - diff --git a/Master/bin/win32/texdoctk.exe b/Master/bin/win32/texdoctk.exe deleted file mode 100755 index 18a7264c4a2..00000000000 Binary files a/Master/bin/win32/texdoctk.exe and /dev/null differ diff --git a/Master/bin/win32/texdoctk.texlua b/Master/bin/win32/texdoctk.texlua new file mode 100755 index 00000000000..b8b0c4ab870 --- /dev/null +++ b/Master/bin/win32/texdoctk.texlua @@ -0,0 +1,90 @@ +#! /usr/bin/env texlua +--*-Lua-*- +-- $Id$ + +-- Copyright (C) 2007 Reinhard Kotucha, Norbert Preining. +-- You may freely use, modify and/or distribute this file. + +-- Wrapper for scripts. + +function fixwin(args_unix) + if os.type == 'windows' then + local args_win={} -- new table + args_win[0]=args_unix[1] + for i=1, #args_unix do + args_win[i]='"'..args_unix[i]..'"' + end + return args_win + else + return args_unix + end +end + +if string.find(arg[0], '/') then -- UNIX path + filename=select(1, string.gsub(arg[0], '.*/', '')) +elseif string.find(arg[0], '\\') then -- Windows path + filename=select(1, string.gsub(arg[0], '.*\\', '')) +else -- no path + filename=arg[0] +end + +basename=select(1, string.gsub(filename, '\.texlua$', '')) + +sys=false + +if string.find(basename, '-sys$') then + basename=select(1, string.gsub(basename, '-sys$', '')) + sys=true +end + +kpse.set_program_name(filename, basename) +TEXDIR=kpse.var_value('SELFAUTOPARENT') +BINDIR=kpse.var_value('SELFAUTOLOC') + +os.setenv('PERL5LIB', TEXDIR..'/tlpkg/tlperl/lib') +os.setenv('GS_LIB', TEXDIR..'/tlpkg/tlgs/lib') +os.setenv('PATH', TEXDIR..'/tlpkg/tlgs/bin;'..os.getenv('PATH')) + +if sys then + os.setenv('TEXMFVAR', kpse.var_value('TEXMFSYSVAR')) + os.setenv('TEXMFCONFIG', kpse.var_value('TEXMFSYSCONFIG')) + os.setenv('TEX_SYS_PROG', 'true') +end + +if sys and lfs.isfile(BINDIR..'/'..basename..'.exe') then + command={BINDIR..'/'..basename..'.exe'} +elseif lfs.isfile(BINDIR..'/'..basename..'-bin.exe') + command={BINDIR..'/'..basename..'-bin.exe'} +elseif lfs.isdir(BINDIR..'/'..basename..'.pl') then + perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe' + script=BINDIR..'/'..basename..'.pl' + command={perlbin, script} +elseif kpse.find_file(basename..'.pl', 'texmfscripts') then + perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe' + script=kpse.find_file(basename..'.pl', 'texmfscripts') + command={perlbin, script} +elseif kpse.find_file(basename..'.rb', 'texmfscripts') then + script=kpse.find_file(basename..'.rb', 'texmfscripts') + command={'ruby', script} +elseif kpse.find_file(basename..'.py', 'texmfscripts') then + script=kpse.find_file(basename..'.py', 'texmfscripts') + command={'python', script} +elseif kpse.find_file(basename..'.texlua', 'texmfscripts') then + script=kpse.find_file(basename..'.texlua', 'texmfscripts') + command={'texlua', script} +elseif kpse.find_file(basename..'.lua', 'texmfscripts') then + script=kpse.find_file(basename..'.lua', 'texmfscripts') + command={'texlua', script} +else + os.stderr:write(filename..'.texlua: No interpreter found for '.. + basename..'\n') +end + +for i=1, #arg do + command[#command+1]=arg[i] +end + +command=fixwin(command) + +ret=os.spawn(command) +os.exit(ret) diff --git a/Master/bin/win32/updmap-sys.texlua b/Master/bin/win32/updmap-sys.texlua index b02ee2f6064..b8b0c4ab870 100755 --- a/Master/bin/win32/updmap-sys.texlua +++ b/Master/bin/win32/updmap-sys.texlua @@ -1,52 +1,90 @@ -#!/xusr/bin/env texlua +#! /usr/bin/env texlua --*-Lua-*- -- $Id$ --- Copyright (C) 2007 Reinhard Kotucha. +-- Copyright (C) 2007 Reinhard Kotucha, Norbert Preining. -- You may freely use, modify and/or distribute this file. --- Wrapper for Perl scripts. +-- Wrapper for scripts. +function fixwin(args_unix) + if os.type == 'windows' then + local args_win={} -- new table + args_win[0]=args_unix[1] + for i=1, #args_unix do + args_win[i]='"'..args_unix[i]..'"' + end + return args_win + else + return args_unix + end +end -if string.find(arg[0], "/") then -- UNIX path - filename=select(1, string.gsub(arg[0], ".*/", "")) -elseif string.find(arg[0], "\\") then -- Windows path - filename=select(1, string.gsub(arg[0], ".*\\", "")) +if string.find(arg[0], '/') then -- UNIX path + filename=select(1, string.gsub(arg[0], '.*/', '')) +elseif string.find(arg[0], '\\') then -- Windows path + filename=select(1, string.gsub(arg[0], '.*\\', '')) else -- no path filename=arg[0] end -basename=select(1, string.gsub(filename, "\.texlua$", "")) - --- basename="updmap-sys" +basename=select(1, string.gsub(filename, '\.texlua$', '')) -kpse.set_program_name(filename) +sys=false -if string.find(basename, "-sys$") then - basename=select(1, string.gsub(basename, "-sys$", "")) - os.setenv("TEXMFVAR", kpse.var_value("TEXMFSYSVAR")) - os.setenv("TEXMFCONFIG", kpse.var_value("TEXMFSYSCONFIG")) +if string.find(basename, '-sys$') then + basename=select(1, string.gsub(basename, '-sys$', '')) + sys=true end -TEXDIR=kpse.var_value("SELFAUTOPARENT") +kpse.set_program_name(filename, basename) +TEXDIR=kpse.var_value('SELFAUTOPARENT') +BINDIR=kpse.var_value('SELFAUTOLOC') -os.setenv("PERL5LIB", TEXDIR.."/tlpkg/tlperl/lib") -os.setenv("GS_LIB", TEXDIR.."/tlpkg/tlgs/lib") -os.setenv("PATH", TEXDIR.."/tlpkg/tlgs/bin;"..os.getenv("PATH")) +os.setenv('PERL5LIB', TEXDIR..'/tlpkg/tlperl/lib') +os.setenv('GS_LIB', TEXDIR..'/tlpkg/tlgs/lib') +os.setenv('PATH', TEXDIR..'/tlpkg/tlgs/bin;'..os.getenv('PATH')) -perlbin=TEXDIR.."/tlpkg/tlperl/bin/perl.exe" -script=kpse.find_file(basename..".pl", "texmfscripts") +if sys then + os.setenv('TEXMFVAR', kpse.var_value('TEXMFSYSVAR')) + os.setenv('TEXMFCONFIG', kpse.var_value('TEXMFSYSCONFIG')) + os.setenv('TEX_SYS_PROG', 'true') +end -if (os.type == "windows") then - command={'"'..perlbin..'"', '"'..script..'"'} +if sys and lfs.isfile(BINDIR..'/'..basename..'.exe') then + command={BINDIR..'/'..basename..'.exe'} +elseif lfs.isfile(BINDIR..'/'..basename..'-bin.exe') + command={BINDIR..'/'..basename..'-bin.exe'} +elseif lfs.isdir(BINDIR..'/'..basename..'.pl') then + perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe' + script=BINDIR..'/'..basename..'.pl' + command={perlbin, script} +elseif kpse.find_file(basename..'.pl', 'texmfscripts') then + perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe' + script=kpse.find_file(basename..'.pl', 'texmfscripts') + command={perlbin, script} +elseif kpse.find_file(basename..'.rb', 'texmfscripts') then + script=kpse.find_file(basename..'.rb', 'texmfscripts') + command={'ruby', script} +elseif kpse.find_file(basename..'.py', 'texmfscripts') then + script=kpse.find_file(basename..'.py', 'texmfscripts') + command={'python', script} +elseif kpse.find_file(basename..'.texlua', 'texmfscripts') then + script=kpse.find_file(basename..'.texlua', 'texmfscripts') + command={'texlua', script} +elseif kpse.find_file(basename..'.lua', 'texmfscripts') then + script=kpse.find_file(basename..'.lua', 'texmfscripts') + command={'texlua', script} else - command={ perlbin, script } + os.stderr:write(filename..'.texlua: No interpreter found for '.. + basename..'\n') end -command[0] = perlbin for i=1, #arg do command[#command+1]=arg[i] end +command=fixwin(command) + ret=os.spawn(command) os.exit(ret) diff --git a/Master/bin/win32/updmap.texlua b/Master/bin/win32/updmap.texlua index f70f805dfd4..b8b0c4ab870 100755 --- a/Master/bin/win32/updmap.texlua +++ b/Master/bin/win32/updmap.texlua @@ -1,14 +1,14 @@ -#!/xusr/bin/env texlua +#! /usr/bin/env texlua --*-Lua-*- -- $Id$ --- Copyright (C) 2007 Reinhard Kotucha. +-- Copyright (C) 2007 Reinhard Kotucha, Norbert Preining. -- You may freely use, modify and/or distribute this file. --- Wrapper for Perl scripts. +-- Wrapper for scripts. -function fixwin (args_unix) - if os.type == "windows" then +function fixwin(args_unix) + if os.type == 'windows' then local args_win={} -- new table args_win[0]=args_unix[1] for i=1, #args_unix do @@ -20,35 +20,65 @@ function fixwin (args_unix) end end -if string.find(arg[0], "/") then -- UNIX path - filename=select(1, string.gsub(arg[0], ".*/", "")) -elseif string.find(arg[0], "\\") then -- Windows path - filename=select(1, string.gsub(arg[0], ".*\\", "")) +if string.find(arg[0], '/') then -- UNIX path + filename=select(1, string.gsub(arg[0], '.*/', '')) +elseif string.find(arg[0], '\\') then -- Windows path + filename=select(1, string.gsub(arg[0], '.*\\', '')) else -- no path filename=arg[0] end -basename=select(1, string.gsub(filename, "\.texlua$", "")) +basename=select(1, string.gsub(filename, '\.texlua$', '')) -kpse.set_program_name(filename) +sys=false -if string.find(basename, "-sys$") then - basename=select(1, string.gsub(basename, "-sys$", "")) - os.setenv("TEXMFVAR", kpse.var_value("TEXMFSYSVAR")) - os.setenv("TEXMFCONFIG", kpse.var_value("TEXMFSYSCONFIG")) +if string.find(basename, '-sys$') then + basename=select(1, string.gsub(basename, '-sys$', '')) + sys=true end +kpse.set_program_name(filename, basename) +TEXDIR=kpse.var_value('SELFAUTOPARENT') +BINDIR=kpse.var_value('SELFAUTOLOC') -TEXDIR=kpse.var_value("SELFAUTOPARENT") +os.setenv('PERL5LIB', TEXDIR..'/tlpkg/tlperl/lib') +os.setenv('GS_LIB', TEXDIR..'/tlpkg/tlgs/lib') +os.setenv('PATH', TEXDIR..'/tlpkg/tlgs/bin;'..os.getenv('PATH')) -os.setenv("PERL5LIB", TEXDIR.."/tlpkg/tlperl/lib") -os.setenv("GS_LIB", TEXDIR.."/tlpkg/tlgs/lib") -os.setenv("PATH", TEXDIR.."/tlpkg/tlgs/bin;"..os.getenv("PATH")) - -perlbin=TEXDIR.."/tlpkg/tlperl/bin/perl.exe" -script=kpse.find_file(basename..".pl", "texmfscripts") +if sys then + os.setenv('TEXMFVAR', kpse.var_value('TEXMFSYSVAR')) + os.setenv('TEXMFCONFIG', kpse.var_value('TEXMFSYSCONFIG')) + os.setenv('TEX_SYS_PROG', 'true') +end -command={perlbin, script} +if sys and lfs.isfile(BINDIR..'/'..basename..'.exe') then + command={BINDIR..'/'..basename..'.exe'} +elseif lfs.isfile(BINDIR..'/'..basename..'-bin.exe') + command={BINDIR..'/'..basename..'-bin.exe'} +elseif lfs.isdir(BINDIR..'/'..basename..'.pl') then + perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe' + script=BINDIR..'/'..basename..'.pl' + command={perlbin, script} +elseif kpse.find_file(basename..'.pl', 'texmfscripts') then + perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe' + script=kpse.find_file(basename..'.pl', 'texmfscripts') + command={perlbin, script} +elseif kpse.find_file(basename..'.rb', 'texmfscripts') then + script=kpse.find_file(basename..'.rb', 'texmfscripts') + command={'ruby', script} +elseif kpse.find_file(basename..'.py', 'texmfscripts') then + script=kpse.find_file(basename..'.py', 'texmfscripts') + command={'python', script} +elseif kpse.find_file(basename..'.texlua', 'texmfscripts') then + script=kpse.find_file(basename..'.texlua', 'texmfscripts') + command={'texlua', script} +elseif kpse.find_file(basename..'.lua', 'texmfscripts') then + script=kpse.find_file(basename..'.lua', 'texmfscripts') + command={'texlua', script} +else + os.stderr:write(filename..'.texlua: No interpreter found for '.. + basename..'\n') +end for i=1, #arg do command[#command+1]=arg[i] -- cgit v1.2.3