function read_pkgpaths(file)
local paths = {}
for line in io.lines(file) do
local path = line:match("^%s*([^#%s]+)")
if path and path:match("^[^/]+/[^/]+$") then
table.insert(paths, path)
end
end
return paths
end
function scriptenv(run, env)
return { run = run, env = env or {} }
end
function dedent(s)
if s:sub(1, 1) == "\n" then
s = s:sub(2)
end
local min_indent
for line in s:gmatch("[^\n]+") do
local indent = line:match("^([ \t]*)[^ \t]")
if indent and (not min_indent or #indent < min_indent) then
min_indent = #indent
end
end
if not min_indent or min_indent == 0 then
return (s:gsub("%s+$", ""))
end
local result = {}
for line in (s .. "\n"):gmatch("(.-)\n") do
if #line >= min_indent then
result[#result + 1] = line:sub(min_indent + 1)
else
result[#result + 1] = ""
end
end
return (table.concat(result, "\n"):gsub("%s+$", ""))
end