From f636f03506fe8c34d8353b068efb40879606ae5e Mon Sep 17 00:00:00 2001 From: Joseph Wright Date: Tue, 6 Mar 2018 07:25:30 +0000 Subject: [PATCH] Load variables only once (see #50) This should allow both forms of usage, for the present, but without having to reload files. --- l3build.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/l3build.lua b/l3build.lua index 054043d6..4918e7ef 100644 --- a/l3build.lua +++ b/l3build.lua @@ -41,6 +41,7 @@ local tonumber = tonumber local exit = os.exit -- l3build setup and functions +-- Note that global (config) variables are done a little later kpse.set_program_name("kpsewhich") build_kpse_path = string.match(lookup("l3build.lua"),"(.*[/])") @@ -48,7 +49,6 @@ local function build_require(s) require(lookup("l3build-"..s..".lua", { path = build_kpse_path } ) ) end -build_require("variables") build_require("arguments") build_require("file-functions") build_require("typesetting") @@ -78,15 +78,16 @@ if match(arg[0], "l3build(%.lua)$") then elseif fileexists("build.lua") then -- Force these to be undefined: needed for the reloading step dofile("build.lua") - -- Reload the variables to set things up correctly - -- Has to be dofile() as require() doesn't reload - dofile(lookup("l3build-variables.lua", { path = build_kpse_path } )) else print("Error: Cannot find configuration build.lua") exit(1) end end +-- Load standard settings for variables: +-- comes after any user versions +build_require("variables") + -- Tidy up the epoch setting -- Force an epoch if set at the command line -- Must be done after loading variables, etc.