From 1760a0b03b6692be28733a9c8450b13cec1ad7ab Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 17 Mar 2022 20:29:38 +0000 Subject: pyluatex (17mar22) git-svn-id: svn://tug.org/texlive/trunk@62765 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/lualatex/pyluatex/pyluatex-interpreter.py | 4 +--- Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua | 20 ++++++++++---------- Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-) (limited to 'Master/texmf-dist/tex/lualatex/pyluatex') diff --git a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex-interpreter.py b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex-interpreter.py index 77d09bbb645..5a21e6d0f0a 100644 --- a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex-interpreter.py +++ b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex-interpreter.py @@ -107,9 +107,7 @@ class Handler(socketserver.StreamRequestHandler): if __name__ == '__main__': try: - tex_file = sys.argv[1] - tex_file_folder = os.path.normpath(os.path.dirname(tex_file)) - sys.path.insert(0, tex_file_folder) + sys.path.insert(0, os.path.normpath(sys.argv[1])) except: pass diff --git a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua index 0b785239da9..efa80c75f41 100644 --- a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua +++ b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua @@ -45,16 +45,16 @@ local env_repl_mode = false local last_code = nil local last_output = nil -local function get_tex_file() +local function get_tex_file_folder() for k, v in ipairs(arg) do if not v:find("^%-") then - local path = lfs.currentdir() .. dir_sep .. v - if lfs.attributes(path, "mode") == "file" then - return path + local path = file.collapsepath(v, true) + if lfs.isfile(path) then + return file.pathpart(path) else - path = path .. ".tex" - if lfs.attributes(path, "mode") == "file" then - return path + path = file.addsuffix(path, "tex") + if lfs.isfile(path) then + return file.pathpart(path) end end end @@ -76,9 +76,9 @@ function pyluatex.start(executable, local_imports) local cmd = "" if local_imports then - local tex_file = get_tex_file() - if tex_file ~= nil then - cmd = " \"" .. tex_file .. "\"" + local tex_file_folder = get_tex_file_folder() + if tex_file_folder ~= nil then + cmd = " \"" .. tex_file_folder .. "\"" end end cmd = executable .. " \"" .. script .. "\"" .. cmd diff --git a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty index 3413dba4c3e..4d8325c8078 100644 --- a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty +++ b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty @@ -9,7 +9,7 @@ %% version 2005/12/01 or later. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{pyluatex}[2022/03/10 v0.4.3 Execute Python code on the fly] +\ProvidesPackage{pyluatex}[2022/03/16 v0.4.4 Execute Python code on the fly] \RequirePackage{expl3} \ExplSyntaxOn -- cgit v1.2.3