| 1 |
#Common modulefile for bar |
| 2 |
#Expects the following variables to have been set |
| 3 |
# version: the version of bar, |
| 4 |
# defaults to last component of module tag |
| 5 |
# threadingmodel: one of 'nothreads', 'openmp' or 'pthreads' |
| 6 |
# licensefile: or will default based on version |
| 7 |
|
| 8 |
if {![info exists version]} { |
| 9 |
set version [file tail [module-info version [module-info name] ] ] |
| 10 |
} |
| 11 |
|
| 12 |
#Default to nothreads |
| 13 |
if {![info exists threadingmodel]} { |
| 14 |
set threadingmodel nothreads |
| 15 |
} |
| 16 |
|
| 17 |
#Default licensefile based on version |
| 18 |
if {![info exists licensefile]} { |
| 19 |
if [string equal $version 1.0] { |
| 20 |
set licensefile /somepath/to/version1/licenseFile.lic |
| 21 |
} else { |
| 22 |
set licensefile /a/completely/different/licenseFile.lic |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
proc ModulesHelp { } { |
| 27 |
global version threadingmodel licensefile |
| 28 |
|
| 29 |
set threadstr $threadingmodel |
| 30 |
if [ string equal $threadingmodel nothreads ] { |
| 31 |
set threadstr {no threading support} |
| 32 |
} |
| 33 |
puts stderr " |
| 34 |
Bar: Not so simple modulefile example |
| 35 |
Version $version |
| 36 |
Threading Model: $threadstr |
| 37 |
|
| 38 |
This is a more complicated example of code reuse in modulefiles. |
| 39 |
We have multiple versions of bar on the system, and each version |
| 40 |
comes with multiple variants for different threading support modules. |
| 41 |
Plus we assume that the env var BAR_LICENSE_FILE needs to be set |
| 42 |
differently depending on the bar version. |
| 43 |
|
| 44 |
Using license file: $licensefile |
| 45 |
|
| 46 |
" |
| 47 |
} |
| 48 |
module-whatis "bar version $version with threading $threadingmodel" |
| 49 |
|
| 50 |
conflict bar |
| 51 |
set rootdir /software/bar/$version/$threadingmodel |
| 52 |
prepend-path PATH $rootdir/bin |
| 53 |
prepend-path MANPATH $rootdir/share/man |
| 54 |
prepend-path LD_LIBRARY_PATH $rootdir/lib |
| 55 |
setenv BAR_LICENSE_FILE $licensefile |