-
Notifications
You must be signed in to change notification settings - Fork 2
/
functions.tcl
38 lines (33 loc) · 1.01 KB
/
functions.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# get the full, normlized path to the directory containing this tcl script:
proc home {} {
set x [ dict get [info frame 0] file ]
return [ file normalize [exec dirname $x]/../.. ]
}
# get the $OSRELEASE environment variable if it exists, else
# run our script to get what it will become upon loading modules:
# (Note, we don't use getenv here for performance reasons.)
proc osrelease {} {
if { [ info exists ::env(OSRELEASE) ] } {
return $::env(OSRELEASE)
}
return [ exec [home]/modulefiles/util/osrelease.py ]
}
# print a warning message if a path doesn't exist:
proc warndir {path msg} {
if [file isdirectory $path] {
return 1
} elseif [module-info mode load] {
reportWarning $msg
}
return 0
}
# sort of a "prereq --optional" prior to version 5.2:
proc prereq_optional {name} {
if [is-avail $name] {
if [expr {[versioncmp $::ModuleToolVersion 5.2] < 0}] {
prereq $name
} else {
prereq --optional $name
}
}
}