From e1088ee8b152b286a7f2898ebacbc2d97c12c70e Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 20 Jun 2022 21:07:45 +0000
Subject: hvextern (20jun22)

git-svn-id: svn://tug.org/texlive/trunk@63664 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/hvextern/hvextern.sty | 48 ++++++++++++++++++-----
 1 file changed, 39 insertions(+), 9 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/hvextern/hvextern.sty')

diff --git a/Master/texmf-dist/tex/latex/hvextern/hvextern.sty b/Master/texmf-dist/tex/latex/hvextern/hvextern.sty
index 1ad9c182092..a7340a2f12c 100644
--- a/Master/texmf-dist/tex/latex/hvextern/hvextern.sty
+++ b/Master/texmf-dist/tex/latex/hvextern/hvextern.sty
@@ -1,4 +1,4 @@
-%% $Id: hvextern.sty 574 2022-06-09 19:34:31Z herbert $
+%% $Id: hvextern.sty 577 2022-06-20 16:35:21Z herbert $
 %% This is file `hvextern.sty',
 %%
 %% Copyright (C) 2016-22
@@ -12,21 +12,33 @@
 %% and version 1.3c or later is part of all distributions of LaTeX
 %% version 2005/12/01 or later.
 
-\def\hvexternFileversion{0.30}
-\ProvidesFile{hvextern}[2022/06/09 v\hvexternFileversion: package for running external documents (HV)]
+\def\hvexternFileversion{0.31}
+\ProvidesFile{hvextern}[2022/06/20 v\hvexternFileversion: package for running external documents (HV)]
+
+\newif\ifhv@extern@checkCode
+\hv@extern@checkCodefalse
+\DeclareOption{checkCode}{\hv@extern@checkCodetrue}
+
+\ProcessOptions
 
 \RequirePackage{shellesc,xkeyval,graphicx}
-\RequirePackage{fancyvrb,tikz,listings,ifplatform}
-\RequirePackage{ifoddpage}
+\RequirePackage{fancyvrb,tikz,listings,ifplatform,iftex}
+\RequirePackage{ifoddpage,filemod}
 \RequirePackage{tcolorbox,xparse}
 \tcbuselibrary{skins,breakable}
 
+\def\hv@ex@typeout#1{\ifhv@extern@verbose\typeout{>>(hvextern) #1}\fi}
+
 \ifwindows
   \def\hv@move{move }%
   \def\hv@rm{del }%
+  \def\hv@mkdir{mkdir }%
 \else
-  \def\hv@move{mv }
-  \def\hv@rm{rm }
+  \def\hv@move{mv }%
+  \def\hv@move{mv }%
+  \def\hv@rm{rm }%
+  \def\hv@mkdir{mkdir -p }%
+  \def\hv@diff{diff }
 \fi
 
 \newcounter{hv@extern@runs}
@@ -105,7 +117,6 @@
 }
 \define@boolkey{hv}[hv@extern@]{eps}[true]{}
 \define@boolkey{hv}[hv@extern@]{verbose}[true]{}
-\def\hv@ex@typeout#1{\ifhv@extern@verbose\typeout{>>(hvextern) #1}\fi}
 
 \define@choicekey*+{hv}{compiler}[\val\nr]{mpost,tex,latex,luatex,python3,perl,lua,java,%
      xetex,pdflatex,lualatex,xelatex,context,sh,texlua}[pdflatex]{% 
@@ -177,9 +188,20 @@
   }%
 }
 
-
 \ResetKeys
 
+\ifluatex
+  \ifhv@extern@checkCode
+    \hv@ex@typeout{Loading hvextern.lua}%
+    \directlua{dofile("hvextern.lua")}%
+  \fi
+\else
+  \ifhv@extern@checkCode
+    \hv@ex@typeout{You need lualatex for option checkCode. Will disable the option!}%
+    \hv@extern@checkCodefalse
+  \fi
+\fi
+
 {\catcode`\%=12
  \catcode`\#=12 
  \gdef\perCent{%}
@@ -422,6 +444,14 @@
    \endgroup
    \expandafter\hvExternSetKeys\expandafter{\hv@extern@savePara}%
    \xdef\hv@extern@fullPath{\hv@extern@ExamplesDir\hvExternDateiname}%
+   \ifhv@extern@checkCode
+     \directlua{if GetFileContents("\hvExternDateiname\hv@extern@ext",
+		"\hv@extern@ExamplesDir\hvExternDateiname\hv@extern@ext") then
+	  tex.print("\\csname hv@ex@typeout\\endcsname{current file is NOT newer: no run }\\global\\csname hv@extern@forcefalse\\endcsname")
+        else
+	   tex.print("\\csname hv@ex@typeout\\endcsname{current file is newer: force run }\\global\\csname hv@extern@forcetrue\\endcsname")
+	end}
+   \fi
    \ifhv@extern@force
      \ifx\hv@extern@runsequence\@empty
        \hv@ex@typeout{force=true: running \hv@extern@progpath\hv@extern@compiler~ \hvExternDateiname\hv@extern@ext ...}%
-- 
cgit v1.2.3

