Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
matrix:
lua-version: ["5.3", "5.4"]
Expand All @@ -18,6 +18,8 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install readline
run: sudo apt-get update && sudo apt-get install -y libreadline-dev
- name: Install dependencies
run: |
pip install hererocks==0.25.1 -r spec/requirements.txt
Expand Down
5 changes: 2 additions & 3 deletions bin/digestif.texlua
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ package.cpath = package.cpath:gsub("%f[^\0;]%.[^;]*", ""):gsub(";+", ";"):gsub("
-- Use an invalid directory name in order not to allow kpse to search
-- in the current directory.
os.setenv("TEXMFDOTDIR", package.config:find("^\\") and "NUL" or "/dev/null")
kpse.set_program_name("luatex")
local zip = require "zip"
local archive = kpse.find_file("digestif.zip", "texmfscripts")
local archive = kpse.new("texlua"):find_file("digestif.zip", "texmfscripts")
or error("Can't find 'digestif.zip' archive")
local zip = require "zip"
local function digestif_searcher(modname)
local submod = modname:match("^digestif%.(.+)")
if not submod then return end
Expand Down
50 changes: 27 additions & 23 deletions digestif/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,9 @@ if pre_version then
config.version = config.version .. "-" .. pre_version
end

if util.is_command("kpsewhich") then
local pipe = io.popen("kpsewhich -var-brace-value=TEXMF")
local output = pipe:read("l")
local ok, exitt, exitc = pipe:close()
if ok and exitt == "exit" and exitc == 0 then
config.texmf_dirs = util.imap(
function (s) return s:gsub("^!!", "") end,
util.path_list_split(output)
)
elseif config.verbose then
util.log("Error running kpsewhich (%s %d)", exitt, exitc)
end
else -- TODO: What should be the default?
config.texmf_dirs = {
"/usr/local/share/texmf",
"/usr/share/texmf",
"/usr/share/texlive/texmf-local",
"/usr/share/texlive/texmf-dist",
}
end

config.data_dirs = {} -- TODO: What should be the default?
-- TODO: What should be the default?
config.texmf_dirs = {}
config.data_dirs = {}

-- Location of a complete texmf distribution, used for instance to
-- find documentation not installed locally. Passed to format with
Expand Down Expand Up @@ -129,15 +110,38 @@ function config.load_from_env()
config.data_dirs = util.path_list_split(DIGESTIF_DATA)
end

local ok, kpse = pcall(function() return _G.kpse.new("texlua") end)
kpse = ok and kpse or nil
local DIGESTIF_TEXMF = os.getenv("DIGESTIF_TEXMF")
if DIGESTIF_TEXMF then
config.texmf_dirs = util.path_list_split(DIGESTIF_TEXMF)
elseif kpse then
local paths = kpse:expand_braces(kpse:var_value("TEXMF"))
config.texmf_dirs = util.imap(
function(s) return s:gsub("^!!", "") end,
util.path_list_split(paths)
)
elseif util.is_command("kpsewhich") then
local pipe = io.popen("kpsewhich -var-brace-value=TEXMF")
local paths = pipe:read("l")
local ok, exitt, exitc = pipe:close()
if ok and exitt == "exit" and exitc == 0 then
config.texmf_dirs = util.imap(
function(s) return s:gsub("^!!", "") end,
util.path_list_split(paths)
)
elseif config.verbose then
util.log("Error running kpsewhich (%s %d)", exitt, exitc)
end
end
if #config.texmf_dirs == 0 then
util.log("Couldn't initialize DIGESTIF_TEXMF")
end

local DIGESTIF_TLPDB = os.getenv("DIGESTIF_TLPDB")
if DIGESTIF_TLPDB then
config.tlpdb_path = util.path_list_split(DIGESTIF_TLPDB)
end
end -- TODO: copy rest of init from data.lua
end

function config.check_data(dir)
Expand Down