[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua module search path for vendor and site
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 30 Mar 2015 17:42:19 +0200
2015-03-30 13:02 GMT+02:00 Natanael Copa <natanael.copa@gmail.com>:
> What I would like propose is that upstream Lua provides the concept of
> vendor_prefix and site_prefix so we could have a clean way to specify the
> vendor and site search paths.
> ...
>
> It would also be awesome if this could be detected at runtime:
>
> lua -e 'print(package.vendor_path)'
> lua -e 'print(package.site_path)'
The present package management system is highly monkey-patchable.
Everything you propose and more can be achieved by customizing
package.searchers.
For example, LuaTeX completely replaces all the usual Lua searchers
by the highly powerful kpse searcher.
~~~
$ luatex
This is LuaTeX, Version beta-0.76.0-2013121407 (rev 4627)
restricted \write18 enabled.
**\directlua{print(_VERSION); require"foo"}
Lua 5.2
! LuaTeX error [string "\directlua "]:1: module 'foo' not found:
no field package.preload['foo']
[kpse lua searcher] file not found: 'foo'
[kpse C searcher] file not found: 'foo'
stack traceback:
[C]: in function 'require'
[string "\directlua "]:1: in main chunk.
<*> \directlua{print(_VERSION); require"foo"}
~~~
The line after "**" in the above example is keyboard input, the
rest is output from the program.
Behind your proposal lurks a more basic assumption: that the Lua
community agrees on the need for an official distinction between
the somewhat Pythonic concepts of "vendor" and "site".
I fear we are not sufficiently disciplined for that. This is
a community that has not yet agreed on:
1. How to name executables and directories when more than one
Lua version is installed.
2. Whether some contributed packages (even those contributed by
Roberto and Luiz) should be considered "standard" in some way.