stacks: use new format string syntax in environments code

- Change old spec expressions to use Spack's new spec formatting sytnax.
This commit is contained in:
Gregory Becker 2019-04-18 09:54:17 -07:00 committed by Todd Gamblin
parent 2f6af64157
commit 9577ade3ce
4 changed files with 12 additions and 11 deletions

View File

@ -667,7 +667,7 @@ excludes those built with the PGI compiler at version 18.5.
select: [^mpi]
exclude: ['%pgi@18.5']
projections:
all: ${package}/${version}-${compilername}
all: {name}/{version}-{compiler.name}
For more information on using view projections, see the section on
:ref:`adding_projections_to_views`. The default for the ``select`` and

View File

@ -87,12 +87,12 @@ def get_job_name(spec, osarch):
def get_spec_string(spec):
format_elements = [
'${package}@${version}',
'%${compilername}@${compilerversion}',
'{name}{@version}',
'{%compiler}',
]
if spec.architecture:
format_elements.append(' arch=${architecture}')
format_elements.append(' {arch=architecture}')
return spec.format(''.join(format_elements))

View File

@ -397,7 +397,7 @@ def _eval_conditional(string):
architecture.platform(), 'default_os', 'default_target')
valid_variables = {
'target': str(arch.target),
'os': str(arch.platform_os),
'os': str(arch.os),
'platform': str(arch.platform),
'arch': str(arch),
'architecture': str(arch),
@ -1204,6 +1204,7 @@ def write(self):
else:
view = False
yaml_dict = config_dict(self.yaml)
if view is not True:
# The default case is to keep an active view inside of the
# Spack environment directory. To avoid cluttering the config,

View File

@ -1116,7 +1116,7 @@ def test_stack_combinatorial_view(tmpdir, mock_fetch, mock_packages,
combinatorial:
root: %s
projections:
'all': '${package}/${version}-${compilername}'""" % viewdir)
'all': '{name}/{version}-{compiler.name}'""" % viewdir)
with tmpdir.as_cwd():
env('create', 'test', './spack.yaml')
with ev.read('test'):
@ -1149,7 +1149,7 @@ def test_stack_view_select(tmpdir, mock_fetch, mock_packages,
root: %s
select: ['%%gcc']
projections:
'all': '${package}/${version}-${compilername}'""" % viewdir)
'all': '{name}/{version}-{compiler.name}'""" % viewdir)
with tmpdir.as_cwd():
env('create', 'test', './spack.yaml')
with ev.read('test'):
@ -1187,7 +1187,7 @@ def test_stack_view_exclude(tmpdir, mock_fetch, mock_packages,
root: %s
exclude: [callpath]
projections:
'all': '${package}/${version}-${compilername}'""" % viewdir)
'all': '{name}/{version}-{compiler.name}'""" % viewdir)
with tmpdir.as_cwd():
env('create', 'test', './spack.yaml')
with ev.read('test'):
@ -1226,7 +1226,7 @@ def test_stack_view_select_and_exclude(tmpdir, mock_fetch, mock_packages,
select: ['%%gcc']
exclude: [callpath]
projections:
'all': '${package}/${version}-${compilername}'""" % viewdir)
'all': '{name}/{version}-{compiler.name}'""" % viewdir)
with tmpdir.as_cwd():
env('create', 'test', './spack.yaml')
with ev.read('test'):
@ -1330,8 +1330,8 @@ def test_stack_view_multiple_views(tmpdir, mock_fetch, mock_packages,
root: %s
exclude: [callpath %%gcc]
projections:
'all': '${package}/${version}-${compilername}'""" % (default_viewdir,
combin_viewdir))
'all': '{name}/{version}-{compiler.name}'""" % (default_viewdir,
combin_viewdir))
with tmpdir.as_cwd():
env('create', 'test', './spack.yaml')
with ev.read('test'):