From b821116421f0d942052ad225f4ea62aef2696817 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 13 Jul 2020 17:21:34 +0200 Subject: 2020-07-13 16:31:00 --- scripts/context/lua/mtx-kpse.lua | 90 ++++++++++++++++++++++++++++++++++ scripts/context/lua/mtxrun.lua | 26 +++++----- scripts/context/stubs/mswin/mtxrun.lua | 26 +++++----- scripts/context/stubs/unix/mtxrun | 26 +++++----- scripts/context/stubs/win64/mtxrun.lua | 26 +++++----- 5 files changed, 150 insertions(+), 44 deletions(-) create mode 100644 scripts/context/lua/mtx-kpse.lua (limited to 'scripts') diff --git a/scripts/context/lua/mtx-kpse.lua b/scripts/context/lua/mtx-kpse.lua new file mode 100644 index 000000000..025dd5ff5 --- /dev/null +++ b/scripts/context/lua/mtx-kpse.lua @@ -0,0 +1,90 @@ +if not modules then modules = { } end modules ['mtx-kpse'] = { + version = 1.001, + comment = "companion to mtxrun.lua", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- I decided to make this module after a report on the mailing list about +-- a clash with texmf-var on a system that had texlive installed. One way +-- to figure that out is to use kpse. We had the code anyway. +-- +-- mtxrun --script kpse --progname=pdftex --findfile context.mkii + +trackers.enable("resolvers.lib.silent") + +local kpse = LUATEXENGINE == "luametatex" and require("libs-imp-kpse") + +if type(kpse) ~= "table" then + return +end + +local helpinfo = [[ + + + + mtx-kpse + ConTeXt KPSE checking utility + 1.00 + + + + + mandate, set the program name (e.g. pdftex) + report the fully qualified path of the given file + expand the given path variable + expand a variable + expand a complex variable specification + show the value of a variable + report if a file is readable + list all supported formats + + + only wipe fonts + + + + +]] + +local application = logs.application { + name = "mtx-kpse", + banner = "ConTeXt KPSE checking utility", + helpinfo = helpinfo, +} + +local report = application.report +local argument = environment.argument +local target = environment.files[1] + +if argument("progname") or argument("programname") then + kpse.set_program_name(argument("progname")) +else + application.help() + return +end + +if argument("exporthelp") then + application.export(environment.argument("exporthelp"),target) +elseif argument("filetypes") or argument("formats") then + print(table.concat(kpse.get_file_types()," ")) +elseif type(target) == "string" and target ~= "" then + if argument("findfile") or argument("find-file") then + print(kpse.find_file(target,argument("format"))) + elseif argument("expandpath") or argument("expand-path") then + print(kpse.expand_path(target)) + elseif argument("expandvar") or argument("expand-var") then + print(kpse.expand_var(target)) + elseif argument("expandbraces") or argument("expand-braces") then + print(kpse.expand_braces(target)) + elseif argument("varvalue") or argument("var-value") then + print(kpse.var_value(target)) + elseif argument("readablefile") or argument("readable-file") then + print(kpse.readable_file(target)) + else + application.help() + end +else + application.help() +end diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 0dddd1c21..b683bc729 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -5741,10 +5741,11 @@ do -- create closure to overcome 200 locals limit package.loaded["l-unicode"] = package.loaded["l-unicode"] or true --- original size: 41281, stripped down to: 17261 +-- original size: 41303, stripped down to: 17277 if not modules then modules={} end modules ['l-unicode']={ version=1.001, + optimize=true, comment="companion to luat-lib.mkiv", author="Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright="PRAGMA ADE / ConTeXt Development Team", @@ -8209,10 +8210,11 @@ do -- create closure to overcome 200 locals limit package.loaded["util-fil"] = package.loaded["util-fil"] or true --- original size: 11530, stripped down to: 9007 +-- original size: 11552, stripped down to: 9023 if not modules then modules={} end modules ['util-fil']={ version=1.001, + optimize=true, comment="companion to luat-lib.mkiv", author="Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright="PRAGMA ADE / ConTeXt Development Team", @@ -8577,10 +8579,11 @@ do -- create closure to overcome 200 locals limit package.loaded["util-sac"] = package.loaded["util-sac"] or true --- original size: 12946, stripped down to: 9507 +-- original size: 12968, stripped down to: 9523 if not modules then modules={} end modules ['util-sac']={ version=1.001, + optimize=true, comment="companion to luat-lib.mkiv", author="Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright="PRAGMA ADE / ConTeXt Development Team", @@ -19344,7 +19347,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true --- original size: 33747, stripped down to: 20989 +-- original size: 33708, stripped down to: 20953 if not modules then modules={} end modules ['lxml-aux']={ version=1.001, @@ -19839,7 +19842,6 @@ local e_stripper=lpegpatterns.e_stripper local x_stripper=lpegpatterns.x_stripper local function stripelement(e,nolines,anywhere,everything) local edt=e.dt - print(nolines,anywhere,everything) if edt then local n=#edt if n==0 then @@ -25628,7 +25630,7 @@ do -- create closure to overcome 200 locals limit package.loaded["libs-ini"] = package.loaded["libs-ini"] or true --- original size: 5822, stripped down to: 3629 +-- original size: 5950, stripped down to: 3737 if not modules then modules={} end modules ['libs-ini']={ version=1.001, @@ -25648,7 +25650,9 @@ local findfile=resolvers.findfile local expandpaths=resolvers.expandedpathlistfromvariable local report=logs.reporter("resolvers","libraries") local trace=false +local silent=false trackers.register("resolvers.lib",function(v) trace=v end) +trackers.register("resolvers.lib.silent",function(v) silent=v end) local function findlib(required) local suffix=os.libsuffix or "so" if not qualifiedpath(required) then @@ -25749,10 +25753,10 @@ function libraries.optionalloaded(name,libnames) end end local initialized=thelib_initialize(unpack(libnames)) - if initialized then - report("using library '% + t'",libnames) - else + if not initialized then report("unable to initialize library '% + t'",libnames) + elseif not silent then + report("using library '% + t'",libnames) end return initialized end @@ -26211,8 +26215,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 : 1041734 --- stripped bytes : 411240 +-- original bytes : 1041889 +-- stripped bytes : 411275 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 0dddd1c21..b683bc729 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -5741,10 +5741,11 @@ do -- create closure to overcome 200 locals limit package.loaded["l-unicode"] = package.loaded["l-unicode"] or true --- original size: 41281, stripped down to: 17261 +-- original size: 41303, stripped down to: 17277 if not modules then modules={} end modules ['l-unicode']={ version=1.001, + optimize=true, comment="companion to luat-lib.mkiv", author="Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright="PRAGMA ADE / ConTeXt Development Team", @@ -8209,10 +8210,11 @@ do -- create closure to overcome 200 locals limit package.loaded["util-fil"] = package.loaded["util-fil"] or true --- original size: 11530, stripped down to: 9007 +-- original size: 11552, stripped down to: 9023 if not modules then modules={} end modules ['util-fil']={ version=1.001, + optimize=true, comment="companion to luat-lib.mkiv", author="Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright="PRAGMA ADE / ConTeXt Development Team", @@ -8577,10 +8579,11 @@ do -- create closure to overcome 200 locals limit package.loaded["util-sac"] = package.loaded["util-sac"] or true --- original size: 12946, stripped down to: 9507 +-- original size: 12968, stripped down to: 9523 if not modules then modules={} end modules ['util-sac']={ version=1.001, + optimize=true, comment="companion to luat-lib.mkiv", author="Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright="PRAGMA ADE / ConTeXt Development Team", @@ -19344,7 +19347,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true --- original size: 33747, stripped down to: 20989 +-- original size: 33708, stripped down to: 20953 if not modules then modules={} end modules ['lxml-aux']={ version=1.001, @@ -19839,7 +19842,6 @@ local e_stripper=lpegpatterns.e_stripper local x_stripper=lpegpatterns.x_stripper local function stripelement(e,nolines,anywhere,everything) local edt=e.dt - print(nolines,anywhere,everything) if edt then local n=#edt if n==0 then @@ -25628,7 +25630,7 @@ do -- create closure to overcome 200 locals limit package.loaded["libs-ini"] = package.loaded["libs-ini"] or true --- original size: 5822, stripped down to: 3629 +-- original size: 5950, stripped down to: 3737 if not modules then modules={} end modules ['libs-ini']={ version=1.001, @@ -25648,7 +25650,9 @@ local findfile=resolvers.findfile local expandpaths=resolvers.expandedpathlistfromvariable local report=logs.reporter("resolvers","libraries") local trace=false +local silent=false trackers.register("resolvers.lib",function(v) trace=v end) +trackers.register("resolvers.lib.silent",function(v) silent=v end) local function findlib(required) local suffix=os.libsuffix or "so" if not qualifiedpath(required) then @@ -25749,10 +25753,10 @@ function libraries.optionalloaded(name,libnames) end end local initialized=thelib_initialize(unpack(libnames)) - if initialized then - report("using library '% + t'",libnames) - else + if not initialized then report("unable to initialize library '% + t'",libnames) + elseif not silent then + report("using library '% + t'",libnames) end return initialized end @@ -26211,8 +26215,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 : 1041734 --- stripped bytes : 411240 +-- original bytes : 1041889 +-- stripped bytes : 411275 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 0dddd1c21..b683bc729 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -5741,10 +5741,11 @@ do -- create closure to overcome 200 locals limit package.loaded["l-unicode"] = package.loaded["l-unicode"] or true --- original size: 41281, stripped down to: 17261 +-- original size: 41303, stripped down to: 17277 if not modules then modules={} end modules ['l-unicode']={ version=1.001, + optimize=true, comment="companion to luat-lib.mkiv", author="Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright="PRAGMA ADE / ConTeXt Development Team", @@ -8209,10 +8210,11 @@ do -- create closure to overcome 200 locals limit package.loaded["util-fil"] = package.loaded["util-fil"] or true --- original size: 11530, stripped down to: 9007 +-- original size: 11552, stripped down to: 9023 if not modules then modules={} end modules ['util-fil']={ version=1.001, + optimize=true, comment="companion to luat-lib.mkiv", author="Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright="PRAGMA ADE / ConTeXt Development Team", @@ -8577,10 +8579,11 @@ do -- create closure to overcome 200 locals limit package.loaded["util-sac"] = package.loaded["util-sac"] or true --- original size: 12946, stripped down to: 9507 +-- original size: 12968, stripped down to: 9523 if not modules then modules={} end modules ['util-sac']={ version=1.001, + optimize=true, comment="companion to luat-lib.mkiv", author="Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright="PRAGMA ADE / ConTeXt Development Team", @@ -19344,7 +19347,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true --- original size: 33747, stripped down to: 20989 +-- original size: 33708, stripped down to: 20953 if not modules then modules={} end modules ['lxml-aux']={ version=1.001, @@ -19839,7 +19842,6 @@ local e_stripper=lpegpatterns.e_stripper local x_stripper=lpegpatterns.x_stripper local function stripelement(e,nolines,anywhere,everything) local edt=e.dt - print(nolines,anywhere,everything) if edt then local n=#edt if n==0 then @@ -25628,7 +25630,7 @@ do -- create closure to overcome 200 locals limit package.loaded["libs-ini"] = package.loaded["libs-ini"] or true --- original size: 5822, stripped down to: 3629 +-- original size: 5950, stripped down to: 3737 if not modules then modules={} end modules ['libs-ini']={ version=1.001, @@ -25648,7 +25650,9 @@ local findfile=resolvers.findfile local expandpaths=resolvers.expandedpathlistfromvariable local report=logs.reporter("resolvers","libraries") local trace=false +local silent=false trackers.register("resolvers.lib",function(v) trace=v end) +trackers.register("resolvers.lib.silent",function(v) silent=v end) local function findlib(required) local suffix=os.libsuffix or "so" if not qualifiedpath(required) then @@ -25749,10 +25753,10 @@ function libraries.optionalloaded(name,libnames) end end local initialized=thelib_initialize(unpack(libnames)) - if initialized then - report("using library '% + t'",libnames) - else + if not initialized then report("unable to initialize library '% + t'",libnames) + elseif not silent then + report("using library '% + t'",libnames) end return initialized end @@ -26211,8 +26215,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 : 1041734 --- stripped bytes : 411240 +-- original bytes : 1041889 +-- stripped bytes : 411275 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 0dddd1c21..b683bc729 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -5741,10 +5741,11 @@ do -- create closure to overcome 200 locals limit package.loaded["l-unicode"] = package.loaded["l-unicode"] or true --- original size: 41281, stripped down to: 17261 +-- original size: 41303, stripped down to: 17277 if not modules then modules={} end modules ['l-unicode']={ version=1.001, + optimize=true, comment="companion to luat-lib.mkiv", author="Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright="PRAGMA ADE / ConTeXt Development Team", @@ -8209,10 +8210,11 @@ do -- create closure to overcome 200 locals limit package.loaded["util-fil"] = package.loaded["util-fil"] or true --- original size: 11530, stripped down to: 9007 +-- original size: 11552, stripped down to: 9023 if not modules then modules={} end modules ['util-fil']={ version=1.001, + optimize=true, comment="companion to luat-lib.mkiv", author="Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright="PRAGMA ADE / ConTeXt Development Team", @@ -8577,10 +8579,11 @@ do -- create closure to overcome 200 locals limit package.loaded["util-sac"] = package.loaded["util-sac"] or true --- original size: 12946, stripped down to: 9507 +-- original size: 12968, stripped down to: 9523 if not modules then modules={} end modules ['util-sac']={ version=1.001, + optimize=true, comment="companion to luat-lib.mkiv", author="Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright="PRAGMA ADE / ConTeXt Development Team", @@ -19344,7 +19347,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true --- original size: 33747, stripped down to: 20989 +-- original size: 33708, stripped down to: 20953 if not modules then modules={} end modules ['lxml-aux']={ version=1.001, @@ -19839,7 +19842,6 @@ local e_stripper=lpegpatterns.e_stripper local x_stripper=lpegpatterns.x_stripper local function stripelement(e,nolines,anywhere,everything) local edt=e.dt - print(nolines,anywhere,everything) if edt then local n=#edt if n==0 then @@ -25628,7 +25630,7 @@ do -- create closure to overcome 200 locals limit package.loaded["libs-ini"] = package.loaded["libs-ini"] or true --- original size: 5822, stripped down to: 3629 +-- original size: 5950, stripped down to: 3737 if not modules then modules={} end modules ['libs-ini']={ version=1.001, @@ -25648,7 +25650,9 @@ local findfile=resolvers.findfile local expandpaths=resolvers.expandedpathlistfromvariable local report=logs.reporter("resolvers","libraries") local trace=false +local silent=false trackers.register("resolvers.lib",function(v) trace=v end) +trackers.register("resolvers.lib.silent",function(v) silent=v end) local function findlib(required) local suffix=os.libsuffix or "so" if not qualifiedpath(required) then @@ -25749,10 +25753,10 @@ function libraries.optionalloaded(name,libnames) end end local initialized=thelib_initialize(unpack(libnames)) - if initialized then - report("using library '% + t'",libnames) - else + if not initialized then report("unable to initialize library '% + t'",libnames) + elseif not silent then + report("using library '% + t'",libnames) end return initialized end @@ -26211,8 +26215,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 : 1041734 --- stripped bytes : 411240 +-- original bytes : 1041889 +-- stripped bytes : 411275 -- end library merge -- cgit v1.2.3