diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtx-cache.lua | 29 | ||||
-rw-r--r-- | scripts/context/lua/mtx-fonts.lua | 2 | ||||
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 31 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 31 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 31 | ||||
-rw-r--r-- | scripts/context/stubs/win64/mtxrun.lua | 31 |
6 files changed, 132 insertions, 23 deletions
diff --git a/scripts/context/lua/mtx-cache.lua b/scripts/context/lua/mtx-cache.lua index bff1cb496..f0c0ae0ed 100644 --- a/scripts/context/lua/mtx-cache.lua +++ b/scripts/context/lua/mtx-cache.lua @@ -22,13 +22,19 @@ local helpinfo = [[ <flag name="list"><short>show cache</short></flag> </subcategory> <subcategory> - <flag name="all"><short>all (not yet implemented)</short></flag> + <flag name="fonts"><short>only wipe fonts</short></flag> </subcategory> </category> </flags> </application> ]] + +local find = string.find +local filesuffix, replacesuffix = file.suffix, file.replacesuffix +local isfile = lfs.isfile +local remove = os.remove + local application = logs.application { name = "mtx-cache", banner = "ConTeXt & MetaTeX Cache Management 0.10", @@ -45,7 +51,7 @@ local function collect(path) local tmas, tmcs, rest = { }, { }, { } for i=1,#all do local name = all[i] - local suffix = file.suffix(name) + local suffix = filesuffix(name) if suffix == "tma" then tmas[#tmas+1] = name elseif suffix == "tmc" then @@ -70,19 +76,22 @@ end local function purge(banner,path,list,all) report("%s: %s",banner,path) report() + local fonts = environment.argument("fonts") local n = 0 for i=1,#list do local filename = list[i] - if string.find(filename,"luatex%-cache") then -- safeguard - if all then - os.remove(filename) + if find(filename,"luatex%-cache") then -- safeguard + if fonts and not find(filename,"fonts") then + -- skip + elseif all then + remove(filename) n = n + 1 - else - local suffix = file.suffix(filename) + elseif not fonts or find(filename,"fonts") then + local suffix = filesuffix(filename) if suffix == "tma" then - local checkname = file.replacesuffix(filename,"tma","tmc") - if lfs.isfile(checkname) then - os.remove(filename) + local checkname = replacesuffix(filename,"tma","tmc") + if isfile(checkname) then + remove(filename) n = n + 1 end end diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua index 6c25760af..0a404c67e 100644 --- a/scripts/context/lua/mtx-fonts.lua +++ b/scripts/context/lua/mtx-fonts.lua @@ -15,7 +15,7 @@ local nameonly, basename, joinpath, collapsepath = file.nameonly, file.basename, local lower = string.lower local otfversion = 2.826 -local otlversion = 3.026 +local otlversion = 3.027 local helpinfo = [[ <?xml version="1.0"?> diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index f5bd13761..4d38a34f9 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -4031,7 +4031,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-dir"] = package.loaded["l-dir"] or true --- original size: 17358, stripped down to: 11378 +-- original size: 18247, stripped down to: 12022 if not modules then modules={} end modules ['l-dir']={ version=1.001, @@ -4295,6 +4295,31 @@ local function globfiles(path,recurse,func,files) return files end dir.globfiles=globfiles +local function globdirs(path,recurse,func,files) + if type(func)=="string" then + local s=func + func=function(name) return find(name,s) end + end + files=files or {} + local noffiles=#files + for name in walkdir(path) do + if find(name,"^%.") then + else + local mode=attributes(name,'mode') + if mode=="directory" then + if not func or func(name) then + noffiles=noffiles+1 + files[noffiles]=path.."/"..name + if recurse then + globdirs(path.."/"..name,recurse,func,files) + end + end + end + end + end + return files +end +dir.globdirs=globdirs function dir.ls(pattern) return concat(glob(pattern),"\n") end @@ -18848,8 +18873,8 @@ end -- of closure -- used libraries : l-lua.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-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 trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 802032 --- stripped bytes : 291598 +-- original bytes : 802921 +-- stripped bytes : 291843 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index f5bd13761..4d38a34f9 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -4031,7 +4031,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-dir"] = package.loaded["l-dir"] or true --- original size: 17358, stripped down to: 11378 +-- original size: 18247, stripped down to: 12022 if not modules then modules={} end modules ['l-dir']={ version=1.001, @@ -4295,6 +4295,31 @@ local function globfiles(path,recurse,func,files) return files end dir.globfiles=globfiles +local function globdirs(path,recurse,func,files) + if type(func)=="string" then + local s=func + func=function(name) return find(name,s) end + end + files=files or {} + local noffiles=#files + for name in walkdir(path) do + if find(name,"^%.") then + else + local mode=attributes(name,'mode') + if mode=="directory" then + if not func or func(name) then + noffiles=noffiles+1 + files[noffiles]=path.."/"..name + if recurse then + globdirs(path.."/"..name,recurse,func,files) + end + end + end + end + end + return files +end +dir.globdirs=globdirs function dir.ls(pattern) return concat(glob(pattern),"\n") end @@ -18848,8 +18873,8 @@ end -- of closure -- used libraries : l-lua.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-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 trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 802032 --- stripped bytes : 291598 +-- original bytes : 802921 +-- stripped bytes : 291843 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index f5bd13761..4d38a34f9 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -4031,7 +4031,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-dir"] = package.loaded["l-dir"] or true --- original size: 17358, stripped down to: 11378 +-- original size: 18247, stripped down to: 12022 if not modules then modules={} end modules ['l-dir']={ version=1.001, @@ -4295,6 +4295,31 @@ local function globfiles(path,recurse,func,files) return files end dir.globfiles=globfiles +local function globdirs(path,recurse,func,files) + if type(func)=="string" then + local s=func + func=function(name) return find(name,s) end + end + files=files or {} + local noffiles=#files + for name in walkdir(path) do + if find(name,"^%.") then + else + local mode=attributes(name,'mode') + if mode=="directory" then + if not func or func(name) then + noffiles=noffiles+1 + files[noffiles]=path.."/"..name + if recurse then + globdirs(path.."/"..name,recurse,func,files) + end + end + end + end + end + return files +end +dir.globdirs=globdirs function dir.ls(pattern) return concat(glob(pattern),"\n") end @@ -18848,8 +18873,8 @@ end -- of closure -- used libraries : l-lua.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-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 trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 802032 --- stripped bytes : 291598 +-- original bytes : 802921 +-- stripped bytes : 291843 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index f5bd13761..4d38a34f9 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -4031,7 +4031,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-dir"] = package.loaded["l-dir"] or true --- original size: 17358, stripped down to: 11378 +-- original size: 18247, stripped down to: 12022 if not modules then modules={} end modules ['l-dir']={ version=1.001, @@ -4295,6 +4295,31 @@ local function globfiles(path,recurse,func,files) return files end dir.globfiles=globfiles +local function globdirs(path,recurse,func,files) + if type(func)=="string" then + local s=func + func=function(name) return find(name,s) end + end + files=files or {} + local noffiles=#files + for name in walkdir(path) do + if find(name,"^%.") then + else + local mode=attributes(name,'mode') + if mode=="directory" then + if not func or func(name) then + noffiles=noffiles+1 + files[noffiles]=path.."/"..name + if recurse then + globdirs(path.."/"..name,recurse,func,files) + end + end + end + end + end + return files +end +dir.globdirs=globdirs function dir.ls(pattern) return concat(glob(pattern),"\n") end @@ -18848,8 +18873,8 @@ end -- of closure -- used libraries : l-lua.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-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 trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 802032 --- stripped bytes : 291598 +-- original bytes : 802921 +-- stripped bytes : 291843 -- end library merge |