Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow wildcard paths in init/.modulespath #125

Closed
xdelaruelle opened this issue Nov 20, 2015 · 4 comments
Closed

Allow wildcard paths in init/.modulespath #125

xdelaruelle opened this issue Nov 20, 2015 · 4 comments
Assignees
Milestone

Comments

@xdelaruelle
Copy link
Member

I'm configuring our modules enviornent with pre-built bundles of components that have cross-dependencies, like OpenMPI being built with the PGI compiler and CUDA, for example.
I'm adding the paths to these bundles to the init/.modulespath file so their contents will be visible when I run a "module avail" command.
It's a pain, though, to have to add a new path each time I define a new bundle. It would be trivial if I could add the path

     /shared/apps/centos-6.6_SB/PrgEnv/*/*

to the init/.modulespath file and have all the bundles picked up automatically.
I know this doesn't work right now, I'm testing the latest code from the repository. But can you add this? If you could tell me what to patch, I could test it for you.

Reported by: cponder

@xdelaruelle
Copy link
Member Author

This request here is about adjusting the init-scripts to perform variable substitutions

https://sourceforge.net/p/modules/feature-requests/12/

Would something like this work?

Original comment by: cponder

@xdelaruelle
Copy link
Member Author

It looks like an okay solution would be to change this part of the $MODULESHOME/init/bash script

if [ "${MODULEPATH:-}" = "" ]; then
  MODULEPATH=`sed -n 's/[   #].*$//; /./H; $ { x; s/^\n//; s/\n/:/g; p; }' /shared/apps/centos-6.6_SB/Modules/3.3_2015-11-19/init/.modulespath`
  export MODULEPATH
fi

to this form

if [ "${MODULEPATH:-}" = "" ]; then
    while read -r line
    do
        line=`echo -n $line | sed -e 's/#.*$//'`            # Remove trailing comments.
        line=`echo -n $line | sed -e 's/^[[:space:]]$//'`   # Remove leading whitespace.
        line=`echo -n $line | sed -e 's/[[:space:]]*$//'`   # Remove trailing whitespace.
        for item in $line
        do
            MODULEPATH+=:$item
        done
    done < $(MODULESHOME)/init/.modulespath
    export MODULEPATH
fi

I suppose the sed's could be comacted together. Beyond this, I don't want to use bash-dependent features because I want it to be easy to re-code (and compare with) ksh/csh etc.

Original comment by: cponder

@xdelaruelle
Copy link
Member Author

xdelaruelle commented Dec 21, 2015

Here are the modified versions of these init-scripts:

bash   csh     ksh
sh     tcsh    zsh

I don't think I can handle these adequately, it will take a programmer with the right experience:

cmake   perl.pm   python.py   ruby.rb

And I don't believe this one requires any changes:

bash_completion

bash.txt
csh.txt
ksh.txt
sh.txt
tcsh.txt
zsh.txt

Original comment by: cponder

@xdelaruelle
Copy link
Member Author

From discussion with R.K. Owen, we need to confirm that this will work correctly when the user has adjusted the globbing parameters in the environement. I'll take a look at this.

Original comment by: cponder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant