[latex3-commits] [latex3/l3build] main: Move runcmd() to l3build-aux (6a9f282)

github at latex-project.org github at latex-project.org
Mon Jul 17 07:18:16 CEST 2023


Repository : https://github.com/latex3/l3build
On branch  : main
Link       : https://github.com/latex3/l3build/commit/6a9f28226722899b29d826e6d303880b58584f4e

>---------------------------------------------------------------

commit 6a9f28226722899b29d826e6d303880b58584f4e
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Jul 17 06:18:16 2023 +0100

    Move runcmd() to l3build-aux
    
    It is used in l3uild-check since e36f95c47b02d34ab6f3db8bb3c44b00bbca10b4.


>---------------------------------------------------------------

6a9f28226722899b29d826e6d303880b58584f4e
 l3build-aux.lua         | 22 ++++++++++++++++++++++
 l3build-typesetting.lua | 21 ---------------------
 2 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/l3build-aux.lua b/l3build-aux.lua
index 7b97b08..6e046bd 100644
--- a/l3build-aux.lua
+++ b/l3build-aux.lua
@@ -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
 --
@@ -179,3 +181,23 @@ 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 = os_setenv .. " TEXMFCNF=." .. os_pathsep
+  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
+    env = env .. os_concat .. os_setenv .. " " .. var .. "=" .. envpaths
+  end
+  return run(dir,set_epoch_cmd(epoch, forcedocepoch) .. env .. os_concat .. cmd)
+end
\ No newline at end of file
diff --git a/l3build-typesetting.lua b/l3build-typesetting.lua
index 49bc82f..d0e491d 100644
--- a/l3build-typesetting.lua
+++ b/l3build-typesetting.lua
@@ -31,30 +31,9 @@ local pairs  = pairs
 local print  = print
 
 local gsub  = string.gsub
-local match = string.match
 
 local os_type = os.type
 
--- An auxiliary used to set 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 = os_setenv .. " TEXMFCNF=." .. os_pathsep
-  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
-    env = env .. os_concat .. os_setenv .. " " .. var .. "=" .. envpaths
-  end
-  return run(dir,set_epoch_cmd(epoch, forcedocepoch) .. env .. os_concat .. cmd)
-end
-
 function dvitopdf(name, dir, engine, hide)
   runcmd(
     set_epoch_cmd(epoch, forcecheckepoch) ..





More information about the latex3-commits mailing list.