-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
l3build-setup.lua defines execute51 and a local require
- Loading branch information
Showing
5 changed files
with
112 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--[[ | ||
File l3build-file-functions.lua Copyright (C) 2018-2024 The LaTeX Project | ||
It may be distributed and/or modified under the conditions of the | ||
LaTeX Project Public License (LPPL), either version 1.3c of this | ||
license or (at your option) any later version. The latest version | ||
of this license is in the file | ||
https://www.latex-project.org/lppl.txt | ||
This file is part of the "l3build bundle" (The Work in LPPL) | ||
and all files in that bundle must be distributed together. | ||
----------------------------------------------------------------------- | ||
The development version of the bundle can be found at | ||
https://github.com/latex3/l3build | ||
for those people who are interested. | ||
--]] | ||
|
||
--[[ | ||
The very first call: | ||
require("l3build-setup") | ||
Then | ||
local l3B = require("l3build") | ||
After that, we have access to `L3B.execute51`, and `l3B.require`. | ||
]] | ||
-- reentrant management, in case of L3B.require("setup") | ||
if package.loaded.l3build then | ||
return package.loaded.l3build | ||
end | ||
|
||
local M = { -- the return table | ||
_DESCRIPTION = "l3build main table" | ||
} | ||
|
||
package.loaded.l3build = M -- from now on `require("l3build")` returns M | ||
|
||
local execute = os.execute -- version 5.1 see https://tug.org/pipermail/luatex/2015-November/005535.html | ||
|
||
---Execute a command sticking version 5.1 output | ||
--- | ||
---`texlua` 1.18 uses Lua 5.3 except for `os.execute` which is still 5.1. | ||
---A wrapper will simplify migration to Lua 5.4, if ever. | ||
---@param command string? | ||
---@return integer | ||
function M.execute51(command) | ||
---@diagnostic disable-next-line: return-type-mismatch | ||
return execute(command) | ||
end | ||
|
||
---Wrapper over `require` | ||
--- | ||
---Returns only one value as of Lua 5.3. Ready for Lua 5.4. | ||
---@param module string without the "l3build-" prefix | ||
---@return unknown | ||
---@usage Public | ||
function M.require(module) | ||
local ans = require("l3build-"..module) | ||
return ans | ||
end | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters