使proc可用於所有模塊文件? - Make proc available to all modulefiles? -开发者知识库

使proc可用於所有模塊文件? - Make proc available to all modulefiles? -开发者知识库,第1张

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.

我正在使用模塊來管理軟件。我正在嘗試設置環境,以便可以從任何模塊文件調用某個函數,而不必每個文件都必須獲取proc定義。

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

示例:我希望util:prereq函數在以下模塊文件中可用,而無需獲取其定義:

#%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?

為了做到這一點,我知道我將不得不掛鈎到modulefiles或tcl或其他東西。有任何想法嗎?

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.

此函數的用法類似於prereq,但該函數將加載任何先決條件而不是因為未加載而失敗。

1 个解决方案

#1


1  

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

比clarkw建議的更好的方法是使用舊的tclIndex文件。

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_path文件夾或其子目錄(建議的子目錄)中。您可以手動或通過調用來創建tclIndex文件

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.

再次:目錄應該是$ auto_path的(子)目錄如果第一次使用其中一個命令,這將獲取你的tcl文件。

最佳答案:

本文经用户投稿或网站收集转载,如有侵权请联系本站。

发表评论

0条回复