[latex3-commits] [git/LaTeX3-latex3-latex2e] lthooks2: test file fixes and fix for already loaded packages (6cbabb83)

Frank Mittelbach frank.mittelbach at latex-project.org
Fri Aug 14 22:18:23 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : lthooks2
Link       : https://github.com/latex3/latex2e/commit/6cbabb831a1024cd725853f93edb0e23ebc96869

>---------------------------------------------------------------

commit 6cbabb831a1024cd725853f93edb0e23ebc96869
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Fri Aug 14 22:18:23 2020 +0200

    test file fixes and fix for already loaded packages


>---------------------------------------------------------------

6cbabb831a1024cd725853f93edb0e23ebc96869
 base/ltfilehook.dtx                                | 265 ++++++++++-----------
 base/testfiles-1run/github-0220.luatex.tlg         |   4 +-
 base/testfiles-1run/github-0220.tlg                |   4 +-
 base/testfiles-legacy/utf8-test-001.tlg            |   2 +-
 .../shipout-000.lvt}                               |  12 +-
 base/testfiles-lthooks/shipout-000.tlg             |   2 +
 base/testfiles/tlb2140.luatex.tlg                  |   1 +
 7 files changed, 141 insertions(+), 149 deletions(-)

diff --git a/base/ltfilehook.dtx b/base/ltfilehook.dtx
index 10f7ffb8..fe08ab4f 100644
--- a/base/ltfilehook.dtx
+++ b/base/ltfilehook.dtx
@@ -1004,26 +1004,56 @@
   \@pushfilename
   \xdef\@currname{#1}%
   \global\let\@currext#4%
-  \@reset at ptions
-  \makeatletter
+%    \end{macrocode}
+%   The command \cs{ver@\meta{file}.\meta{ext}} is used to signal that
+%   a package is already loaded, either because it is in fact loaded, or
+%   because it's loading was suppressed.  In minimal installations, said
+%   package may not exist but still have its loading suppressed with
+%   \cs{ver@\meta{file}.\meta{ext}}, so before checking if the file
+%   exists we have to check that we do need to load it with
+%   \cs{@ifl at aded}.  If we don't, then there's no point in checking for
+%   a typo or load-disabling.
+%    \begin{macrocode}
+  \@ifl at aded\@currext\@currname
+%    \end{macrocode}
+%   If the package is already loaded, check that there were no option
+%   clashes:
+%    \begin{macrocode}
+    {\@if at ptions\@currext{\@currname}{#2}{}%
+      {\@latex at error
+        {Option clash for \@cls at pkg\space \@currname}%
+        {The package \@currname\space has already been loaded
+         with options:\MessageBreak
+         \space\space[\@ptionlist{\@currname.\@currext}]\MessageBreak
+         There has now been an attempt to load it
+          with options\MessageBreak
+         \space\space[#2]\MessageBreak
+         Adding the global options:\MessageBreak
+         \space\space
+              \@ptionlist{\@currname.\@currext},#2\MessageBreak
+         to your \noexpand\documentclass declaration may fix this.%
+         \MessageBreak
+         Try typing \space <return> \space to proceed.}}%
+     \@firstofone}%
+    {\@reset at ptions
+     \makeatletter
 %    \end{macrocode}
 %   First we take the \meta{name} and \meta{ext} given in the argument
 %   and check if the file exists, and issue an error otherwise asking
 %   for a correction with \cs{@missingfileerror}.
 %    \begin{macrocode}
-  \IfFileExists{\@currname.\@currext}{}%
-    {\@missing at onefilewithoptions{#2}}%
+     \IfFileExists{\@currname.\@currext}{}%
+       {\@missing at onefilewithoptions{#2}}%
 %    \end{macrocode}
 %   If \cs{@currname} is empty (the user replied to the ``Enter file
 %   name'' prompt with \meta{RETURN}), so stop here
 %   (do \cs{@popfilename} to pop the item just added above).
+%
+%   This \cs{@gobble} omits the date check at the end.
 %    \begin{macrocode}
-  \ifx\@currname\@empty
-    \@popfilename
-    \expandafter\@gobble
-  \else
-    \expandafter\@firstofone
-  \fi
+     \ifx\@currname\@empty
+       \expandafter\@gobble
+     \else
 %    \end{macrocode}
 %   If the file exists, check if it was load-prevented, and otherwise
 %   do the bookkeeping with \cs{@filehook at file@push}
@@ -1031,17 +1061,32 @@
 %   required substitution), then actually load the class/package with
 %   \cs{load at onefile@withoptions}.
 %    \begin{macrocode}
-    {\@disable at packageload@do{\@currname.\@currext}%
-       {\@filehook at file@push
-        \set at curr@file{\@currname.\@currext}%
-        \@filehook at set@CurrentFile
-        \load at onefile@withoptions{#2}{#3}%
+       \@disable at packageload@do{\@currname.\@currext}%
+         {\@filehook at file@push
+          \set at curr@file{\@currname.\@currext}%
+          \@filehook at set@CurrentFile
+          \load at onefile@withoptions{#2}%
 %    \end{macrocode}
 %   Now just clean up and exit.
 %    \begin{macrocode}
-        \@filehook at file@pop}%
-     \@popfilename
-     \@reset at ptions}}
+          \@filehook at file@pop}%
+       \@reset at ptions
+       \expandafter\@firstofone
+     \fi}%
+%    \end{macrocode}
+%   Except in the case where \cs{@currname} is empty, the date is
+%   checked against the date marked in the package file:
+%    \begin{macrocode}
+    {\@ifl at ter\@currext{\@currname}{#3}{}%
+      {\@latex at warning@no at line
+        {You have requested,\on at line,
+         version\MessageBreak
+           `#3' of \@cls at pkg\space \@currname,\MessageBreak
+         but only version\MessageBreak
+          `\csname ver@\@currname.\@currext\endcsname'\MessageBreak
+         is available}}%
+     \ifx\@currext\@clsextension\let\LoadClass\@twoloadclasserror\fi}%
+  \@popfilename}
 %    \end{macrocode}
 %
 %   Now the action taken when a file is not found.
@@ -1054,30 +1099,14 @@
 %
 %   Now the code that actually does the file loading:
 %    \begin{macrocode}
-\def\load at onefile@withoptions#1#2{%
+\def\load at onefile@withoptions#1{%
   \let\CurrentOption\@empty
   \@reset at ptions
   \def\reserved at a{%
-    \@ifl at aded\@currext{\@currname}%
-      {\@if at ptions\@currext{\@currname}{#1}{}%
-        {\@latex at error
-            {Option clash for \@cls at pkg\space \@currname}%
-            {The package \@currname\space has already been loaded
-             with options:\MessageBreak
-             \space\space[\@ptionlist{\@currname.\@currext}]\MessageBreak
-             There has now been an attempt to load it
-              with options\MessageBreak
-             \space\space[#1]\MessageBreak
-             Adding the global options:\MessageBreak
-             \space\space
-                  \@ptionlist{\@currname.\@currext},#1\MessageBreak
-             to your \noexpand\documentclass declaration may fix this.%
-             \MessageBreak
-             Try typing \space <return> \space to proceed.}}}%
-      {\@pass at ptions\@currext{#1}{\@currname}%
-       \global\expandafter
-       \let\csname ver@\@currname.\@currext\endcsname\@empty
-       \expandafter\let\csname\@currname.\@currext-h@@k\endcsname\@empty
+    \@pass at ptions\@currext{#1}{\@currname}%
+    \global\expandafter
+    \let\csname ver@\@currname.\@currext\endcsname\@empty
+    \expandafter\let\csname\@currname.\@currext-h@@k\endcsname\@empty
 %-----------------------------------------
 %    \end{macrocode}
 %    When the current extension is \cs{@pkgextension} we are loading a
@@ -1085,49 +1114,40 @@
 %    depending on that we execute different hooks.  If the extension is
 %    neither, then it is another type of file without special hooks.
 %    \begin{macrocode}
-       \ifx\@currext\@pkgextension
-         \UseHook{package/before}%
-         \UseHook{package/before/\@currname}%
-       \else
-         \ifx\@currext\@clsextension
-           \UseHook{class/before}%
-           \UseHook{class/before/\@currname}%
-         \fi
-       \fi
+    \ifx\@currext\@pkgextension
+      \UseHook{package/before}%
+      \UseHook{package/before/\@currname}%
+    \else
+      \ifx\@currext\@clsextension
+        \UseHook{class/before}%
+        \UseHook{class/before/\@currname}%
+      \fi
+    \fi
 %    \end{macrocode}
 %    Now actually load the file (at this point we are certain it exists,
 %    but use \cs{InputIfFileExists} so tha file hooks are executed):
 %    \begin{macrocode}
-       \InputIfFileExists{\@currname.\@currext}{}{}%
-       \let\@unprocessedoptions\@@unprocessedoptions
-       \csname\@currname.\@currext-h@@k\endcsname
-       \expandafter\let\csname\@currname.\@currext-h@@k\endcsname
-                 \@undefined
+    \InputIfFileExists{\@currname.\@currext}{}{}%
+    \let\@unprocessedoptions\@@unprocessedoptions
+    \csname\@currname.\@currext-h@@k\endcsname
+    \expandafter\let\csname\@currname.\@currext-h@@k\endcsname
+              \@undefined
 %-----------------------------------------
 %    \end{macrocode}
 %    And same procedure, James, when we are finished loading, except
 %    that the hook order is now reversed.
 %    \begin{macrocode}
-       \ifx\@currext\@pkgextension
-         \UseHook{package/after/\@currname}%
-         \UseHook{package/after}%
-       \else
-         \ifx\@currext\@clsextension
-           \UseHook{class/after/\@currname}%
-           \UseHook{class/after}%
-         \fi
-       \fi
+    \ifx\@currext\@pkgextension
+      \UseHook{package/after/\@currname}%
+      \UseHook{package/after}%
+    \else
+      \ifx\@currext\@clsextension
+        \UseHook{class/after/\@currname}%
+        \UseHook{class/after}%
+      \fi
+    \fi
 %-----------------------------------------
-       \@unprocessedoptions}%
-    \@ifl at ter\@currext{\@currname}{#2}{}%
-      {\@latex at warning@no at line
-         {You have requested,\on at line,
-          version\MessageBreak
-            `#2' of \@cls at pkg\space \@currname,\MessageBreak
-          but only version\MessageBreak
-           `\csname ver@\@currname.\@currext\endcsname'\MessageBreak
-          is available}}%
-    \ifx\@currext\@clsextension\let\LoadClass\@twoloadclasserror\fi}%
+    \@unprocessedoptions}%
   \reserved at a}
 %    \end{macrocode}
 %
@@ -1136,77 +1156,50 @@
 %    \begin{macrocode}
 \@ifl at t@r\fmtversion{2020/10/01}
 {%
-\def\load at onefile@withoptions#1#2{%
+\def\load at onefile@withoptions#1{%
   \let\CurrentOption\@empty
   \@reset at ptions
-  \makeatletter
   \def\reserved at a{%
-    \@ifl at aded\@currext{\@currname}%
-      {\@if at ptions\@currext{\@currname}{#1}{}%
-        {\@latex at error
-            {Option clash for \@cls at pkg\space \@currname}%
-            {The package \@currname\space has already been loaded
-             with options:\MessageBreak
-             \space\space[\@ptionlist{\@currname.\@currext}]\MessageBreak
-             There has now been an attempt to load it
-              with options\MessageBreak
-             \space\space[#1]\MessageBreak
-             Adding the global options:\MessageBreak
-             \space\space
-                  \@ptionlist{\@currname.\@currext},#1\MessageBreak
-             to your \noexpand\documentclass declaration may fix this.%
-             \MessageBreak
-             Try typing \space <return> \space to proceed.}}}%
-      {\@pass at ptions\@currext{#1}{\@currname}%
-       \global\expandafter
-       \let\csname ver@\@currname.\@currext\endcsname\@empty
-       \expandafter\let\csname\@currname.\@currext-h@@k\endcsname\@empty
+    \@pass at ptions\@currext{#1}{\@currname}%
+    \global\expandafter
+    \let\csname ver@\@currname.\@currext\endcsname\@empty
+    \expandafter\let\csname\@currname.\@currext-h@@k\endcsname\@empty
 %-----------------------------------------
-       \ifx\@currext\@pkgextension
-         \UseHook{package/before}%
-         \UseHook{package/before/\@currname}%
-       \else
-         \ifx\@currext\@clsextension
-           \UseHook{class/before}%
-           \UseHook{class/before/\@currname}%
-         \fi
-       \fi
-       \InputIfFileExists{\@currname.\@currext}{}{}%
+    \ifx\@currext\@pkgextension
+      \UseHook{package/before}%
+      \UseHook{package/before/\@currname}%
+    \else
+      \ifx\@currext\@clsextension
+        \UseHook{class/before}%
+        \UseHook{class/before/\@currname}%
+      \fi
+    \fi
+    \InputIfFileExists{\@currname.\@currext}{}{}%
 %-----------------------------------------
-       \expandafter\let\csname unprocessedoptions-\@currname.\@currext\endcsname
-                       \@@unprocessedoptions
-       \csname\@currname.\@currext-h@@k\endcsname
-       \expandafter\let\csname\@currname.\@currext-h@@k\endcsname
-                 \@undefined
-       \ifx\@unprocessedoptions\relax
-         \let\@unprocessedoptions\@undefined
-       \else
-         \csname unprocessedoptions-\@currname.\@currext\endcsname
-       \fi
-       \expandafter\let
-           \csname unprocessedoptions-\@currname.\@currext\endcsname
-          \@undefined
+    \expandafter\let\csname unprocessedoptions-\@currname.\@currext\endcsname
+                    \@@unprocessedoptions
+    \csname\@currname.\@currext-h@@k\endcsname
+    \expandafter\let\csname\@currname.\@currext-h@@k\endcsname
+              \@undefined
+    \ifx\@unprocessedoptions\relax
+      \let\@unprocessedoptions\@undefined
+    \else
+      \csname unprocessedoptions-\@currname.\@currext\endcsname
+    \fi
+    \expandafter\let
+        \csname unprocessedoptions-\@currname.\@currext\endcsname
+       \@undefined
 %-----------------------------------------
-       \ifx\@currext\@pkgextension
-         \UseHook{package/after/\@currname}%
-         \UseHook{package/after}%
-       \else
-         \ifx\@currext\@clsextension
-           \UseHook{class/after/\@currname}%
-           \UseHook{class/after}%
-         \fi
-       \fi
+    \ifx\@currext\@pkgextension
+      \UseHook{package/after/\@currname}%
+      \UseHook{package/after}%
+    \else
+      \ifx\@currext\@clsextension
+        \UseHook{class/after/\@currname}%
+        \UseHook{class/after}%
+      \fi
+    \fi}%
 %-----------------------------------------
-       }%
-    \@ifl at ter\@currext{\@currname}{#2}{}%
-      {\@latex at warning@no at line
-         {You have requested,\on at line,
-          version\MessageBreak
-            `#2' of \@cls at pkg\space \@currname,\MessageBreak
-          but only version\MessageBreak
-           `\csname ver@\@currname.\@currext\endcsname'\MessageBreak
-          is available}}%
-    \ifx\@currext\@clsextension\let\LoadClass\@twoloadclasserror\fi}%
   \reserved at a}
 }{}%
 %    \end{macrocode}
diff --git a/base/testfiles-1run/github-0220.luatex.tlg b/base/testfiles-1run/github-0220.luatex.tlg
index c8a5190d..cbc029c9 100644
--- a/base/testfiles-1run/github-0220.luatex.tlg
+++ b/base/testfiles-1run/github-0220.luatex.tlg
@@ -8,14 +8,14 @@ Reading the fie ``github 220 input.tex''
 This is from file ``github 220 input''.
 )
 Writing a file with the same name again, should fail:
-LaTeX Warning: File `github 220 input' already exists on the system.
+LaTeX Warning: File `github 220 input.tex' already exists on the system.
                Not generating it from this source.
 Reading the file ``github 220 input.tex'' (same result)
 ("./github 220 input.tex"
 This is from file ``github 220 input''.
 )
 Forcing to writing a file with the same name, should succeed:
-LaTeX Warning: Writing or overwriting file `./github 220 input'.
+LaTeX Warning: Writing or overwriting file `./github 220 input.tex'.
 \openout127 = github 220 input.tex
 Reading the file ``github 220 input.tex'' (different result)
 ("./github 220 input.tex"
diff --git a/base/testfiles-1run/github-0220.tlg b/base/testfiles-1run/github-0220.tlg
index e7c1fcc4..c2c22792 100644
--- a/base/testfiles-1run/github-0220.tlg
+++ b/base/testfiles-1run/github-0220.tlg
@@ -8,14 +8,14 @@ Reading the fie ``github 220 input.tex''
 This is from file ``github 220 input''.
 )
 Writing a file with the same name again, should fail:
-LaTeX Warning: File `github 220 input' already exists on the system.
+LaTeX Warning: File `github 220 input.tex' already exists on the system.
                Not generating it from this source.
 Reading the file ``github 220 input.tex'' (same result)
 (github 220 input.tex
 This is from file ``github 220 input''.
 )
 Forcing to writing a file with the same name, should succeed:
-LaTeX Warning: Writing or overwriting file `./github 220 input'.
+LaTeX Warning: Writing or overwriting file `./github 220 input.tex'.
 Reading the file ``github 220 input.tex'' (different result)
 (github 220 input.tex
 This is from the third file ``github 220 input''.
diff --git a/base/testfiles-legacy/utf8-test-001.tlg b/base/testfiles-legacy/utf8-test-001.tlg
index 20e49423..1c13caec 100644
--- a/base/testfiles-legacy/utf8-test-001.tlg
+++ b/base/testfiles-legacy/utf8-test-001.tlg
@@ -1,6 +1,6 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
-LaTeX Warning: File `one two three' already exists on the system.
+LaTeX Warning: File `one two three.tex' already exists on the system.
                Not generating it from this source.
 LaTeX Warning: File `f^^c3^^bc^^c3^^9fe.tex' already exists on the system.
                Not generating it from this source.
diff --git a/base/testfiles-disabled/lthooks2-003.lvt b/base/testfiles-lthooks/shipout-000.lvt
similarity index 66%
copy from base/testfiles-disabled/lthooks2-003.lvt
copy to base/testfiles-lthooks/shipout-000.lvt
index 1f90cd51..5804c7b7 100644
--- a/base/testfiles-disabled/lthooks2-003.lvt
+++ b/base/testfiles-lthooks/shipout-000.lvt
@@ -1,4 +1,4 @@
-% testing eso-pic interfaces
+% testing atbegshi and evershi inclusion
 
 \RequirePackage[enable-debug]{expl3}
 \ExplSyntaxOn
@@ -9,14 +9,10 @@
 
 \input{regression-test}
 
-\usepackage{eso-pic}
 
 \START
 
+\usepackage{atbegshi}
+\usepackage{everyshi}
 
-\begin{document}
-
-abc
-
-\end{document}
-
+\END
diff --git a/base/testfiles-lthooks/shipout-000.tlg b/base/testfiles-lthooks/shipout-000.tlg
new file mode 100644
index 00000000..bfbef442
--- /dev/null
+++ b/base/testfiles-lthooks/shipout-000.tlg
@@ -0,0 +1,2 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
diff --git a/base/testfiles/tlb2140.luatex.tlg b/base/testfiles/tlb2140.luatex.tlg
index 1e0e5806..9d638f9b 100644
--- a/base/testfiles/tlb2140.luatex.tlg
+++ b/base/testfiles/tlb2140.luatex.tlg
@@ -577,3 +577,4 @@ Completed box being shipped out [2]
 .\glue(\baselineskip) 28.0 plus 3.0 minus 4.0
 .\hbox(0.0+0.0)x0.0, direction TLT
 (tlb2140.aux (pr2140a.aux) (pr2140b.aux))
+LaTeX Warning: Temporary extra page added at the end. Rerun to get it removed.





More information about the latex3-commits mailing list.