latex3 / l3build

A testing and building system for LaTeX
LaTeX Project Public License v1.3c
84 stars 14 forks source link

inconsistency in require #363

Closed jlaurens closed 6 days ago

jlaurens commented 2 weeks ago

In l3build.lua we have a local function build_require to require various packages. In l3build-ctan.lua, we have require"l3build-zip". Consider next layout

abc/ abc.dtx
     abc.ins
     build.lua
     l3build-<whatever>.lua
     l3build-zip.lua 
     README.md
     support/
     testfiles/

If you run l3build on this package, the local l3build-zip.lua will replace the global one, but not the other l3build-<whatever>.lua.

3 solutions

  1. always use require"l3build-...
  2. newzip = build_require"zip" in l3build.lua (another global variable) or l3build.newzip = build_require"zip" in l3build.lua (another global variable, but more friendly)
  3. make build_require global or call it l3build.require

solution 1 offers more possibilities.

josephwright commented 2 weeks ago

@zauguin Thoughts here?

jlaurens commented 2 weeks ago

One more situation to consider: real life testing. How would you build the various packages in the examples folder? Is it necessary to install the development version of l3build first? Can it be sandboxed?

zauguin commented 7 hours ago
  • always use require"l3build-...

  • newzip = build_require"zip" in l3build.lua (another global variable) or l3build.newzip = build_require"zip" in l3build.lua (another global variable, but more friendly)

  • make build_require global or call it l3build.require

Option 4 (which I'm in favor of): Add a searcher to make require'l3build-...' behave the same asbuild_require`.

I think generally for l3build it's much nicer to always have a consistent set of versions without local replacements. Also this avoids picking up partially installed versions. That shouldn't depend on the call syntax though.