[latex3-commits] [git/LaTeX3-latex3-l3build] master: Use install_files() for ctan() target (fb6b975)
Joseph Wright
joseph.wright at morningstar2.co.uk
Sat Aug 4 15:21:20 CEST 2018
Repository : https://github.com/latex3/l3build
On branch : master
Link : https://github.com/latex3/l3build/commit/fb6b975f689fc377420dc56b468cc2511120be6a
>---------------------------------------------------------------
commit fb6b975f689fc377420dc56b468cc2511120be6a
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Sat Aug 4 14:19:54 2018 +0100
Use install_files() for ctan() target
>---------------------------------------------------------------
fb6b975f689fc377420dc56b468cc2511120be6a
l3build-ctan.lua | 115 +++---------------------------------------------------
1 file changed, 5 insertions(+), 110 deletions(-)
diff --git a/l3build-ctan.lua b/l3build-ctan.lua
index 875f50d..54c9373 100644
--- a/l3build-ctan.lua
+++ b/l3build-ctan.lua
@@ -22,9 +22,8 @@ for those people who are interested.
--]]
-local gsub = string.gsub
-local match = string.match
-local insert = table.insert
+local pairs = pairs
+local print = print
-- Copy files to the main CTAN release directory
function copyctan()
@@ -56,62 +55,6 @@ function copyctan()
end
end
--- Copy files to the correct places in the TDS tree
-function copytds()
- local function install(source, dest, files, tool)
- local moduledir = moduledir
- -- For material associated with secondary tools (BibTeX, MakeIndex)
- -- the structure needed is slightly different from those items going
- -- into the tex/doc/source trees
- if tool then
- -- "base" is reserved for the tools themselves: make the assumption
- -- in this case that the tdsroot name is the right place for stuff to
- -- go (really just for the team)
- if module == "base" then
- moduledir = tdsroot
- else
- moduledir = module
- end
- end
- -- Convert the file table(s) to a list of individual files
- local filenames = { }
- for _,i in ipairs(files) do
- for _,j in ipairs(i) do
- for file,_ in pairs(tree(source, j)) do
- insert(filenames, file)
- end
- end
- end
- -- The target is only created if there are actual files to install
- if next(filenames) ~= nil then
- local installdir = tdsdir .. "/" .. dest .. "/" .. moduledir
- mkdir(installdir)
- for _,i in ipairs(filenames) do
- cp(i, source, installdir)
- end
- end
- end
- install(
- docfiledir,
- "doc",
- {bibfiles, demofiles, docfiles, pdffiles, textfiles, typesetlist}
- )
- install(unpackdir, "makeindex", {makeindexfiles}, true)
- install(unpackdir, "bibtex/bst", {bstfiles}, true)
- install(sourcefiledir, "source", {sourcelist})
- install(unpackdir, "tex", {installfiles})
- install(unpackdir, "scripts", {scriptfiles}, true)
- -- Any script man files need special handling
- for _,glob in pairs(scriptmanfiles) do
- for file,_ in pairs(tree(docfiledir,glob)) do
- -- Man files should have a single-digit extension: the type
- local installdir = tdsdir .. "/doc/man/man" .. match(file,".$")
- mkdir(installdir)
- cp(file,docfiledir,installdir)
- end
- end
-end
-
-- Standard versions of the main targets for building modules
function ctan()
@@ -162,7 +105,9 @@ function ctan()
rmdir(tdsdir)
mkdir(tdsdir)
if standalone then
- errorlevel = bundlectan()
+ errorlevel = install_files(tdsdir,true)
+ if errorlevel ~=0 then return errorlevel end
+ copyctan()
else
errorlevel = call(modules, "bundlectan")
end
@@ -193,53 +138,3 @@ function ctan()
return errorlevel
end
-function bundlectan()
- -- Generate a list of individual file names excluding those in the second
- -- argument: the latter is a table
- local function excludelist(include, exclude, dir)
- local include = include or { }
- local exclude = exclude or { }
- local dir = dir or currentdir
- local includelist = { }
- local excludelist = { }
- for _,i in ipairs(exclude) do
- for _,j in ipairs(i) do
- for file,_ in pairs(tree(dir, j)) do
- excludelist[file] = true
- end
- end
- end
- for _,i in ipairs(include) do
- for file,_ in pairs(tree(dir, i)) do
- if not excludelist[file] then
- insert(includelist, file)
- end
- end
- end
- return includelist
- end
- unpack()
- local errorlevel = doc()
- if errorlevel == 0 then
- -- Work out what PDF files are available
- pdffiles = { }
- for _,i in ipairs(typesetfiles) do
- insert(pdffiles, (gsub(i, "%.%w+$", ".pdf")))
- end
- -- For the purposes here, any typesetting demo files need to be
- -- part of the main typesetting list
- local typesetfiles = typesetfiles
- for _,v in pairs(typesetdemofiles) do
- insert(typesetfiles, v)
- end
- typesetlist = excludelist(typesetfiles, {sourcefiles}, docfiledir)
- sourcelist = excludelist(
- sourcefiles, {bstfiles, installfiles, makeindexfiles, scriptfiles},
- sourcefiledir
- )
- copyctan()
- copytds()
- end
- return errorlevel
-end
-
More information about the latex3-commits
mailing list