#%Module1.0

module-whatis		"Pmodules environment"
module-url		"https://gitlab.psi.ch/Pmodules/src"
module-license		"GNU GPL v2"
module-maintainer	"Achim Gsell <achim.gsell@psi.ch>"

module-help	"
Pmodules are a hierarchical module environment based on Environment Modules.
"

#
# Older versions add '$PREFIX/bin' to PATH without loading Pmodules as
# a module. Remove it ...
#
if { [module-info mode load] } {
    set PATH ":$::env(PATH):"
    if { [regexp -- {.*:(.*/Pmodules/[^:]*):} $PATH -> str] } {
        if { [string compare $str $PREFIX/bin] != 0 } {
    	    remove-path PATH $str
        }
    }
    remove-path C_INCLUDE_PATH "$PREFIX/include"
    remove-path CPLUS_INCLUDE_PATH "$PREFIX/include"

    set shell [module-info shell]
    puts "source \"$PREFIX/init/$shell\""
}