Skip to content

Commit

Permalink
merged conflicts of PR spack#498
Browse files Browse the repository at this point in the history
  • Loading branch information
luigicalori committed Mar 30, 2016
2 parents d340f3e + e50ce68 commit bea1123
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 22 deletions.
34 changes: 24 additions & 10 deletions lib/spack/spack/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,20 @@ class Dotkit(EnvModule):

@property
def file_name(self):
return join_path(Dotkit.path, self.spec.architecture, '%s.dk' % self.use_name)
#orig# return join_path(Dotkit.path, self.spec.architecture, '%s.dk' % self.use_name)
return join_path(Dotkit.path, self.spec.architecture, self.spec.name,
'%s.dk' % self.use_name)

@property
def use_name(self):
return "%s-%s-%s-%s-%s" % (self.spec.name, self.spec.version,
self.spec.compiler.name,
self.spec.compiler.version,
self.spec.dag_hash())
#orig# return "%s-%s-%s-%s-%s" % (self.spec.name, self.spec.version,
#orig# self.spec.compiler.name,
#orig# self.spec.compiler.version,
#orig# self.spec.dag_hash())
return "%s-%s-%s-%s" % (self.spec.version,
self.spec.compiler.name,
self.spec.compiler.version,
self.spec.dag_hash())

def write_header(self, dk_file):
# Category
Expand Down Expand Up @@ -258,14 +264,18 @@ class TclModule(EnvModule):

@property
def file_name(self):
return join_path(TclModule.path, self.spec.architecture, self.use_name)
return join_path(TclModule.path, self.spec.architecture, self.spec.name, self.use_name)

@property
def use_name(self):
return "%s-%s-%s-%s-%s" % (self.spec.name, self.spec.version,
self.spec.compiler.name,
self.spec.compiler.version,
self.spec.dag_hash())
#orig# return "%s-%s-%s-%s-%s" % (self.spec.name, self.spec.version,
#orig# self.spec.compiler.name,
#orig# self.spec.compiler.version,
#orig# self.spec.dag_hash())
return "%s-%s-%s-%s" % (self.spec.version,
self.spec.compiler.name,
self.spec.compiler.version,
self.spec.dag_hash())

def write_header(self, module_file):
# TCL Modulefile header
Expand All @@ -281,3 +291,7 @@ def write_header(self, module_file):
for line in textwrap.wrap(self.long_description, 72):
module_file.write("puts stderr \"%s\"\n" % line)
module_file.write('}\n\n')

# Write out directory based conflict
m_file.write('conflict %s\n\n' % self.spec.name)

12 changes: 7 additions & 5 deletions share/spack/csh/spack.csh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ set _sp_subcommand=""
set _sp_spec=""
[ $#_sp_args -gt 0 ] && set _sp_subcommand = ($_sp_args[1])
[ $#_sp_args -gt 1 ] && set _sp_spec = ($_sp_args[2-])
set _sp_spec_name=`echo $_sp_spec | cut -d@ -f1`

# Figure out what type of module we're running here.
set _sp_modtype = ""
Expand All @@ -67,6 +68,7 @@ case unload:
set _sp_module_args = $_sp_spec[1]
shift _sp_spec
set _sp_spec = ($_sp_spec)
set _sp_spec_name=`echo $_sp_spec | cut -d@ -f1`
endif

# Here the user has run use or unuse with a spec. Find a matching
Expand All @@ -76,25 +78,25 @@ case unload:
case "use":
set _sp_full_spec = ( "`\spack $_sp_flags module find dotkit $_sp_spec`" )
if ( $? == 0 ) then
use $_sp_module_args $_sp_full_spec
use $_sp_module_args $_sp_spec_name/$_sp_full_spec
endif
breaksw
case "unuse":
set _sp_full_spec = ( "`\spack $_sp_flags module find dotkit $_sp_spec`" )
if ( $? == 0 ) then
unuse $_sp_module_args $_sp_full_spec
unuse $_sp_module_args $_sp_spec_name/$_sp_full_spec
endif
breaksw
case "load":
set _sp_full_spec = ( "`\spack $_sp_flags module find tcl $_sp_spec`" )
if ( $? == 0 ) then
module load $_sp_module_args $_sp_full_spec
module load $_sp_module_args $_sp_spec_name/$_sp_full_spec
endif
breaksw
case "unload":
set _sp_full_spec = ( "`\spack $_sp_flags module find tcl $_sp_spec`" )
if ( $? == 0 ) then
module unload $_sp_module_args $_sp_full_spec
module unload $_sp_module_args $_sp_spec_name/$_sp_full_spec
endif
breaksw
endsw
Expand All @@ -107,4 +109,4 @@ endsw

_sp_end:
unset _sp_args _sp_full_spec _sp_modtype _sp_module_args
unset _sp_sh_cmd _sp_spec _sp_subcommand _sp_flags
unset _sp_sh_cmd _sp_spec _sp_spec_name _sp_subcommand _sp_flags
6 changes: 3 additions & 3 deletions share/spack/setup-env.csh
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ if ($?SPACK_ROOT) then
alias _spack_pathadd 'set _pa_args = (\!*) && source $_spack_share_dir/csh/pathadd.csh'

# Set up modules and dotkit search paths in the user environment
# TODO: fix SYS_TYPE to something non-LLNL-specific
_spack_pathadd DK_NODE "$_spack_share_dir/dotkit/$SYS_TYPE"
_spack_pathadd MODULEPATH "$_spack_share_dir/modules/$SYS_TYPE"
_spack_pathadd PATH "$SPACK_ROOT/bin"
set _sp_sys_type=`spack-python -c 'print(spack.architecture.sys_type())'`
_spack_pathadd DK_NODE "$_spack_share_dir/dotkit/$_sp_sys_type"
_spack_pathadd MODULEPATH "$_spack_share_dir/modules/$_sp_sys_type"
endif
10 changes: 6 additions & 4 deletions share/spack/setup-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ function spack {

_sp_subcommand=$1; shift
_sp_spec="$@"
_sp_spec_name=$(echo $_sp_spec | cut -d@ -f1)

# Filter out use and unuse. For any other commands, just run the
# command.
Expand All @@ -94,6 +95,7 @@ function spack {
if [[ "$1" =~ ^- ]]; then
_sp_module_args="$1"; shift
_sp_spec="$@"
_sp_spec_name=$(echo $_sp_spec | cut -d@ -f1)
fi

# Here the user has run use or unuse with a spec. Find a matching
Expand All @@ -103,19 +105,19 @@ function spack {
case $_sp_subcommand in
"use")
if _sp_full_spec=$(command spack $_sp_flags module find dotkit $_sp_spec); then
use $_sp_module_args $_sp_full_spec
use $_sp_module_args $_sp_spec_name/$_sp_full_spec
fi ;;
"unuse")
if _sp_full_spec=$(command spack $_sp_flags module find dotkit $_sp_spec); then
unuse $_sp_module_args $_sp_full_spec
unuse $_sp_module_args $_sp_spec_name/$_sp_full_spec
fi ;;
"load")
if _sp_full_spec=$(command spack $_sp_flags module find dotkit $_sp_spec); then
module load $_sp_module_args $_sp_full_spec
module load $_sp_module_args $_sp_spec_name/$_sp_full_spec
fi ;;
"unload")
if _sp_full_spec=$(command spack $_sp_flags module find dotkit $_sp_spec); then
module unload $_sp_module_args $_sp_full_spec
module unload $_sp_module_args $_sp_spec_name/$_sp_full_spec
fi ;;
esac
;;
Expand Down

0 comments on commit bea1123

Please sign in to comment.