Question

I'm using modules to manage software. I'm trying to set up the environment so that a certain function can be called from any modulefile without each file having to source the proc definition.

Example: I want the util:prereq function to be available in the following modulefile without having to source its definition:

#%Module1.0

util::prereq compiler_intel/13.0.1 mpi/openmpi-1.6.4_intel-13.0.1

In order to do this I know I'll have to hook into modulefiles or tcl or something. Any ideas?

The usage of this function is similar to prereq except that the function will load any prerequisites instead of failing because it isn't loaded.

Was it helpful?

Solution

A much better way than clarkw suggested is to use the old tclIndex file.

This file has to be in the folders $auto_path or a subdirectory of them (subdirectory suggested).
You can create the tclIndex file either by hand or by invoking

auto_mkindex directory file.tcl

Again: directory should be a (sub-)directory of $auto_path
This will source your tcl file if one of it's command is used for the first time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top