Parse the ${NAMESPACE} format string in a spec's format method. (#9686)

This allows installing software on a namespace basis by including ${NAMESPACE} in `install_path_scheme`. e.g.,

```
cat ~/.spack/config.yaml
config:
  install_path_scheme:
      "${ARCHITECTURE}/${NAMESPACE}/${COMPILERNAME}-${COMPILERVER}/${PACKAGE}-${VERSION}-${HASH}"
```
This commit is contained in:
Tim Fuller 2018-10-31 21:07:07 -06:00 committed by Todd Gamblin
parent fb849a4b7f
commit fc25ba1b22

View File

@ -2944,6 +2944,7 @@ def format(self, format_string='$_$@$%@+$+$=', **kwargs):
${SPACK_INSTALL} The default spack install directory,
${SPACK_PREFIX}/opt
${PREFIX} The package prefix
${NAMESPACE} The package namespace
Note these are case-insensitive: for example you can specify either
``${PACKAGE}`` or ``${package}``.
@ -3126,6 +3127,8 @@ def write(s, c):
else:
hashlen = None
out.write(fmt % (self.dag_hash(hashlen)))
elif named_str == 'NAMESPACE':
out.write(fmt % token_transform(self.namespace))
named = False