diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-07-23 19:46:04 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-07-23 19:46:04 +0200 |
commit | c73351bc5e590d5a7ebd2b0f13f895a447d25794 (patch) | |
tree | 4e2028329e2c0b63a7818463918397de328d6432 /scripts | |
parent | ed85eb918354b77672bbe347c2afcfe2e0b6b7fb (diff) | |
download | context-c73351bc5e590d5a7ebd2b0f13f895a447d25794.tar.gz |
2021-07-23 18:53:00
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtx-context.lua | 26 | ||||
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 32 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 32 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 32 | ||||
-rw-r--r-- | scripts/context/stubs/win64/mtxrun.lua | 32 |
5 files changed, 142 insertions, 12 deletions
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index c3454309f..963afcec9 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -678,6 +678,7 @@ function scripts.context.run(ctxdata,filename) local a_purgeall = getargument("purgeall") local a_purgeresult = getargument("purgeresult") local a_global = getargument("global") + local a_runpath = getargument("runpath") local a_timing = getargument("timing") local a_profile = getargument("profile") local a_batchmode = getargument("batchmode") @@ -739,6 +740,31 @@ function scripts.context.run(ctxdata,filename) formatfile, scriptfile = resolvers.locateformat(formatname) end -- + local runpath = a_runpath or analysis.runpath + if type(runpath) == "string" and runpath ~= "" then + runpath = resolvers.resolve(runpath) + local currentdir = dir.current() + if not lfs.isdir(runpath) then + if dir.makedirs(runpath) then + report("runpath %a has been created",runpath) + else + report("error: runpath %a cannot be created",runpath) + os.exit() + end + end + if lfs.chdir(runpath) then + report("changing to runpath %a",runpath) + else + report("error: changing to runpath %a is impossible",runpath) + os.exit() + end + environment.arguments.path = currentdir + environment.arguments.runpath = runpath + if filepathpart(filename) == "." then + filename = filebasename(filename) + end + end + -- a_jithash = validstring(a_jithash or analysis.jithash) or nil a_permitloadlib = a_permitloadlib or analysis.permitloadlib or nil -- diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 7a00e7ffa..e35763c09 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -23736,7 +23736,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-pre"] = package.loaded["data-pre"] or true --- original size: 5088, stripped down to: 3144 +-- original size: 5872, stripped down to: 3691 if not modules then modules={} end modules ['data-pre']={ version=1.001, @@ -23745,6 +23745,7 @@ if not modules then modules={} end modules ['data-pre']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } +local ipairs=ipairs local insert,remove=table.insert,table.remove local resolvers=resolvers local prefixes=resolvers.prefixes @@ -23756,6 +23757,7 @@ local basename=file.basename local dirname=file.dirname local joinpath=file.join local isfile=lfs.isfile +local isdir=lfs.isdir prefixes.environment=function(str) return cleanpath(expansion(str)) end @@ -23816,6 +23818,30 @@ prefixes.home=function(str) local pth=getenv('HOME') return cleanpath(str and joinpath(pth,str) or pth) end +do + local tmppth + prefixes.temp=function(str) + if not tmppth then + for _,s in ipairs { "TMP","TEMP","TMPDIR","TEMPDIR" } do + tmppth=getenv(s) + if tmppth~="" and isdir(tmppth) then + break + end + end + if not tmppth or tmppth=="" then + tmppth="." + end + end + return cleanpath(str and joinpath(tmppth,str) or tmppth) + end + prefixes.texruns=function(str) + local pth=getenv('TEXRUNS') + if pth=="" then + pth=tmppth + end + return cleanpath(str and joinpath(pth,str) or pth) + end +end prefixes.env=prefixes.environment prefixes.rel=prefixes.relative prefixes.loc=prefixes.locate @@ -25895,8 +25921,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1024686 --- stripped bytes : 402153 +-- original bytes : 1025470 +-- stripped bytes : 402390 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 7a00e7ffa..e35763c09 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -23736,7 +23736,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-pre"] = package.loaded["data-pre"] or true --- original size: 5088, stripped down to: 3144 +-- original size: 5872, stripped down to: 3691 if not modules then modules={} end modules ['data-pre']={ version=1.001, @@ -23745,6 +23745,7 @@ if not modules then modules={} end modules ['data-pre']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } +local ipairs=ipairs local insert,remove=table.insert,table.remove local resolvers=resolvers local prefixes=resolvers.prefixes @@ -23756,6 +23757,7 @@ local basename=file.basename local dirname=file.dirname local joinpath=file.join local isfile=lfs.isfile +local isdir=lfs.isdir prefixes.environment=function(str) return cleanpath(expansion(str)) end @@ -23816,6 +23818,30 @@ prefixes.home=function(str) local pth=getenv('HOME') return cleanpath(str and joinpath(pth,str) or pth) end +do + local tmppth + prefixes.temp=function(str) + if not tmppth then + for _,s in ipairs { "TMP","TEMP","TMPDIR","TEMPDIR" } do + tmppth=getenv(s) + if tmppth~="" and isdir(tmppth) then + break + end + end + if not tmppth or tmppth=="" then + tmppth="." + end + end + return cleanpath(str and joinpath(tmppth,str) or tmppth) + end + prefixes.texruns=function(str) + local pth=getenv('TEXRUNS') + if pth=="" then + pth=tmppth + end + return cleanpath(str and joinpath(pth,str) or pth) + end +end prefixes.env=prefixes.environment prefixes.rel=prefixes.relative prefixes.loc=prefixes.locate @@ -25895,8 +25921,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1024686 --- stripped bytes : 402153 +-- original bytes : 1025470 +-- stripped bytes : 402390 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 7a00e7ffa..e35763c09 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -23736,7 +23736,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-pre"] = package.loaded["data-pre"] or true --- original size: 5088, stripped down to: 3144 +-- original size: 5872, stripped down to: 3691 if not modules then modules={} end modules ['data-pre']={ version=1.001, @@ -23745,6 +23745,7 @@ if not modules then modules={} end modules ['data-pre']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } +local ipairs=ipairs local insert,remove=table.insert,table.remove local resolvers=resolvers local prefixes=resolvers.prefixes @@ -23756,6 +23757,7 @@ local basename=file.basename local dirname=file.dirname local joinpath=file.join local isfile=lfs.isfile +local isdir=lfs.isdir prefixes.environment=function(str) return cleanpath(expansion(str)) end @@ -23816,6 +23818,30 @@ prefixes.home=function(str) local pth=getenv('HOME') return cleanpath(str and joinpath(pth,str) or pth) end +do + local tmppth + prefixes.temp=function(str) + if not tmppth then + for _,s in ipairs { "TMP","TEMP","TMPDIR","TEMPDIR" } do + tmppth=getenv(s) + if tmppth~="" and isdir(tmppth) then + break + end + end + if not tmppth or tmppth=="" then + tmppth="." + end + end + return cleanpath(str and joinpath(tmppth,str) or tmppth) + end + prefixes.texruns=function(str) + local pth=getenv('TEXRUNS') + if pth=="" then + pth=tmppth + end + return cleanpath(str and joinpath(pth,str) or pth) + end +end prefixes.env=prefixes.environment prefixes.rel=prefixes.relative prefixes.loc=prefixes.locate @@ -25895,8 +25921,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1024686 --- stripped bytes : 402153 +-- original bytes : 1025470 +-- stripped bytes : 402390 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 7a00e7ffa..e35763c09 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -23736,7 +23736,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-pre"] = package.loaded["data-pre"] or true --- original size: 5088, stripped down to: 3144 +-- original size: 5872, stripped down to: 3691 if not modules then modules={} end modules ['data-pre']={ version=1.001, @@ -23745,6 +23745,7 @@ if not modules then modules={} end modules ['data-pre']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } +local ipairs=ipairs local insert,remove=table.insert,table.remove local resolvers=resolvers local prefixes=resolvers.prefixes @@ -23756,6 +23757,7 @@ local basename=file.basename local dirname=file.dirname local joinpath=file.join local isfile=lfs.isfile +local isdir=lfs.isdir prefixes.environment=function(str) return cleanpath(expansion(str)) end @@ -23816,6 +23818,30 @@ prefixes.home=function(str) local pth=getenv('HOME') return cleanpath(str and joinpath(pth,str) or pth) end +do + local tmppth + prefixes.temp=function(str) + if not tmppth then + for _,s in ipairs { "TMP","TEMP","TMPDIR","TEMPDIR" } do + tmppth=getenv(s) + if tmppth~="" and isdir(tmppth) then + break + end + end + if not tmppth or tmppth=="" then + tmppth="." + end + end + return cleanpath(str and joinpath(tmppth,str) or tmppth) + end + prefixes.texruns=function(str) + local pth=getenv('TEXRUNS') + if pth=="" then + pth=tmppth + end + return cleanpath(str and joinpath(pth,str) or pth) + end +end prefixes.env=prefixes.environment prefixes.rel=prefixes.relative prefixes.loc=prefixes.locate @@ -25895,8 +25921,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1024686 --- stripped bytes : 402153 +-- original bytes : 1025470 +-- stripped bytes : 402390 -- end library merge |