From 3917441f015eb84d969489a2dfb8e0c85142d0c0 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 17 Mar 2022 20:29:51 +0000 Subject: pyluatex (17mar22) (branch) git-svn-id: svn://tug.org/texlive/branches/branch2021.final@62766 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf | Bin 81863 -> 81863 bytes .../texmf-dist/doc/lualatex/pyluatex/pyluatex.tex | 2 +- .../tex/lualatex/pyluatex/pyluatex-interpreter.py | 4 +--- .../texmf-dist/tex/lualatex/pyluatex/pyluatex.lua | 20 ++++++++++---------- .../texmf-dist/tex/lualatex/pyluatex/pyluatex.sty | 2 +- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf index 62127e2871c..82ff4f85bf1 100644 Binary files a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf and b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf differ diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex index eeff387c21d..c4a10738ac0 100644 --- a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex +++ b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex @@ -15,7 +15,7 @@ \usepackage{url} \title{The \emph{pyluatex} package} \author{Tobias Enderle\\\url{https://github.com/tndrle/PyLuaTeX}} -\date{v0.4.3 (2022/03/10)} +\date{v0.4.4 (2022/03/16)} \begin{document} \maketitle \raggedright 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