texlive[44235] Master/bin/win32/runscript.tlu: update runscript for

commits+preining at tug.org commits+preining at tug.org
Sun May 7 11:20:40 CEST 2017


Revision: 44235
          http://tug.org/svn/texlive?view=revision&revision=44235
Author:   preining
Date:     2017-05-07 11:20:39 +0200 (Sun, 07 May 2017)
Log Message:
-----------
update runscript for more sys/user scripts

Modified Paths:
--------------
    trunk/Master/bin/win32/runscript.tlu

Modified: trunk/Master/bin/win32/runscript.tlu
===================================================================
--- trunk/Master/bin/win32/runscript.tlu	2017-05-07 00:06:47 UTC (rev 44234)
+++ trunk/Master/bin/win32/runscript.tlu	2017-05-07 09:20:39 UTC (rev 44235)
@@ -259,6 +259,9 @@
         - Cater for fmtutil-user and updmap-user => -user arg        
     2017/04/24
         - GS_LIB setting for tlgs.
+    2017/05/06
+        - introduce sys_user_progs, make checks for updmap/fmtutil
+          use sys_user_progs instead, add kanji-config-updmap
 ]]
 
 -- HELPER SUBROUTINES --
@@ -312,6 +315,16 @@
   return false
 end
 
+-- checks whether an item is in an array
+local function contains (tab, val)
+  for index, value in ipairs(tab) do
+    if value == val then
+      return true
+    end
+  end
+  return false
+end
+
 -- locates texmfscript to execute
 local function find_texmfscript(progname, ext_list)
   ext_list = ext_list or '\0'
@@ -448,6 +461,7 @@
 -- prevent recursive calls to this script
 assert(progname ~= 'runscript', "oops! wrapping the wrapper?")
 
+
 -- kpse and environment set-up
 
 -- init kpathsea 
@@ -455,11 +469,16 @@
 while arg[k-1] do k = k - 1 end -- in case of a call: luatex --luaonly ...
 local lua_binary = arg[k]
 kpse.set_program_name(lua_binary, progname)
+
 -- various dir-vars
 local TEXDIR = kpse.var_value('SELFAUTOPARENT')
 local TEXMFDIST = kpse.var_value('TEXMFDIST')
 local BINDIR = kpse.var_value('SELFAUTOLOC')
 local PATH = os.getenv('PATH') or ''
+
+-- list of programs that have -sys and -user variants
+local sys_user_progs = { 'updmap', 'fmtutil', 'kanji-config-updmap' }
+
 -- restricted programs
 local shell_escape_commands = string.lower(kpse.var_value('shell_escape_commands') or '')
 local is_restricted_progname = string.find( ','..shell_escape_commands..',', 
@@ -554,7 +573,7 @@
 os.setenv('PATH', PATH);
 
 -- sys stuff
-if (sysprog and not (progname == 'updmap') and not (progname == 'fmtutil')) then
+if (sysprog and not contains(sys_user_progs, progname)) then
   os.setenv('TEXMFVAR', kpse.var_value('TEXMFSYSVAR'))
   os.setenv('TEXMFCONFIG', kpse.var_value('TEXMFSYSCONFIG'))
 end
@@ -598,18 +617,12 @@
   progname = 'mk4ht'
 elseif progname == 'a2ping' then 
   table.insert(extension_map['.pl'], '-x')
-elseif progname == 'updmap' then 
+elseif contains(sys_user_progs, progname) then 
   if sysprog then
     argline = ' --sys ' .. argline
   elseif userprog then
     argline = ' --user ' .. argline
   end
-elseif progname == 'fmtutil' then 
-  if sysprog then
-    argline = ' --sys ' .. argline
-  elseif userprog then
-    argline = ' --user ' .. argline
-  end
 elseif progname == 'asy' then
   os.setenv('ASYMPTOTE_GS', GSEXE)
   os.setenv('CYGWIN', 'nodosfilewarning')



More information about the tex-live-commits mailing list