-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make digestif working with ConTeXt standalone installation #68
base: main
Are you sure you want to change the base?
Make digestif working with ConTeXt standalone installation #68
Conversation
…txrun texlua.lua' for Context standalone installation
local ok = os.execute(format(is_command_cmd, name)) | ||
return ok and name or nil | ||
local ok, err = pcall(os.execute, format(is_command_cmd, name)) | ||
return err == 0 and ok and name or nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change needed? There is a difference between is_command_cmd exiting with non-zero status (which happens if a command named name
doesn't exist) and the os.execute
call failing, which presumably never happens.
Are you on Windows by any chance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this one was got my Macbook. I wasn't able to run digestiff and went on debugging why it happened. ok
was truthy even if command in this case texlua
was not available. Using pcall
and checking for error code seem to solve it. I admit that I am not a Lua programmer.
local fullpath = debug.getinfo(1,"S").source:sub(2) | ||
if arg[1] == fullpath then | ||
table.remove(arg, 1) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Funny, I can't observe the issue you describe here. I've tried texlua
, luatex --luaonly
and mtxrun --execute
, and fullpath
is always given as arg[0]
.
What is arg[0]
in your situation? (And which platform?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably unique to standalone ConTeXt which I have installed on my Macbook. It does not have texlua
and the suggestion was to use Lua engine from LuaMetatex
which is accessible through the Lua script texlua.lua
. This is how my ConTeXt bin
directory looks like
lrwxr-xr-x 1 evgeniysharapov staff 10B Jul 3 00:21 context -> luametatex
-rw-r--r-- 1 evgeniysharapov staff 1.3K Jul 3 00:21 context.lua
-rwxr-xr-x 1 evgeniysharapov staff 3.0M Jul 3 00:21 luametatex
lrwxr-xr-x 1 evgeniysharapov staff 10B Jul 3 00:21 mtxrun -> luametatex
-rw-r--r-- 1 evgeniysharapov staff 685K Jul 3 00:21 mtxrun.lua
lrwxr-xr-x 1 evgeniysharapov staff 10B Jul 24 22:29 texlua -> luametatex
lrwxr-xr-x 1 evgeniysharapov staff 80B Jul 24 22:33 texlua.lua -> /Users/evgeniysharapov/.ConTeXt/tex/texmf-context/scripts/context/lua/texlua.lua
[evgeniysharapov@SharMbp:~/.ConTeXt/tex/texmf-osx-64/bin]
When I run digestif
I get following arg
table
arg[0] = texlua
arg[1] = /Users/evgeniysharapov/.digestif/bin/digestif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, this is a bug in texlua.lua
then. It's a kind of universal expectation that arg[1] is the first argument to the script, no matter how it was invoked. For comparison:
$ python -c "import sys; print(sys.argv)" 1 2 3
['-c', '1', '2', '3']
$ python -O -c "import sys; print(sys.argv)" 1 2 3
['-c', '1', '2', '3']
$ python -O -S -c "import sys; print(sys.argv)" 1 2 3
['-c', '1', '2', '3']
As you can see, the script doesn't see the previous argument -O
etc.
But in any case it seems you can use luametatex --luaonly [lua_file]
and it handles the arguments correctly.
elseif util.is_command("mtxrun") then | ||
-- this is a standalone ConTeXt installation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have mtxrun
in my system and it's a TeXlive installation...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think the issue I experienced is unique to ConTeXt standalone installation.
The link you provided in your comment says:
Are you really referring to "ConTeXt standalone" or do you mean LMTX? |
I have a ConTeXt standalone installation. The caveat is it relies on
LuaMetaTex
and Lua scripts instead of prograps that come with TeX Live installation, s.a.kpsewhich
andtexlua
. To makedigestif
work for me I had to alter the code a little bit.