[latex3-commits] [git/LaTeX3-latex3-l3build] TDS: Support for tdslocations in uninstall target (4605094)

Joseph Wright joseph.wright at morningstar2.co.uk
Fri Jul 26 22:57:18 CEST 2019


Repository : https://github.com/latex3/l3build
On branch  : TDS
Link       : https://github.com/latex3/l3build/commit/46050942d4d6d6ac44cb3497cb59ce60ba6c1a78

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

commit 46050942d4d6d6ac44cb3497cb59ce60ba6c1a78
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Jul 26 21:57:18 2019 +0100

    Support for tdslocations in uninstall target


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

46050942d4d6d6ac44cb3497cb59ce60ba6c1a78
 l3build-install.lua | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/l3build-install.lua b/l3build-install.lua
index c607e8d..d2222c8 100644
--- a/l3build-install.lua
+++ b/l3build-install.lua
@@ -41,9 +41,7 @@ local function gethome()
 end
 
 function uninstall()
-  local function uninstall_files(dir,subdir)
-    subdir = subdir or moduledir
-    dir = dir .. "/" .. subdir
+  local function zapdir(dir)
     local installdir = gethome() .. "/" .. dir
     if options["dry-run"] then
       local files = filelist(installdir)
@@ -61,6 +59,11 @@ function uninstall()
     end
     return 0
   end
+  local function uninstall_files(dir,subdir)
+    subdir = subdir or moduledir
+    dir = dir .. "/" .. subdir
+    return zapdir(dir)
+  end
   local errorlevel = 0
   -- Any script man files need special handling
   local manfiles = { }
@@ -84,13 +87,21 @@ function uninstall()
       print("- " .. v)
     end
   end
-  return   uninstall_files("doc")
+  errorlevel = uninstall_files("doc")
          + uninstall_files("source")
          + uninstall_files("tex")
          + uninstall_files("bibtex/bst",module)
          + uninstall_files("makeindex",module)
          + uninstall_files("scripts",module)
          + errorlevel
+  if errorlevel ~= 0 then return errorlevel end
+  -- Finally, clean up special locations
+  for _,location in ipairs(tdslocations) do
+    local path,glob = splitpath(location)
+    errorlevel = zapdir(path)
+    if errorlevel ~= 0 then return errorlevel end
+  end
+  return 0
 end
 
 function install_files(target,full,dry_run)





More information about the latex3-commits mailing list