texlive[68232] trunk: runtexshebang (10sep23)

commits+karl at tug.org commits+karl at tug.org
Sun Sep 10 21:42:49 CEST 2023


Revision: 68232
          http://tug.org/svn/texlive?view=revision&revision=68232
Author:   karl
Date:     2023-09-10 21:42:49 +0200 (Sun, 10 Sep 2023)
Log Message:
-----------
runtexshebang (10sep23)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/Makefile.am
    trunk/Build/source/texk/texlive/linked_scripts/Makefile.in
    trunk/Build/source/texk/texlive/linked_scripts/scripts.lst
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/libexec/ctan2tds
    trunk/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc

Added Paths:
-----------
    trunk/Build/source/texk/texlive/linked_scripts/runtexshebang/
    trunk/Build/source/texk/texlive/linked_scripts/runtexshebang/runtexshebang.lua
    trunk/Master/bin/aarch64-linux/runtexshebang
    trunk/Master/bin/amd64-freebsd/runtexshebang
    trunk/Master/bin/amd64-netbsd/runtexshebang
    trunk/Master/bin/armhf-linux/runtexshebang
    trunk/Master/bin/i386-freebsd/runtexshebang
    trunk/Master/bin/i386-linux/runtexshebang
    trunk/Master/bin/i386-netbsd/runtexshebang
    trunk/Master/bin/i386-solaris/runtexshebang
    trunk/Master/bin/universal-darwin/runtexshebang
    trunk/Master/bin/windows/runtexshebang.exe
    trunk/Master/bin/x86_64-cygwin/runtexshebang
    trunk/Master/bin/x86_64-darwinlegacy/runtexshebang
    trunk/Master/bin/x86_64-linux/runtexshebang
    trunk/Master/bin/x86_64-linuxmusl/runtexshebang
    trunk/Master/bin/x86_64-solaris/runtexshebang
    trunk/Master/texmf-dist/doc/support/runtexshebang/
    trunk/Master/texmf-dist/doc/support/runtexshebang/LICENSE
    trunk/Master/texmf-dist/doc/support/runtexshebang/README.md
    trunk/Master/texmf-dist/scripts/runtexshebang/
    trunk/Master/texmf-dist/scripts/runtexshebang/runtexshebang.lua
    trunk/Master/tlpkg/tlpsrc/runtexshebang.tlpsrc

Modified: trunk/Build/source/texk/texlive/linked_scripts/Makefile.am
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/Makefile.am	2023-09-10 19:28:40 UTC (rev 68231)
+++ trunk/Build/source/texk/texlive/linked_scripts/Makefile.am	2023-09-10 19:42:49 UTC (rev 68232)
@@ -211,6 +211,7 @@
 	pythontex/depythontex.py \
 	pythontex/pythontex.py \
 	rubik/rubikrotation.pl \
+	runtexshebang/runtexshebang.lua \
 	spix/spix.py \
 	splitindex/splitindex.pl \
 	srcredact/srcredact.pl \

Modified: trunk/Build/source/texk/texlive/linked_scripts/Makefile.in
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/Makefile.in	2023-09-10 19:28:40 UTC (rev 68231)
+++ trunk/Build/source/texk/texlive/linked_scripts/Makefile.in	2023-09-10 19:42:49 UTC (rev 68232)
@@ -427,6 +427,7 @@
 	pythontex/depythontex.py \
 	pythontex/pythontex.py \
 	rubik/rubikrotation.pl \
+	runtexshebang/runtexshebang.lua \
 	spix/spix.py \
 	splitindex/splitindex.pl \
 	srcredact/srcredact.pl \

Added: trunk/Build/source/texk/texlive/linked_scripts/runtexshebang/runtexshebang.lua
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/runtexshebang/runtexshebang.lua	                        (rev 0)
+++ trunk/Build/source/texk/texlive/linked_scripts/runtexshebang/runtexshebang.lua	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1,61 @@
+#!/usr/bin/env texlua
+
+-- This program is licensed under the terms of the MIT License.
+--
+-- Copyright (c) 2021-2023 Munehiro Yamamoto <munepixyz at gmail.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+if not ( #arg == 1 ) then
+   print("runtexshebang 20230909 v0.3")
+   print("")
+   print("Usage:	runtexshebang  [input.tex]")
+   os.exit(0)
+end
+
+local line_ctr = 0
+for line in io.lines(arg[1]) do
+   line_ctr = line_ctr + 1
+   if line_ctr > 20 then break end
+
+   if string.match(line, "^%%#!") then
+      tex_cmd, err=string.gsub(line, "%%#!", "")
+      tex_return = os.execute(tex_cmd)
+
+      -- if os.execute(texcmd) returns -1 on Windows, then
+      -- cmd.exe is not included in PATH, or some invalid string found before cmd.exe
+      if os.type == 'windows' and tex_return == -1 then
+         print("Invalid PATH setting found. Please ensure that cmd.exe can be found.\n")
+         os.exit(1)
+      end
+
+      -- if not tex_return == 0 then
+      --    print("TeX-style shebang processing of the below failed.\n" .. tex_cmd .. "\n")
+      --    os.exit(1)
+      -- end
+
+      os.exit(0)
+
+   -- else
+   --    print("TeX-style shebang not matched.\n")
+   end
+end
+
+print("TeX-style shebang not found.\n")
+os.exit(2)


Property changes on: trunk/Build/source/texk/texlive/linked_scripts/runtexshebang/runtexshebang.lua
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Modified: trunk/Build/source/texk/texlive/linked_scripts/scripts.lst
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/scripts.lst	2023-09-10 19:28:40 UTC (rev 68231)
+++ trunk/Build/source/texk/texlive/linked_scripts/scripts.lst	2023-09-10 19:42:49 UTC (rev 68232)
@@ -153,6 +153,7 @@
 pythontex/depythontex.py
 pythontex/pythontex.py
 rubik/rubikrotation.pl
+runtexshebang/runtexshebang.lua
 spix/spix.py
 splitindex/splitindex.pl
 srcredact/srcredact.pl

Added: trunk/Master/bin/aarch64-linux/runtexshebang
===================================================================
--- trunk/Master/bin/aarch64-linux/runtexshebang	                        (rev 0)
+++ trunk/Master/bin/aarch64-linux/runtexshebang	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/runtexshebang/runtexshebang.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/aarch64-linux/runtexshebang
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/amd64-freebsd/runtexshebang
===================================================================
--- trunk/Master/bin/amd64-freebsd/runtexshebang	                        (rev 0)
+++ trunk/Master/bin/amd64-freebsd/runtexshebang	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/runtexshebang/runtexshebang.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/amd64-freebsd/runtexshebang
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/amd64-netbsd/runtexshebang
===================================================================
--- trunk/Master/bin/amd64-netbsd/runtexshebang	                        (rev 0)
+++ trunk/Master/bin/amd64-netbsd/runtexshebang	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/runtexshebang/runtexshebang.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/amd64-netbsd/runtexshebang
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/armhf-linux/runtexshebang
===================================================================
--- trunk/Master/bin/armhf-linux/runtexshebang	                        (rev 0)
+++ trunk/Master/bin/armhf-linux/runtexshebang	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/runtexshebang/runtexshebang.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/armhf-linux/runtexshebang
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-freebsd/runtexshebang
===================================================================
--- trunk/Master/bin/i386-freebsd/runtexshebang	                        (rev 0)
+++ trunk/Master/bin/i386-freebsd/runtexshebang	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/runtexshebang/runtexshebang.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/i386-freebsd/runtexshebang
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-linux/runtexshebang
===================================================================
--- trunk/Master/bin/i386-linux/runtexshebang	                        (rev 0)
+++ trunk/Master/bin/i386-linux/runtexshebang	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/runtexshebang/runtexshebang.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/i386-linux/runtexshebang
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-netbsd/runtexshebang
===================================================================
--- trunk/Master/bin/i386-netbsd/runtexshebang	                        (rev 0)
+++ trunk/Master/bin/i386-netbsd/runtexshebang	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/runtexshebang/runtexshebang.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/i386-netbsd/runtexshebang
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-solaris/runtexshebang
===================================================================
--- trunk/Master/bin/i386-solaris/runtexshebang	                        (rev 0)
+++ trunk/Master/bin/i386-solaris/runtexshebang	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/runtexshebang/runtexshebang.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/i386-solaris/runtexshebang
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/universal-darwin/runtexshebang
===================================================================
--- trunk/Master/bin/universal-darwin/runtexshebang	                        (rev 0)
+++ trunk/Master/bin/universal-darwin/runtexshebang	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/runtexshebang/runtexshebang.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/universal-darwin/runtexshebang
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/windows/runtexshebang.exe
===================================================================
(Binary files differ)

Index: trunk/Master/bin/windows/runtexshebang.exe
===================================================================
--- trunk/Master/bin/windows/runtexshebang.exe	2023-09-10 19:28:40 UTC (rev 68231)
+++ trunk/Master/bin/windows/runtexshebang.exe	2023-09-10 19:42:49 UTC (rev 68232)

Property changes on: trunk/Master/bin/windows/runtexshebang.exe
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Master/bin/x86_64-cygwin/runtexshebang
===================================================================
--- trunk/Master/bin/x86_64-cygwin/runtexshebang	                        (rev 0)
+++ trunk/Master/bin/x86_64-cygwin/runtexshebang	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/runtexshebang/runtexshebang.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/x86_64-cygwin/runtexshebang
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-darwinlegacy/runtexshebang
===================================================================
--- trunk/Master/bin/x86_64-darwinlegacy/runtexshebang	                        (rev 0)
+++ trunk/Master/bin/x86_64-darwinlegacy/runtexshebang	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/runtexshebang/runtexshebang.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/x86_64-darwinlegacy/runtexshebang
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-linux/runtexshebang
===================================================================
--- trunk/Master/bin/x86_64-linux/runtexshebang	                        (rev 0)
+++ trunk/Master/bin/x86_64-linux/runtexshebang	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/runtexshebang/runtexshebang.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/x86_64-linux/runtexshebang
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-linuxmusl/runtexshebang
===================================================================
--- trunk/Master/bin/x86_64-linuxmusl/runtexshebang	                        (rev 0)
+++ trunk/Master/bin/x86_64-linuxmusl/runtexshebang	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/runtexshebang/runtexshebang.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/x86_64-linuxmusl/runtexshebang
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-solaris/runtexshebang
===================================================================
--- trunk/Master/bin/x86_64-solaris/runtexshebang	                        (rev 0)
+++ trunk/Master/bin/x86_64-solaris/runtexshebang	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/runtexshebang/runtexshebang.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/x86_64-solaris/runtexshebang
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/support/runtexshebang/LICENSE
===================================================================
--- trunk/Master/texmf-dist/doc/support/runtexshebang/LICENSE	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/support/runtexshebang/LICENSE	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2021-2023 Munehiro Yamamoto <munepixyz at gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

Added: trunk/Master/texmf-dist/doc/support/runtexshebang/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/support/runtexshebang/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/support/runtexshebang/README.md	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1,175 @@
+# runtexshebang: Lua script running LaTeX document files with TeX-style shebang
+
+Lua script running LaTeX document files with a TeX-style shebang (`%#!`)
+
+## What is a TeX-style shebang (`%#!`)
+
+In short, a TeX-style shebang (`%#!`) is a special kind of TeX comment 
+that you include in your TeX/LaTeX document file to tell the operating system's 
+shell how to run the file for the rest of the file: 
+
+``` latex
+%#!lualatex foo.tex
+\documentclass{article}
+\begin{document}
+Hello, {\LaTeX} World!
+
+Happy {\TeX}ing.
+\end{document}
+```
+
+If you are using a TeX-style shebang, it must appear on the line that 
+matched 20 lines or less in your LaTeX document, and it has to start with 
+a TeX comment symbol (`%`) followed by a hash sign (`#`) and an exclamation mark (`!`), 
+colloquially known as the bang, hence the name shebang for TeX/LaTeX. 
+
+
+## Getting started
+
+### 1. Install `runtexshebang.lua` in your TeX Live system.
+
+``` shell
+cp runtexshebang.lua /some/where/TEXMFDIST_or_TEXMFLOCAL/scripts/runtexshebang/runtexshebang.lua
+
+cd TEXLIVE_BIN_DIRECTORY
+ln -s ../../TEXMFDIST_or_TEXMFLOCAL/scripts/runtexshebang/runtexshebang.lua runtexshebang
+```
+
+### 2. Make a sample file with a TeX-style shebang.
+
+Make the following LaTeX document. 
+
+``` latex
+%#!lualatex foo.tex
+\documentclass{article}
+\begin{document}
+Hello, {\LaTeX} World!
+
+Happy {\TeX}ing.
+\end{document}
+```
+
+### 3. Run the sample file.
+
+``` shell
+runtexshebang foo.tex
+```
+
+Then, it will run `lualatex foo.tex`.
+
+
+## Examples
+
+### TeXworks
+
+#### Settings
+
+1. Open "Typesetting" tab in TeXworks Preferences.
+2. Add the tool configuration "runtexshebang" in "Processing tools" as below.
+        - Name: `runtexshebang`
+        - Program: `runtexshebang`
+        - Arguments: `$fullname`
+        - ☑ View PDF after running (if necessary)
+
+#### LaTeX document in the internal editor of TeXwork
+
+`% !TEX program = ` is a magic comment of TeXworks.
+You can set one processing tool as 
+`% !TEX program = <your choice of tool configuration>`.
+
+``` latex
+% !TEX program = runtexshebang
+%#! lualatex --synctex=1 foo
+```
+
+
+### LaTeX Workshop: Visual Studio Code
+
+#### Settings
+
+Nothing!
+
+#### LaTeX document in Visual Studio Code
+
+`% !TEX program = ` is a magic comment of LaTeX Workshop.
+You need another magic comment to the target LaTeX document file as below. 
+
+``` latex
+% !TEX program = runtexshebang
+% !TEX options = "%DOC%".tex
+%#! lualatex --synctex=1 foo
+```
+
+
+### TeXShop
+
+#### Settings
+
+There the “Engine” settings for the command lines "TeX+dvipdfmx / TeX+dvips+distiller" as follows. 
+
+* TeX: `runtexshebang`
+* LaTeX: `runtexshebang`
+
+#### LaTeX document in the internal editor of TeXShop
+
+`% !TEX program = ` is a magic comment of TeXShop.
+
+``` latex
+% !TEX program = runtexshebang
+%#! lualatex --synctex=1 foo
+```
+
+
+## Applications
+
+### What does the PATH variable set in my editor?
+
+``` latex
+%#! echo $PATH
+```
+
+### How about general configuration information for the activated TeX Live version and its configuration in my editor?
+
+``` latex
+%#! tlmgr --conf
+```
+
+### Otherwise
+
+You can run any command line on your OSs.
+For example, you can use any build tools as follows: 
+`make`, `rake`, `llmk`, `latexmk`, and so on.
+
+``` latex
+%#! make foo.pdf
+
+% #! rake foo.pdf
+% #! llmk
+% #! latexmk foo
+%% and so on.
+```
+
+You can typeset a LaTeX document file in a Docker container as below. 
+
+``` latex
+%#! docker run -i --rm --workdir /data --mount type=bind,src=$(pwd)/,dst=/data/   bar/foo     lualatex foo
+```
+
+
+## References
+
+* [TeXworks、TeXShop、VSCodeでTeX-style shebangしてみた - Qiita](https://qiita.com/munepi/items/a30c68133cfffbf4d189) (in Japanese)
+
+
+
+Enjoy Happy TeXing!
+
+
+## License
+
+This program is licensed under the terms of the MIT License.
+
+--------------------
+
+Munehiro Yamamoto
+https://github.com/munepi


Property changes on: trunk/Master/texmf-dist/doc/support/runtexshebang/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/scripts/runtexshebang/runtexshebang.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/runtexshebang/runtexshebang.lua	                        (rev 0)
+++ trunk/Master/texmf-dist/scripts/runtexshebang/runtexshebang.lua	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1,61 @@
+#!/usr/bin/env texlua
+
+-- This program is licensed under the terms of the MIT License.
+--
+-- Copyright (c) 2021-2023 Munehiro Yamamoto <munepixyz at gmail.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+if not ( #arg == 1 ) then
+   print("runtexshebang 20230909 v0.3")
+   print("")
+   print("Usage:	runtexshebang  [input.tex]")
+   os.exit(0)
+end
+
+local line_ctr = 0
+for line in io.lines(arg[1]) do
+   line_ctr = line_ctr + 1
+   if line_ctr > 20 then break end
+
+   if string.match(line, "^%%#!") then
+      tex_cmd, err=string.gsub(line, "%%#!", "")
+      tex_return = os.execute(tex_cmd)
+
+      -- if os.execute(texcmd) returns -1 on Windows, then
+      -- cmd.exe is not included in PATH, or some invalid string found before cmd.exe
+      if os.type == 'windows' and tex_return == -1 then
+         print("Invalid PATH setting found. Please ensure that cmd.exe can be found.\n")
+         os.exit(1)
+      end
+
+      -- if not tex_return == 0 then
+      --    print("TeX-style shebang processing of the below failed.\n" .. tex_cmd .. "\n")
+      --    os.exit(1)
+      -- end
+
+      os.exit(0)
+
+   -- else
+   --    print("TeX-style shebang not matched.\n")
+   end
+end
+
+print("TeX-style shebang not found.\n")
+os.exit(2)


Property changes on: trunk/Master/texmf-dist/scripts/runtexshebang/runtexshebang.lua
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2023-09-10 19:28:40 UTC (rev 68231)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2023-09-10 19:42:49 UTC (rev 68232)
@@ -729,7 +729,8 @@
     rorlink rosario rotfloat rotpages rouequestions roundbox roundrect
     rrgtrees rsc rsfs rsfso
     rterface rtkinenc rtklage
-    rubik ruhyphen ruler rulerbox rulercompass runcode russ rutitlepage
+    rubik ruhyphen ruler rulerbox rulercompass
+    runcode runtexshebang russ rutitlepage
     rviewport rvwrite ryersonsgsthesis ryethesis
   sa-tikz sacsymb sageep sanitize-umlaut sankey
     sanskrit sanskrit-t1 sansmath sansmathaccent sansmathfonts

Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds	2023-09-10 19:28:40 UTC (rev 68231)
+++ trunk/Master/tlpkg/libexec/ctan2tds	2023-09-10 19:42:49 UTC (rev 68232)
@@ -3752,6 +3752,7 @@
  'pygmentex',		=> 'pygmentex\.py$',
  'pythontex'            => '(de)?pythontex\.py$',
  'rubik'                => '\.pl$',
+ 'runtexshebang'	=> '\.lua$',
  'spix'			=> '\.py$',
  'srcredact'		=> '\.pl$',
  'splitindex'           => 'splitindex\.pl$',

Modified: trunk/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc	2023-09-10 19:28:40 UTC (rev 68231)
+++ trunk/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc	2023-09-10 19:42:49 UTC (rev 68232)
@@ -80,6 +80,7 @@
 depend pkfix-helper
 depend purifyeps
 depend pythontex
+depend runtexshebang
 depend seetexk
 depend spix
 depend srcredact

Added: trunk/Master/tlpkg/tlpsrc/runtexshebang.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/runtexshebang.tlpsrc	                        (rev 0)
+++ trunk/Master/tlpkg/tlpsrc/runtexshebang.tlpsrc	2023-09-10 19:42:49 UTC (rev 68232)
@@ -0,0 +1 @@
+binpattern f bin/${ARCH}/${PKGNAME}



More information about the tex-live-commits mailing list.