summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3build/l3build-aux.lua
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3build/l3build-aux.lua')
-rw-r--r--macros/latex/contrib/l3build/l3build-aux.lua35
1 files changed, 32 insertions, 3 deletions
diff --git a/macros/latex/contrib/l3build/l3build-aux.lua b/macros/latex/contrib/l3build/l3build-aux.lua
index 2f6902a7b0..5511802c16 100644
--- a/macros/latex/contrib/l3build/l3build-aux.lua
+++ b/macros/latex/contrib/l3build/l3build-aux.lua
@@ -1,6 +1,6 @@
--[[
-File l3build-aux.lua Copyright (C) 2018-2021 The LaTeX Project
+File l3build-aux.lua Copyright (C) 2018-2021,2023 The LaTeX Project
It may be distributed and/or modified under the conditions of the
LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -32,6 +32,8 @@ local print = print
local lookup = kpse.lookup
local os_time = os.time
+local os_type = os.type
+
--
-- Auxiliary functions which are used by more than one main function
--
@@ -133,9 +135,9 @@ function call(modules, target, opts)
for _, module in ipairs(modules) do
local text
if module == "." and opts["config"] and #opts["config"]>0 then
- text = " with configuration " .. opts["config"][1]
+ text = " and configuration \"" .. opts["config"][1] .. "\""
else
- text = " for module " .. module
+ text = " for module \"" .. module .. "\""
end
print("Running l3build with target \"" .. target .. "\"" .. text )
local error_level = run(
@@ -179,3 +181,30 @@ function localtexmf()
end
return paths
end
+
+-- Run a command after setting up the environmental variables
+function runcmd(cmd,dir,vars)
+ dir = dir or "."
+ dir = abspath(dir)
+ vars = vars or {}
+ -- Allow for local texmf files
+ local env = ""
+ if not match(checkformat,"^context$") then
+ env = os_setenv .. " TEXMFCNF=." .. os_pathsep .. os_concat
+ end
+ local envpaths = "." .. localtexmf() .. os_pathsep
+ .. abspath(localdir) .. os_pathsep
+ .. dir .. (typesetsearch and os_pathsep or "")
+ -- Deal with spaces in paths
+ if os_type == "windows" and match(envpaths," ") then
+ envpaths = gsub(envpaths,'"','')
+ end
+ for _,var in pairs(vars) do
+ if env ~= "" then
+ env = env .. os_setenv .. " " .. var .. "=" .. envpaths .. os_concat
+ else
+ env = os_setenv .. " " .. var .. "=" .. envpaths
+ end
+ end
+ return run(dir,set_epoch_cmd(epoch, forcedocepoch) .. env .. cmd)
+end \ No newline at end of file