summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/lualibs/lualibs-package.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-09-26 20:49:48 +0000
committerKarl Berry <karl@freefriends.org>2018-09-26 20:49:48 +0000
commit3a0140d05a7e481750ec23a30ed5cf3cdef61eb7 (patch)
tree8fac1dc16795d22db3b45205fa55db220a9beed4 /Master/texmf-dist/tex/luatex/lualibs/lualibs-package.lua
parentb573c63f79c24b5c8dff312e023c2745b49f6089 (diff)
lualibs (26sep18)
git-svn-id: svn://tug.org/texlive/trunk@48770 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/lualibs/lualibs-package.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/lualibs/lualibs-package.lua44
1 files changed, 41 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-package.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-package.lua
index 075fcde25ae..0dd71e5eca8 100644
--- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-package.lua
+++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-package.lua
@@ -18,11 +18,15 @@ if not modules then modules = { } end modules ['l-package'] = {
local type = type
local gsub, format, find = string.gsub, string.format, string.find
+local insert, remove = table.insert, table.remove
local P, S, Cs, lpegmatch = lpeg.P, lpeg.S, lpeg.Cs, lpeg.match
-local package = package
-local searchers = package.searchers or package.loaders
+local package = package
+local searchers = package.searchers or package.loaders
+
+-------.loaders = nil -- old stuff that we don't want
+-------.seeall = nil -- old stuff that we don't want
-- dummies
@@ -191,7 +195,25 @@ local function registerpath(tag,what,target,...)
add(path)
end
end
- return paths
+end
+
+local function pushpath(tag,what,target,path)
+ local path = helpers.cleanpath(path)
+ insert(target,1,path)
+ if helpers.trace then
+ helpers.report("pushing %s path in front: %s",tag,path)
+ end
+end
+
+local function poppath(tag,what,target)
+ local path = remove(target,1)
+ if helpers.trace then
+ if path then
+ helpers.report("popping %s path from front: %s",tag,path)
+ else
+ helpers.report("no %s path to pop",tag)
+ end
+ end
end
helpers.registerpath = registerpath
@@ -199,10 +221,22 @@ helpers.registerpath = registerpath
function package.extraluapath(...)
registerpath("extra lua","lua",extraluapaths,...)
end
+function package.pushluapath(path)
+ pushpath("extra lua","lua",extraluapaths,path)
+end
+function package.popluapath()
+ poppath("extra lua","lua",extraluapaths)
+end
function package.extralibpath(...)
registerpath("extra lib","lib",extralibpaths,...)
end
+function package.pushlibpath(path)
+ pushpath("extra lib","lib",extralibpaths,path)
+end
+function package.poplibpath()
+ poppath("extra lib","lua",extralibpaths)
+end
-- lib loader (used elsewhere)
@@ -360,3 +394,7 @@ end
-- front ..
table.insert(searchers,1,helpers.loaded)
+
+if context then
+ package.path = ""
+end