Fix extends('tcl') environment (#7473)

This commit is contained in:
Federico Ficarelli 2018-03-14 07:02:50 +01:00 committed by Massimiliano Culpo
parent 73dd58b68a
commit b5879d7d07

View file

@ -75,7 +75,14 @@ def symlink_tclsh(self):
def tcl_lib_dir(self): def tcl_lib_dir(self):
"""The Tcl version-specific library directory where all extensions are """The Tcl version-specific library directory where all extensions are
installed.""" installed."""
return join_path('lib', 'tcl{0}'.format(self.version.up_to(2))) return 'lib'
@property
def tcl_builtin_lib_dir(self):
"""The Tcl version-specific library directory where all builtin
extensions are installed."""
return join_path(self.tcl_lib_dir,
'tcl{0}'.format(self.version.up_to(2)))
def setup_dependent_environment(self, spack_env, run_env, dependent_spec): def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
"""Set TCLLIBPATH to include the tcl-shipped directory for """Set TCLLIBPATH to include the tcl-shipped directory for
@ -89,17 +96,24 @@ def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
# it boils down to the same situation we have here. # it boils down to the same situation we have here.
spack_env.prepend_path('PATH', os.path.dirname(self.prefix.bin)) spack_env.prepend_path('PATH', os.path.dirname(self.prefix.bin))
tcl_paths = [join_path(self.prefix, self.tcl_lib_dir)] tcl_paths = [join_path(self.prefix, self.tcl_builtin_lib_dir)]
for d in dependent_spec.traverse(deptype=('build', 'run', 'test')): for d in dependent_spec.traverse(deptype=('build', 'run', 'test')):
if d.package.extends(self.spec): if d.package.extends(self.spec):
tcl_paths.append(join_path(d.prefix, self.tcl_lib_dir)) tcl_paths.append(join_path(d.prefix, self.tcl_lib_dir))
tcllibpath = ':'.join(tcl_paths) # WARNING: paths in $TCLLIBPATH must be *space* separated,
# its value is meant to be a Tcl list, *not* an env list
# as explained here: https://wiki.tcl.tk/1787:
# "TCLLIBPATH is a Tcl list, not some platform-specific
# colon-separated or semi-colon separated format"
tcllibpath = ' '.join(tcl_paths)
spack_env.set('TCLLIBPATH', tcllibpath) spack_env.set('TCLLIBPATH', tcllibpath)
# For run time environment set only the path for # For run time environment set only the path for
# dependent_spec and prepend it to TCLLIBPATH # dependent_spec and prepend it to TCLLIBPATH
if dependent_spec.package.extends(self.spec): if dependent_spec.package.extends(self.spec):
run_env.prepend_path('TCLLIBPATH', join_path( dependent_tcllibpath = join_path(dependent_spec.prefix,
dependent_spec.prefix, self.tcl_lib_dir)) self.tcl_lib_dir)
run_env.prepend_path('TCLLIBPATH', dependent_tcllibpath,
separator=' ')