Skip to content

Commit

Permalink
Issue #690: added hidden module support for load(between())
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McLay committed Aug 10, 2024
1 parent 965b565 commit a0a2948
Show file tree
Hide file tree
Showing 19 changed files with 46 additions and 12 deletions.
2 changes: 2 additions & 0 deletions rt/between/between.tdesc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ testdescript = {
runLmod load a/1.1 Mb #23
runLmod load Mc #24
runLmod load Md #25
runLmod load Me #26
runLmod list #27
HOME=$ORIG_HOME
cat _stdout.[0-9][0-9][0-9] > _stdout.orig
Expand Down
12 changes: 11 additions & 1 deletion rt/between/err.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
step 1
lua ProjectDIR/src/lmod.in.lua shell --regression_testing --version
===========================
Modules based on Lua: Version 8.6.9 2022-02-02 11:25 -04:00
Modules based on Lua: Version 8.7.47 2024-07-22 10:04 -04:00
by Robert McLay [email protected]
===========================
step 2
Expand Down Expand Up @@ -163,3 +163,13 @@ Lmod has detected the following error: These module(s) or extension(s) exist but
Executing this command requires loading "a" which failed while processing the following module(s):
Module fullname Module Filename
Md ProjectDIR/rt/between/mf/Core/Md.lua
===========================
step 26
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load Me
===========================
===========================
step 27
lua ProjectDIR/src/lmod.in.lua shell --regression_testing list
===========================
Currently Loaded Modules:
1) b/1.4 2) M9 3) a/1.1 4) Mb 5) d/1.3 6) e/1.2 7) Me
3 changes: 3 additions & 0 deletions rt/between/mf/Core/Me.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load(between("d","1.1<","<1.5"))
load(between("e","1.1<","1.5"))

1 change: 1 addition & 0 deletions rt/between/mf/Core/d/.modulerc.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hide_version("d/1.4")
Empty file added rt/between/mf/Core/d/1.0.lua
Empty file.
Empty file added rt/between/mf/Core/d/1.1.lua
Empty file.
Empty file added rt/between/mf/Core/d/1.2.lua
Empty file.
Empty file added rt/between/mf/Core/d/1.3.lua
Empty file.
Empty file added rt/between/mf/Core/d/1.4.lua
Empty file.
Empty file added rt/between/mf/Core/d/1.5.lua
Empty file.
2 changes: 2 additions & 0 deletions rt/between/mf/Core/e/.modulerc.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hide_version("d/1.4")
module_version("e/1.2","default")
Empty file added rt/between/mf/Core/e/1.0.lua
Empty file.
Empty file added rt/between/mf/Core/e/1.1.lua
Empty file.
Empty file added rt/between/mf/Core/e/1.2.lua
Empty file.
Empty file added rt/between/mf/Core/e/1.3.lua
Empty file.
Empty file added rt/between/mf/Core/e/1.4.lua
Empty file.
Empty file added rt/between/mf/Core/e/1.5.lua
Empty file.
20 changes: 20 additions & 0 deletions rt/between/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,23 @@ step 25
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load Md
===========================
false
===========================
step 26
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load Me
===========================
LOADEDMODULES=b/1.4:M9:a/1.1:Mb:d/1.3:e/1.2:Me;
export LOADEDMODULES;
MODULEPATH=ProjectDIR/rt/between/mf/Core;
export MODULEPATH;
_LMFILES_=ProjectDIR/rt/between/mf/Core/b/1.4.lua:ProjectDIR/rt/between/mf/Core/M9.lua:ProjectDIR/rt/between/mf/Core/a/1.1.lua:ProjectDIR/rt/between/mf/Core/Mb.lua:ProjectDIR/rt/between/mf/Core/d/1.3.lua:ProjectDIR/rt/between/mf/Core/e/1.2.lua:ProjectDIR/rt/between/mf/Core/Me.lua;
export _LMFILES_;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={M9={fn="ProjectDIR/rt/between/mf/Core/M9.lua",fullName="M9",loadOrder=2,propT={},stackDepth=0,status="active",userName="M9",wV="M.*zfinal",},Mb={fn="ProjectDIR/rt/between/mf/Core/Mb.lua",fullName="Mb",loadOrder=4,propT={},stackDepth=0,status="active",userName="Mb",wV="M.*zfinal",},Me={fn="ProjectDIR/rt/between/mf/Core/Me.lua",fullName="Me",loadOrder=7,propT={},stackDepth=0,status="active",userName="Me",wV="M.*zfinal",},a={fn="ProjectDIR/rt/between/mf/Core/a/1.1.lua",fullName="a/1.1",loadOrder=3,propT={},stackDepth=0,status="active",userName="a/1.1",wV="000000001.000000001.*zfinal",},b={fn="ProjectDIR/rt/between/mf/Core/b/1.4.lua",fullName="b/1.4",loadOrder=1,propT={},stackDepth=1,status="active",userName="b/1.4",wV="000000001.000000004.*zfinal",},d={fn="ProjectDIR/rt/between/mf/Core/d/1.3.lua",fullName="d/1.3",loadOrder=5,propT={},stackDepth=1,status="active",userName="d/1.3",wV="000000001.000000003.*zfinal",},e={fn="ProjectDIR/rt/between/mf/Core/e/1.2.lua",fullName="e/1.2",loadOrder=6,propT={},stackDepth=1,status="active",userName="e/1.2",wV="^00000001.000000002.*zfinal",},},mpathA={"ProjectDIR/rt/between/mf/Core",},systemBaseMPATH="ProjectDIR/rt/between/mf/Core",}';
export _ModuleTable_;
===========================
step 27
lua ProjectDIR/src/lmod.in.lua shell --regression_testing list
===========================
MODULEPATH=ProjectDIR/rt/between/mf/Core;
export MODULEPATH;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={M9={fn="ProjectDIR/rt/between/mf/Core/M9.lua",fullName="M9",loadOrder=2,propT={},stackDepth=0,status="active",userName="M9",wV="M.*zfinal",},Mb={fn="ProjectDIR/rt/between/mf/Core/Mb.lua",fullName="Mb",loadOrder=4,propT={},stackDepth=0,status="active",userName="Mb",wV="M.*zfinal",},Me={fn="ProjectDIR/rt/between/mf/Core/Me.lua",fullName="Me",loadOrder=7,propT={},stackDepth=0,status="active",userName="Me",wV="M.*zfinal",},a={fn="ProjectDIR/rt/between/mf/Core/a/1.1.lua",fullName="a/1.1",loadOrder=3,propT={},stackDepth=0,status="active",userName="a/1.1",wV="000000001.000000001.*zfinal",},b={fn="ProjectDIR/rt/between/mf/Core/b/1.4.lua",fullName="b/1.4",loadOrder=1,propT={},stackDepth=1,status="active",userName="b/1.4",wV="000000001.000000004.*zfinal",},d={fn="ProjectDIR/rt/between/mf/Core/d/1.3.lua",fullName="d/1.3",loadOrder=5,propT={},stackDepth=1,status="active",userName="d/1.3",wV="000000001.000000003.*zfinal",},e={fn="ProjectDIR/rt/between/mf/Core/e/1.2.lua",fullName="e/1.2",loadOrder=6,propT={},stackDepth=1,status="active",userName="e/1.2",wV="^00000001.000000002.*zfinal",},},mpathA={"ProjectDIR/rt/between/mf/Core",},systemBaseMPATH="ProjectDIR/rt/between/mf/Core",}';
export _ModuleTable_;
18 changes: 7 additions & 11 deletions src/MName.lua
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ function M.find_between(self, fileA)
return x.pV < y.pV
end)

local mrc = MRC:singleton()
local fn = false
local version = false
local lowerBound = self.__range[1]
Expand All @@ -553,23 +554,18 @@ function M.find_between(self, fileA)

local pV = lowerBound
local wV = " " -- this is less than the lower possible weight.

--dbg.print{"lower: ",pV,"\n"}
--dbg.print{"upper: ",upperBound,"\n"}
--dbg.print{"wV: \"",wV,"\"\n\n"}

local idx = nil
local found = false
for j = 1,#a do
local entry = a[j]
local v = entry.pV
--dbg.print{"pV: ",pV,", v: ",v,", upper: \"",upperBound,"\"\n"}
--dbg.print{"pV <= v: ",pV <= v, ", v <= upperBound: ",v <= upperBound,", entry.wV > wV: ",entry.wV > wV,"\n"}

if (lowerFn(pV,v) and upperFn(v,upperBound) and entry.wV > wV) then
idx = j
pV = v
wV = entry.wV
if (isMarked(v) or mrc:isVisible{fullName=entry.fullName,sn=entry.sn,fn=entry.fn,
visibleT = {soft = true}}) then
idx = j
pV = v
wV = entry.wV
end
end
end
if (idx) then
Expand Down

0 comments on commit a0a2948

Please sign in to comment.