[LyX/2.4.x] Improve version test in chkconfig

Juergen Spitzmueller spitz at lyx.org
Fri Oct 18 08:11:05 UTC 2024


commit d0b559a31d93d8c6c8bc7aa4242be6a627c576bf
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Fri Oct 18 10:10:41 2024 +0200

    Improve version test in chkconfig
    
    This now only loads the package until it has the version information
    and then ends the package input.
    
    This way, we do not need to care about package peculiarities (having
    to be loaded after \documentclass or internal dependencies which, if
    not given, might break the whole configuration, see #13112)
---
 lib/chkconfig.ltx | 12 +++++++++++-
 status.24x        |  4 ++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx
index dbe99648df..bf0d410fd5 100644
--- a/lib/chkconfig.ltx
+++ b/lib/chkconfig.ltx
@@ -120,12 +120,22 @@
     #6
   \fi}
 
+
+% For the version test below, we need to load the tested package.
+% However, we are only interested in the version information, so
+% we redefine an internal method of \ProvidesPackage to quit
+% as soon as we have that information 
+\let\chk at pr@videpackage\@pr at videpackage
+\def\@pr at videpackage[#1]{\chk at pr@videpackage[#1]\endinput}
+
 % Tests whether an package is present and also adds the version to the package list
 \newcommand{\TestPackageAddVersion}[2][\default]{
    \def\default{#2}
    \def\package at version{}
-   % The actual test only works after the package has been loaded
    \IfFileExists{#1.sty}{%
+      % The actual test only works after the package has been loaded,
+      % but with the redefinition of \@pr at videpackage above, we quit
+      % as early as possible
       \RequirePackage{#1}%
       \protected at edef\package@@version{\csname ver@#1.sty\endcsname}%
       \protected at edef\package at version{\expandafter\@parse at version\package@@version//00\@nil}%
diff --git a/status.24x b/status.24x
index 0ad2ec7048..e206b09a08 100644
--- a/status.24x
+++ b/status.24x
@@ -108,3 +108,7 @@ What's new
 
 - Fix (only informal) check for hyphenation patterns in (re)configuration.
 
+- Improve check for package versions in (re)configuration. Particularly,
+  configuration does not break any longer if a sub-dependency of a 
+  tested package is missing (bug 13112),
+


More information about the lyx-cvs mailing list