[latex3-commits] [git/LaTeX3-latex3-l3build] standalone: New scriptfiles variable (see #50) (10cccd6)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Mar 6 10:04:13 CET 2018


Repository : https://github.com/latex3/l3build
On branch  : standalone
Link       : https://github.com/latex3/l3build/commit/10cccd6fa9ef15b19b70ec3e49e0ce3fc8a7aab0

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

commit 10cccd6fa9ef15b19b70ec3e49e0ce3fc8a7aab0
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Mar 5 21:41:55 2018 +0000

    New scriptfiles variable (see #50)
    
    At present, not 'active'.


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

10cccd6fa9ef15b19b70ec3e49e0ce3fc8a7aab0
 l3build-ctan.lua      |    4 ++-
 l3build-install.lua   |   82 ++++++++++++++++++++++++++++---------------------
 l3build-variables.lua |    1 +
 l3build.dtx           |    3 +-
 4 files changed, 53 insertions(+), 37 deletions(-)

diff --git a/l3build-ctan.lua b/l3build-ctan.lua
index da2e977..c0726a0 100644
--- a/l3build-ctan.lua
+++ b/l3build-ctan.lua
@@ -98,6 +98,7 @@ function copytds()
   install(unpackdir, "bibtex/bst", {bstfiles}, true)
   install(sourcefiledir, "source", {sourcelist})
   install(unpackdir, "tex", {installfiles})
+  install(unpackdir, "scripts", {scriptfiles}, true)
 end
 
 -- Standard versions of the main targets for building modules
@@ -222,7 +223,8 @@ function bundlectan()
     end
     typesetlist = excludelist(typesetfiles, {sourcefiles}, docfiledir)
     sourcelist = excludelist(
-      sourcefiles, {bstfiles, installfiles, makeindexfiles}, sourcefiledir
+      sourcefiles, {bstfiles, installfiles, makeindexfiles, scriptfiles},
+      sourcefiledir
     )
     copyctan()
     copytds()
diff --git a/l3build-install.lua b/l3build-install.lua
index 5fea175..c18677e 100644
--- a/l3build-install.lua
+++ b/l3build-install.lua
@@ -34,53 +34,65 @@ local function gethome()
 end
 
 function uninstall()
-  local installdir = gethome() .. "/tex/" .. moduledir
-  if options["dry-run"] then
-    print("\n" .. "Installation root: " .. installdir)
-    local files = filelist(installdir)
-    -- Deal with an empty directory
-    if next(files) then
-      print("\n" .. "Files for removal:")
-      for _,file in pairs(filelist(installdir)) do
-        print("- " .. file)
+  local function uninstall_files(target)
+    local installdir = gethome() .. target
+    if options["dry-run"] then
+      print("\n" .. "Installation root: " .. installdir)
+      local files = filelist(installdir)
+      -- Deal with an empty directory
+      if next(files) then
+        print("\n" .. "Files for removal:")
+        for _,file in pairs(filelist(installdir)) do
+          print("- " .. file)
+        end
+      else
+        print("No files present")
       end
+      return 0
     else
-      print("No files present")
+      return rmdir(installdir)
     end
-    return 0
-  else
-    return rmdir(installdir)
   end
+  return   uninstall_files("/tex/" .. moduledir)
+         + uninstall_files("/scripts/" .. module)
 end
 
+
 -- Locally install files: only deals with those extracted, not docs etc.
 function install()
-  local errorlevel = unpack()
-  if errorlevel ~= 0 then
-    return errorlevel
-  end
-  local installdir = gethome() .. "/tex/" .. moduledir
-  if options["dry-run"] then
-    print("\n" .. "Installation root: " .. installdir
-      .. "\n" .. "Installation files:"
-    )
-    for _,filetype in pairs(installfiles) do
-      for _,file in pairs(filelist(unpackdir,filetype)) do
-        print("- " .. file)
-      end
-    end
-    return 0
-  else
-    errorlevel = cleandir(installdir)
-    if errorlevel ~= 0 then
-      return errorlevel
+  local function install_files(files,target)
+    if not next(files) then
+      return 0
     end
-    for _,filetype in pairs(installfiles) do
-      errorlevel = cp(filetype, unpackdir, installdir)
+    local installdir = gethome() .. target
+    if options["dry-run"] then
+      print("\n" .. "Installation root: " .. installdir
+        .. "\n" .. "Installation files:"
+      )
+      for _,filetype in pairs(files) do
+        for _,file in pairs(filelist(unpackdir,filetype)) do
+          print("- " .. file)
+        end
+      end
+      return 0
+    else
+      errorlevel = cleandir(installdir)
       if errorlevel ~= 0 then
         return errorlevel
       end
+      for _,filetype in pairs(files) do
+        errorlevel = cp(filetype, unpackdir, installdir)
+        if errorlevel ~= 0 then
+          return errorlevel
+        end
+      end
     end
+    return 0
+  end
+  local errorlevel = unpack()
+  if errorlevel ~= 0 then
+    return errorlevel
   end
-  return 0
+  return   install_files(installfiles, "/tex/" .. moduledir)
+         + install_files(scriptfiles, "/scripts/" .. module)
 end
diff --git a/l3build-variables.lua b/l3build-variables.lua
index c7ecbb9..7144789 100644
--- a/l3build-variables.lua
+++ b/l3build-variables.lua
@@ -107,6 +107,7 @@ docfiles           = docfiles           or { }
 excludefiles       = excludefiles       or {"*~"}
 installfiles       = installfiles       or {"*.sty","*.cls"}
 makeindexfiles     = makeindexfiles     or {"*.ist"}
+scriptfiles        = scriptfiles        or { }
 sourcefiles        = sourcefiles        or {"*.dtx", "*.ins"}
 textfiles          = textfiles          or {"*.md", "*.txt"}
 typesetdemofiles   = typesetdemofiles   or { }
diff --git a/l3build.dtx b/l3build.dtx
index 71896a7..3537bda 100644
--- a/l3build.dtx
+++ b/l3build.dtx
@@ -85,8 +85,9 @@
 \luavarset{demofiles}         {\{\}}{Files which show how to use a module}
 \luavarset{docfiles}          {\{\}}{Files which are part of the documentation but should not be typeset}
 \luavarset{excludefiles}      {\{"*\string~"\}}{Files to ignore entirely (default for Emacs backup files)}
-\luavarset{installfiles}      {\{"*.sty","*.cls"\}}{Files to install to the \TeX{} tree and similar task}
+\luavarset{installfiles}      {\{"*.sty","*.cls"\}}{Files to install to the \texttt{text} area of the \texttt{texmf} tree}
 \luavarset{makeindexfiles}    {\{"*.ist"\}}{MakeIndex files to be included in a TDS-style zip}
+\luavarset{scriptfiles}       {\{ \}}{Files to install to the \texttt{scripts} area of the \texttt{texmf} tree}
 \luavarset{sourcefiles}       {\{"*.dtx", "*.ins"\}}{Files to copy for unpacking}
 \luavarset{textfiles}         {\{"*.md", "*.txt"\}}{Plain text files to send to CTAN as-is}
 \luavarset{typesetdemofiles}  {\{\}}{Files to typeset before the documentation for inclusion in main documentation files}





More information about the latex3-commits mailing list