Skip to content

Commit 86e3363

Browse files
author
Robert McLay
committed
Merge branch 'main' of github.com:TACC/Lmod
2 parents c844cac + b34ae04 commit 86e3363

File tree

6 files changed

+79
-2
lines changed

6 files changed

+79
-2
lines changed

docs/source/051_tcl_modulefiles.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ standard TCL language.
157157
**remove-property NAME** *value* :
158158
See :ref:`lmodrc-label` for how to use this command.
159159

160+
**report** *string* :
161+
Prints a message to the user.
162+
160163
**reportError** *string* :
161164
Report an error and abort processing of the modulefile.
162165

rt/tclmodules/err.txt

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ step 6
3333
lua ProjectDIR/src/lmod.in.lua shell --regression_testing avail
3434
===========================
3535
ProjectDIR/rt/tclmodules/mf
36-
a/1.0 help/1.0 hide/2.0 (D)
36+
a/1.0 help/1.0 hide/2.0 (D) showMe/1.0
3737
earlyLateOutput/2.0 (L) help/2.0 (D) outputMode/1.0
38-
getenv/1.0 hide/1.0 showMe/1.0
38+
getenv/1.0 hide/1.0 report/1.0
3939
Where:
4040
D: Default Module
4141
L: Module is loaded
@@ -60,6 +60,7 @@ The following is a list of the modules and extensions currently available:
6060
help: help/1.0, help/2.0
6161
hide: hide/1.0, hide/2.0
6262
outputMode: outputMode/1.0
63+
report: report/1.0
6364
showMe: showMe/1.0
6465
To learn more about a package execute:
6566
$ module spider Foo
@@ -91,3 +92,24 @@ Module Specific Help for "help/2.0"
9192
first help line
9293
with newline
9394
second help line
95+
===========================
96+
step 13
97+
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load report/1.0
98+
===========================
99+
line of text to report
100+
===========================
101+
step 14
102+
lua ProjectDIR/src/lmod.in.lua shell --regression_testing show report/1.0
103+
===========================
104+
ProjectDIR/rt/tclmodules/mf/report/1.0:
105+
LmodMessage("line of text to report")
106+
===========================
107+
step 15
108+
lua ProjectDIR/src/lmod.in.lua shell --regression_testing help report/1.0
109+
===========================
110+
Module Specific Help for "report/1.0"
111+
===========================
112+
step 16
113+
lua ProjectDIR/src/lmod.in.lua shell --regression_testing unload report/1.0
114+
===========================
115+
line of text to report

rt/tclmodules/mf/report/1.0

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#%Module
2+
report {line of text to report}

rt/tclmodules/out.txt

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,43 @@ MODULEPATH=ProjectDIR/rt/tclmodules/mf;
108108
export MODULEPATH;
109109
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={earlyLateOutput={fn="ProjectDIR/rt/tclmodules/mf/earlyLateOutput/2.0",fullName="earlyLateOutput/2.0",loadOrder=1,propT={},stackDepth=0,status="active",userName="earlyLateOutput",wV="000000002.*zfinal",},getenv={fn="ProjectDIR/rt/tclmodules/mf/getenv/1.0",fullName="getenv/1.0",loadOrder=2,propT={},stackDepth=0,status="active",userName="getenv",wV="000000001.*zfinal",},help={fn="ProjectDIR/rt/tclmodules/mf/help/1.0",fullName="help/1.0",loadOrder=3,propT={},stackDepth=0,status="active",userName="help/1.0",wV="000000001.*zfinal",},},mpathA={"ProjectDIR/rt/tclmodules/mf",},systemBaseMPATH="ProjectDIR/rt/tclmodules/mf",}';
110110
export _ModuleTable_;
111+
===========================
112+
step 13
113+
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load report/1.0
114+
===========================
115+
LOADEDMODULES=earlyLateOutput/2.0:getenv/1.0:help/1.0:report/1.0;
116+
export LOADEDMODULES;
117+
MODULEPATH=ProjectDIR/rt/tclmodules/mf;
118+
export MODULEPATH;
119+
_LMFILES_=ProjectDIR/rt/tclmodules/mf/earlyLateOutput/2.0:ProjectDIR/rt/tclmodules/mf/getenv/1.0:ProjectDIR/rt/tclmodules/mf/help/1.0:ProjectDIR/rt/tclmodules/mf/report/1.0;
120+
export _LMFILES_;
121+
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={earlyLateOutput={fn="ProjectDIR/rt/tclmodules/mf/earlyLateOutput/2.0",fullName="earlyLateOutput/2.0",loadOrder=1,propT={},stackDepth=0,status="active",userName="earlyLateOutput",wV="000000002.*zfinal",},getenv={fn="ProjectDIR/rt/tclmodules/mf/getenv/1.0",fullName="getenv/1.0",loadOrder=2,propT={},stackDepth=0,status="active",userName="getenv",wV="000000001.*zfinal",},help={fn="ProjectDIR/rt/tclmodules/mf/help/1.0",fullName="help/1.0",loadOrder=3,propT={},stackDepth=0,status="active",userName="help/1.0",wV="000000001.*zfinal",},report={fn="ProjectDIR/rt/tclmodules/mf/report/1.0",fullName="report/1.0",loadOrder=4,propT={},stackDepth=0,status="active",userName="report/1.0",wV="000000001.*zfinal",},},mpathA={"ProjectDIR/rt/tclmodules/mf",},systemBaseMPATH="ProjectDIR/rt/tclmodules/mf",}';
122+
export _ModuleTable_;
123+
===========================
124+
step 14
125+
lua ProjectDIR/src/lmod.in.lua shell --regression_testing show report/1.0
126+
===========================
127+
MODULEPATH=ProjectDIR/rt/tclmodules/mf;
128+
export MODULEPATH;
129+
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={earlyLateOutput={fn="ProjectDIR/rt/tclmodules/mf/earlyLateOutput/2.0",fullName="earlyLateOutput/2.0",loadOrder=1,propT={},stackDepth=0,status="active",userName="earlyLateOutput",wV="000000002.*zfinal",},getenv={fn="ProjectDIR/rt/tclmodules/mf/getenv/1.0",fullName="getenv/1.0",loadOrder=2,propT={},stackDepth=0,status="active",userName="getenv",wV="000000001.*zfinal",},help={fn="ProjectDIR/rt/tclmodules/mf/help/1.0",fullName="help/1.0",loadOrder=3,propT={},stackDepth=0,status="active",userName="help/1.0",wV="000000001.*zfinal",},report={fn="ProjectDIR/rt/tclmodules/mf/report/1.0",fullName="report/1.0",loadOrder=4,propT={},stackDepth=0,status="active",userName="report/1.0",wV="000000001.*zfinal",},},mpathA={"ProjectDIR/rt/tclmodules/mf",},systemBaseMPATH="ProjectDIR/rt/tclmodules/mf",}';
130+
export _ModuleTable_;
131+
===========================
132+
step 15
133+
lua ProjectDIR/src/lmod.in.lua shell --regression_testing help report/1.0
134+
===========================
135+
MODULEPATH=ProjectDIR/rt/tclmodules/mf;
136+
export MODULEPATH;
137+
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={earlyLateOutput={fn="ProjectDIR/rt/tclmodules/mf/earlyLateOutput/2.0",fullName="earlyLateOutput/2.0",loadOrder=1,propT={},stackDepth=0,status="active",userName="earlyLateOutput",wV="000000002.*zfinal",},getenv={fn="ProjectDIR/rt/tclmodules/mf/getenv/1.0",fullName="getenv/1.0",loadOrder=2,propT={},stackDepth=0,status="active",userName="getenv",wV="000000001.*zfinal",},help={fn="ProjectDIR/rt/tclmodules/mf/help/1.0",fullName="help/1.0",loadOrder=3,propT={},stackDepth=0,status="active",userName="help/1.0",wV="000000001.*zfinal",},report={fn="ProjectDIR/rt/tclmodules/mf/report/1.0",fullName="report/1.0",loadOrder=4,propT={},stackDepth=0,status="active",userName="report/1.0",wV="000000001.*zfinal",},},mpathA={"ProjectDIR/rt/tclmodules/mf",},systemBaseMPATH="ProjectDIR/rt/tclmodules/mf",}';
138+
export _ModuleTable_;
139+
===========================
140+
step 16
141+
lua ProjectDIR/src/lmod.in.lua shell --regression_testing unload report/1.0
142+
===========================
143+
LOADEDMODULES=earlyLateOutput/2.0:getenv/1.0:help/1.0;
144+
export LOADEDMODULES;
145+
MODULEPATH=ProjectDIR/rt/tclmodules/mf;
146+
export MODULEPATH;
147+
_LMFILES_=ProjectDIR/rt/tclmodules/mf/earlyLateOutput/2.0:ProjectDIR/rt/tclmodules/mf/getenv/1.0:ProjectDIR/rt/tclmodules/mf/help/1.0;
148+
export _LMFILES_;
149+
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={earlyLateOutput={fn="ProjectDIR/rt/tclmodules/mf/earlyLateOutput/2.0",fullName="earlyLateOutput/2.0",loadOrder=1,propT={},stackDepth=0,status="active",userName="earlyLateOutput",wV="000000002.*zfinal",},getenv={fn="ProjectDIR/rt/tclmodules/mf/getenv/1.0",fullName="getenv/1.0",loadOrder=2,propT={},stackDepth=0,status="active",userName="getenv",wV="000000001.*zfinal",},help={fn="ProjectDIR/rt/tclmodules/mf/help/1.0",fullName="help/1.0",loadOrder=3,propT={},stackDepth=0,status="active",userName="help/1.0",wV="000000001.*zfinal",},},mpathA={"ProjectDIR/rt/tclmodules/mf",},systemBaseMPATH="ProjectDIR/rt/tclmodules/mf",}';
150+
export _ModuleTable_;

rt/tclmodules/tclmodules.tdesc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ testdescript = {
3636
runLmod load help/1.0 # 10
3737
runLmod help help/1.0 # 11
3838
runLmod help help/2.0 # 12
39+
runLmod load report/1.0 # 13
40+
runLmod show report/1.0 # 14
41+
runLmod help report/1.0 # 15
42+
runLmod unload report/1.0 # 16
3943
4044
HOME=$ORIG_HOME
4145
cat _stdout.[0-9][0-9][0-9] > _stdout.orig

src/tcl2lua.tcl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,11 @@ proc module { command args } {
10491049
}
10501050
}
10511051

1052+
proc report {message} {
1053+
global g_outputA
1054+
lappend g_outputA "LmodMessage(\[===\[$message\]===\])\n"
1055+
}
1056+
10521057
proc reportError {message} {
10531058
global g_outputA
10541059
global ModulesCurrentModulefile g_fullName
@@ -1095,6 +1100,7 @@ proc execute-modulefile {modfile } {
10951100
interp alias $child puts {} myPuts
10961101
interp alias $child remove-path {} remove-path
10971102
interp alias $child remove-property {} remove-property
1103+
interp alias $child report {} report
10981104
interp alias $child reportError {} reportError
10991105
interp alias $child require-fullname {} require-fullname
11001106
interp alias $child set-alias {} set-alias

0 commit comments

Comments
 (0)