Fixed up module support
This commit is contained in:

committed by
Todd Gamblin

parent
94c5c9667c
commit
57ddbd282a
@@ -59,7 +59,7 @@
|
||||
install_path = join_path(prefix, "opt")
|
||||
share_path = join_path(prefix, "share", "spack")
|
||||
dotkit_path = join_path(share_path, "dotkit")
|
||||
tclmodule_path = join_path(share_path, "tclmodule")
|
||||
tclmodule_path = join_path(share_path, "modules")
|
||||
|
||||
#
|
||||
# Set up the packages database.
|
||||
|
@@ -70,7 +70,7 @@ def module_find(parser, args):
|
||||
sys.exit(1)
|
||||
|
||||
match = specs[0]
|
||||
if not os.path.isfile(spack.hooks.tclmodules.tclmodules_file(match.package)):
|
||||
if not os.path.isfile(spack.hooks.tclmodule.module_file(match.package)):
|
||||
tty.die("No module is installed for package %s." % spec)
|
||||
|
||||
print match.format('$_$@$+$%@$=$#')
|
||||
@@ -84,8 +84,8 @@ def module_refresh(parser, args):
|
||||
specs = [s for s in specs
|
||||
if any(s.satisfies(q) for q in query_specs)]
|
||||
else:
|
||||
shutil.rmtree(spack.module_path, ignore_errors=False)
|
||||
mkdirp(spack.module_path)
|
||||
shutil.rmtree(spack.tclmodule_path, ignore_errors=False)
|
||||
mkdirp(spack.tclmodule_path)
|
||||
|
||||
for spec in specs:
|
||||
spack.hooks.tclmodule.post_install(spec.package)
|
||||
|
@@ -35,7 +35,7 @@
|
||||
|
||||
def module_file(pkg):
|
||||
m_file_name = pkg.spec.format('$_$@$%@$+$=$#')
|
||||
return join_path(spack.module_path, m_file_name)
|
||||
return join_path(spack.tclmodule_path, m_file_name)
|
||||
|
||||
|
||||
def post_install(pkg):
|
||||
@@ -51,26 +51,27 @@ def post_install(pkg):
|
||||
('LD_LIBRARY_PATH', pkg.prefix.lib64)]:
|
||||
|
||||
if os.path.isdir(path):
|
||||
alterations.append("prepend_path %s %s\n" % (var, path))
|
||||
alterations.append("prepend-path %s \"%s\"\n" % (var, path))
|
||||
|
||||
if not alterations:
|
||||
return
|
||||
|
||||
alterations.append("prepend_path CMAKE_PREFIX_PATH %s\n" % pkg.prefix)
|
||||
alterations.append("prepend-path CMAKE_PREFIX_PATH \"%s\"\n" % pkg.prefix)
|
||||
|
||||
m_file = module_file(pkg)
|
||||
with closing(open(m_file, 'w')) as m:
|
||||
# Put everything in the spack category.
|
||||
m.write('#%Module1.0\n')
|
||||
|
||||
m.write('module-whatis \"%s\"\n' % pkg.spec.format("$_ $@"))
|
||||
m.write('module-whatis \"%s\"\n\n' % pkg.spec.format("$_ $@"))
|
||||
|
||||
# Recycle the description
|
||||
if pkg.__doc__:
|
||||
m.write('proc ModulesHelp { } {\n')
|
||||
doc = re.sub(r'\s+', ' ', pkg.__doc__)
|
||||
m.write("puts str \"%s\"\n" % doc)
|
||||
m.write('}')
|
||||
doc = re.sub(r'"', '\"', pkg.__doc__)
|
||||
m.write("puts stderr \"%s\"\n" % doc)
|
||||
m.write('}\n\n')
|
||||
|
||||
|
||||
# Write alterations
|
||||
|
Reference in New Issue
Block a user