Porting Modules to Python

rminsk at my-deja.com rminsk at my-deja.com
Tue Apr 11 14:29:18 EDT 2000


I am porting a package called Modules (www.modules.org) to Python.
It is unfortunate that the name conflicts.  I am by no means a Python
expert and would like to ask some help in porting a initialization
script from perl to Python.  Thank you for your help...

The perl script follows...

if (! defined $ENV{MODULE_VERSION} ) {
        $ENV{MODULE_VERSION_STACK}="@VERSION@";
        $ENV{MODULE_VERSION}="@VERSION@";
} else {
        $ENV{MODULE_VERSION_STACK}="$MODULE_VERSION";
}

sub module {
        local ($exec_prefix);
        $exec_prefix = "@BASEPREFIX@".$ENV{MODULE_VERSION};

        eval `$exec_prefix/bin/modulecmd perl @_`;
}

if (! defined $ENV{MODULEPATH} ) {
  $ENV{MODULEPATH} = `sed 's/#.*$//' ${MODULESHOME}/init/.modulespath |
awk 'NF==1{printf("%s:",$1)}'`
}

if (! defined $ENV{LOADEDMODULES} ) {
  $ENV{LOADEDMODULES} = "";
}

$ENV{MODULESHOME} = "@prefix@";


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list