[latex3-commits] [git/LaTeX3-latex3-latex3] version-check: The date is not always equal, so test for a minimum (f167a5b94)
Joseph Wright
joseph.wright at morningstar2.co.uk
Thu Aug 20 18:55:05 CEST 2020
Repository : https://github.com/latex3/latex3
On branch : version-check
Link : https://github.com/latex3/latex3/commit/f167a5b9454f8fa1de84ca8d6c9ddf35e4c6c887
>---------------------------------------------------------------
commit f167a5b9454f8fa1de84ca8d6c9ddf35e4c6c887
Author: PhelypeOleinik <tex.phelype at gmail.com>
Date: Mon Aug 3 00:32:02 2020 -0300
The date is not always equal, so test for a minimum
>---------------------------------------------------------------
f167a5b9454f8fa1de84ca8d6c9ddf35e4c6c887
l3kernel/l3file.dtx | 33 +++++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 8 deletions(-)
diff --git a/l3kernel/l3file.dtx b/l3kernel/l3file.dtx
index 3ff34d972..67ab5828b 100644
--- a/l3kernel/l3file.dtx
+++ b/l3kernel/l3file.dtx
@@ -3551,17 +3551,34 @@
% If versions don't match, the function attempts to tell why by
% searching for a possible stray format file.
%
-% The function starts by checking if it needs to do anything at all.
-% Usually it doesn't, so just quit silently.
+% The function starts by checking that the kernel date is defined, and
+% if not zero is used to force the error route. The kernel date is
+% then compared with the argument requested date (ususally the
+% packaging date of the dependency). If the kernel date is less than
+% the required date, it's an error and the loading should abort.
% \begin{macrocode}
-\cs_new_protected:Npn \__kernel_dependency_version_check:Nn #1 #2
+\cs_new_protected:Npn \__kernel_dependency_version_check:Nn #1
+ { \exp_args:NV \@@_kernel_dependency_compare:nn #1 }
+\cs_new_protected:Npn \@@_kernel_dependency_compare:nn #1
{
- \tl_if_eq:NNF #1 \c__kernel_expl_date_tl
- { \@@_mismatched_dependency_error:Nn #1 {#2} }
+ \cs_if_exist:NTF \c__kernel_expl_date_tl
+ {
+ \exp_args:NV \@@_kernel_dependency_compare:nnn
+ \c__kernel_expl_date_tl {#1}
+ }
+ { \@@_kernel_dependency_compare:nnn { 0000-00-00 } {#1} }
+ }
+\cs_new_protected:Npn \@@_kernel_dependency_compare:nnn #1 #2 #3
+ {
+ \int_compare:nNnT
+ { \@@_parse_version:w #1 \s_@@_stop } <
+ { \@@_parse_version:w #2 \s_@@_stop }
+ { \@@_mismatched_dependency_error:nn {#2} {#3} }
}
+\cs_new:Npn \@@_parse_version:w #1 - #2 - #3 \s_@@_stop {#1#2#3}
% \end{macrocode}
%
-% \begin{macro}{\@@_mismatched_dependency_error:Nn}
+% \begin{macro}{\@@_mismatched_dependency_error:nn}
% If the versions differ, then we try to give the user some guidance.
% This function starts by taking the engine name \cs{c_sys_engine_str}
% and replacing |tex| by |latex|, then building a command of the form:
@@ -3571,7 +3588,7 @@
% to query the format files available. A shell is opened and each
% line is read into a sequence.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_mismatched_dependency_error:Nn #1 #2
+\cs_new_protected:Npn \@@_mismatched_dependency_error:nn #1 #2
{
\exp_args:NNx \ior_shell_open:Nn \g_@@_internal_ior
{
@@ -3604,7 +3621,7 @@
\\ \\
The~L3~programming~layer~in~the~LaTeX~format \\
is~dated~\c__kernel_expl_date_tl,~but~in~your~TeX~
- tree~the~files \\ are~from~#1.
+ tree~the~files~require \\ at~least~#1.
}
\use_none:n
}
More information about the latex3-commits
mailing list.