Software / code / prosody
Comparison
prosodyctl @ 12435:1ee72c0013f3 0.12
prosodyctl about: Report version of lua-readline
Good to know since it affects how well the shell works
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 27 Mar 2022 14:05:56 +0200 |
| parent | 12292:7fe5cd8a10e2 |
| child | 12452:c475a7802169 |
comparison
equal
deleted
inserted
replaced
| 12433:3dfcdcab5446 | 12435:1ee72c0013f3 |
|---|---|
| 482 print("# Lua module versions"); | 482 print("# Lua module versions"); |
| 483 local module_versions, longest_name = {}, 8; | 483 local module_versions, longest_name = {}, 8; |
| 484 local library_versions = {}; | 484 local library_versions = {}; |
| 485 dependencies.softreq"ssl"; | 485 dependencies.softreq"ssl"; |
| 486 dependencies.softreq"DBI"; | 486 dependencies.softreq"DBI"; |
| 487 dependencies.softreq"readline"; | |
| 487 local friendly_names = { | 488 local friendly_names = { |
| 488 DBI = "LuaDBI"; | 489 DBI = "LuaDBI"; |
| 489 lfs = "LuaFileSystem"; | 490 lfs = "LuaFileSystem"; |
| 490 lunbound = "luaunbound"; | 491 lunbound = "luaunbound"; |
| 491 lxp = "LuaExpat"; | 492 lxp = "LuaExpat"; |
| 492 socket = "LuaSocket"; | 493 socket = "LuaSocket"; |
| 493 ssl = "LuaSec"; | 494 ssl = "LuaSec"; |
| 494 }; | 495 }; |
| 496 local alternate_version_fields = { | |
| 497 -- These diverge from the module._VERSION convention | |
| 498 readline = "Version"; | |
| 499 } | |
| 495 local lunbound = dependencies.softreq"lunbound"; | 500 local lunbound = dependencies.softreq"lunbound"; |
| 496 local lxp = dependencies.softreq"lxp"; | 501 local lxp = dependencies.softreq"lxp"; |
| 497 local hashes = dependencies.softreq"util.hashes"; | 502 local hashes = dependencies.softreq"util.hashes"; |
| 498 for name, module in pairs(package.loaded) do | 503 for name, module in pairs(package.loaded) do |
| 499 if type(module) == "table" and rawget(module, "_VERSION") | 504 local version_field = alternate_version_fields[name] or "_VERSION"; |
| 505 if type(module) == "table" and rawget(module, version_field) | |
| 500 and name ~= "_G" and not name:match("%.") then | 506 and name ~= "_G" and not name:match("%.") then |
| 501 name = friendly_names[name] or name; | 507 name = friendly_names[name] or name; |
| 502 if #name > longest_name then | 508 if #name > longest_name then |
| 503 longest_name = #name; | 509 longest_name = #name; |
| 504 end | 510 end |
| 505 local mod_version = module._VERSION; | 511 local mod_version = module[version_field]; |
| 506 if tostring(mod_version):sub(1, #name+1) == name .. " " then | 512 if tostring(mod_version):sub(1, #name+1) == name .. " " then |
| 507 mod_version = mod_version:sub(#name+2); | 513 mod_version = mod_version:sub(#name+2); |
| 508 end | 514 end |
| 509 module_versions[name] = mod_version; | 515 module_versions[name] = mod_version; |
| 510 end | 516 end |