[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Fix version test (44cca60)

Marcel Fabian Krüger tex at 2krueger.de
Fri Jun 5 16:07:06 CEST 2020


Repository : https://github.com/latex3/luaotfload
On branch  : dev
Link       : https://github.com/latex3/luaotfload/commit/44cca6084b3b74ee88437402814c968be7cf2930

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

commit 44cca6084b3b74ee88437402814c968be7cf2930
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Sat May 23 12:57:43 2020 +0200

    Fix version test


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

44cca6084b3b74ee88437402814c968be7cf2930
 src/luaotfload-main.lua | 16 ++++------------
 src/luaotfload-tool.lua | 33 ++++++++++-----------------------
 2 files changed, 14 insertions(+), 35 deletions(-)

diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua
index 422736d..2d2e122 100644
--- a/src/luaotfload-main.lua
+++ b/src/luaotfload-main.lua
@@ -40,7 +40,6 @@ luaotfload.log                    = luaotfload.log or { }
 local logreport
 luaotfload.version                = ProvidesLuaModule.version
 luaotfload.loaders                = { }
-luaotfload.min_luatex_version     = { 1, 10, 0 }
 luaotfload.fontloader_package     = "reference"    --- default: from current Context
 
 if not tex or not tex.luatexversion then
@@ -48,21 +47,14 @@ if not tex or not tex.luatexversion then
 end
 
 --- version check
-local major    = tex.luatexversion / 100
-local minor    = tex.luatexversion % 100
-local revision = tex.luatexrevision --[[ : string ]]
-local revno    = tonumber (revision)
-local minimum  = luaotfload.min_luatex_version
-local actual   = { major, minor, revno or 0 }
-if actual [1] < minimum [1]
-    or actual == minimum and actual [2] < minimum [2]
-    or actual == minimum and actual [2] == minimum [2] and actual [3] < minimum [3]
-then
+local revno   = tonumber(tex.luatexrevision)
+local minimum = { 110, 0 }
+if tex.luatexversion < minimum[1] or tex.luatexversion == minimum[1] and revno < minimum[2] then
     texio.write_nl ("term and log",
                     string.format ("\tFATAL ERROR\n\z
                                     \tLuaotfload requires a Luatex version >= %d.%d.%d.\n\z
                                     \tPlease update your TeX distribution!\n\n",
-                                   (unpack or table.unpack) (minimum)))
+                                   math.floor(minimum[1] / 100), minimum[1] % 100, minimum[2]))
     error "version check failed"
 end
 
diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua
index eabd8e4..3f0c872 100755
--- a/src/luaotfload-tool.lua
+++ b/src/luaotfload-tool.lua
@@ -23,7 +23,6 @@ end
 luaotfload                     = luaotfload or { }
 local version                  = ProvidesLuaModule.version
 luaotfload.version             = ProvidesLuaModule.version
-luaotfload.min_luatex_version  = { 0, 95, 0 }
 luaotfload.self                = "luaotfload-tool"
 luaotfload.fontloader          = _G -- We don't isolate the fontloader here
 
@@ -65,32 +64,21 @@ local tonumber        = tonumber
 local type            = type
 
 do
-    local runtime         = _G.jit and { "jit"  , jit.version }
-                                    or { "stock", _VERSION }
-    local stats           = status and status.list ()
-    local minimum         = luaotfload.min_luatex_version
-    local actual          = { 0, 0, 0 }
-    if stats then
-        local major    = stats.luatex_version // 100
-        local minor    = stats.luatex_version % 100
-        local revision = stats.luatex_revision --[[ : string ]]
-        local revno    = tonumber (revision)
-        actual         = { major, minor, revno or 0 }
-    end
-
-    if actual [1] < minimum [1]
-    or actual == minimum and actual [2] < minimum [2]
-    or actual == minimum and actual [2] == minimum [2] and actual [3] < minimum [3]
-    then
+    local runtime  = _G.jit and { "jit"  , jit.version }
+                             or { "stock", _VERSION }
+    local minimum  = {110, 0}
+    local revn     = tonumber (status.luatex_revision) or 0 --[[ : string ]]
+
+    if status.luatex_version < minimum[1]
+       or status.luatex_version == minimum[1] and status.luatex_revision < minimum[2] then
         texio.write_nl ("term and log",
                         string.format ("\tFATAL ERROR\n\z
                                         \tLuaotfload requires a Luatex version >= %d.%d.%d.\n\z
                                         \tPlease update your TeX distribution!\n\n",
-                                       (unpack or table.unpack) (minimum)))
+                                       math.floor(minimum[1] / 100), minimum[1] % 100, minimum[2]))
         error "version check failed"
     end
     luaotfload.runtime        = runtime
-    luaotfload.luatex_version = actual
 end
 
 local C, Ct, P, S  = lpeg.C, lpeg.Ct, lpeg.P, lpeg.S
@@ -349,8 +337,7 @@ local function version_msg ( )
     local meta  = fonts.names.getmetadata ()
 
     local runtime = luaotfload.runtime
-    local actual  = luaotfload.luatex_version
-    local status  = config.luaotfload.status
+    local notes   = config.luaotfload.status
     local notes   = status and status.notes or { }
 
     out (about, luaotfload.self)
@@ -361,7 +348,7 @@ local function version_msg ( )
     out ("Revision: %q", notes.revision)
     out ("Lua interpreter: %s; version %q", runtime[1], runtime[2])
 --[[out ("Luatex SVN revision: %d", info.luatex_svn)]] --> SVN r5624
-    out ("Luatex version: %d.%d", actual [1], actual [2])
+    out ("Luatex version: %d.%d", math.floor(status.luatex_version / 100), status.luatex_version % 100)
     out ("Platform: type=%s name=%s", os.type, os.name)
 
     local uname_vars = tablesortedkeys (uname)





More information about the latex3-commits mailing list.