Change iteration variable names to avoid clashes with the rest of Spack
Spack's weird overall architecture makes temporary variables in the package scope really dangerous. In my case, an iteration variable 'module' caused the perl package to fall over...
This commit is contained in:
parent
1d258a75d6
commit
8c3ebdf0f1
|
@ -65,7 +65,7 @@ class Dune(CMakePackage):
|
||||||
# Dependencies between modules - not necessarily the full set
|
# Dependencies between modules - not necessarily the full set
|
||||||
# as the closure of module dependencies is built later on.
|
# as the closure of module dependencies is built later on.
|
||||||
# dune-common does not need to be named.
|
# dune-common does not need to be named.
|
||||||
module_dependencies = {
|
dune_module_dependencies = {
|
||||||
'dune-alugrid': ['dune-grid'],
|
'dune-alugrid': ['dune-grid'],
|
||||||
'dune-codegen': ['dune-pdelab', 'dune-testtools', 'dune-alugrid'],
|
'dune-codegen': ['dune-pdelab', 'dune-testtools', 'dune-alugrid'],
|
||||||
'dune-fem': ['dune-grid'],
|
'dune-fem': ['dune-grid'],
|
||||||
|
@ -80,18 +80,22 @@ class Dune(CMakePackage):
|
||||||
'dune-polygongrid': ['dune-grid'],
|
'dune-polygongrid': ['dune-grid'],
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build the closure of above module dependency list
|
# Build the closure of above module dependency list.
|
||||||
for module in module_dependencies:
|
# We need to use cryptic variable names here because
|
||||||
closure = set(module_dependencies[module])
|
# Spack behaves in weird ways if we accidentally use
|
||||||
old_closure = set()
|
# names (like 'module') that are used in seemingly
|
||||||
while (len(closure) > len(old_closure)):
|
# unrelated places.
|
||||||
old_closure = closure.copy()
|
for _mod in dune_module_dependencies:
|
||||||
|
_closure = set(dune_module_dependencies[_mod])
|
||||||
|
_old_closure = set()
|
||||||
|
while (len(_closure) > len(_old_closure)):
|
||||||
|
_old_closure = _closure.copy()
|
||||||
|
|
||||||
for res in old_closure:
|
for _res in _old_closure:
|
||||||
for mod in module_dependencies.get(res, []):
|
for _m in dune_module_dependencies.get(_res, []):
|
||||||
closure.add(mod)
|
_closure.add(_m)
|
||||||
|
|
||||||
module_dependencies[module] = list(closure)
|
dune_module_dependencies[_mod] = list(_closure)
|
||||||
|
|
||||||
# Variants for the general build process
|
# Variants for the general build process
|
||||||
variant('shared', default=True, description='Enables the build of shared libraries.')
|
variant('shared', default=True, description='Enables the build of shared libraries.')
|
||||||
|
@ -116,119 +120,119 @@ class Dune(CMakePackage):
|
||||||
# Define conflicts between Dune module variants. These conflicts are of the following type:
|
# Define conflicts between Dune module variants. These conflicts are of the following type:
|
||||||
# conflicts('dune~functions', when='+pdelab') -> dune-pdelab cannot be built without dune-functions
|
# conflicts('dune~functions', when='+pdelab') -> dune-pdelab cannot be built without dune-functions
|
||||||
for var, res in dune_variants_to_resources.items():
|
for var, res in dune_variants_to_resources.items():
|
||||||
for dep in module_dependencies.get(res, []):
|
for dep in dune_module_dependencies.get(res, []):
|
||||||
if dep in dune_resources_to_variants:
|
if dep in dune_resources_to_variants:
|
||||||
conflicts('dune~%s' % dune_resources_to_variants[dep], when='+%s' % var)
|
conflicts('dune~%s' % dune_resources_to_variants[dep], when='+%s' % var)
|
||||||
|
|
||||||
# Iterate over all available Dune versions and define resources for all Dune modules
|
# Iterate over all available Dune versions and define resources for all Dune modules
|
||||||
# If a Dune module behaves differently for different versions (e.g. dune-python got
|
# If a Dune module behaves differently for different versions (e.g. dune-python got
|
||||||
# merged into dune-common post-2.7), define the resource outside of this loop.
|
# merged into dune-common post-2.7), define the resource outside of this loop.
|
||||||
for vers, branch in dune_versions_to_branch:
|
for _vers, _branch in dune_versions_to_branch:
|
||||||
version(vers, branch=branch)
|
version(_vers, branch=_branch)
|
||||||
|
|
||||||
resource(
|
resource(
|
||||||
name='dune-geometry',
|
name='dune-geometry',
|
||||||
git='https://gitlab.dune-project.org/core/dune-geometry.git',
|
git='https://gitlab.dune-project.org/core/dune-geometry.git',
|
||||||
branch=branch,
|
branch=_branch,
|
||||||
when='@%s' % vers,
|
when='@%s' % _vers,
|
||||||
)
|
)
|
||||||
|
|
||||||
resource(
|
resource(
|
||||||
name='dune-grid',
|
name='dune-grid',
|
||||||
git='https://gitlab.dune-project.org/core/dune-grid.git',
|
git='https://gitlab.dune-project.org/core/dune-grid.git',
|
||||||
branch=branch,
|
branch=_branch,
|
||||||
when='@%s' % vers,
|
when='@%s' % _vers,
|
||||||
)
|
)
|
||||||
|
|
||||||
resource(
|
resource(
|
||||||
name='dune-istl',
|
name='dune-istl',
|
||||||
git='https://gitlab.dune-project.org/core/dune-istl.git',
|
git='https://gitlab.dune-project.org/core/dune-istl.git',
|
||||||
branch=branch,
|
branch=_branch,
|
||||||
when='@%s' % vers,
|
when='@%s' % _vers,
|
||||||
)
|
)
|
||||||
|
|
||||||
resource(
|
resource(
|
||||||
name='dune-localfunctions',
|
name='dune-localfunctions',
|
||||||
git='https://gitlab.dune-project.org/core/dune-localfunctions.git',
|
git='https://gitlab.dune-project.org/core/dune-localfunctions.git',
|
||||||
branch=branch,
|
branch=_branch,
|
||||||
when='@%s' % vers,
|
when='@%s' % _vers,
|
||||||
)
|
)
|
||||||
|
|
||||||
resource(
|
resource(
|
||||||
name='dune-functions',
|
name='dune-functions',
|
||||||
git='https://gitlab.dune-project.org/staging/dune-functions.git',
|
git='https://gitlab.dune-project.org/staging/dune-functions.git',
|
||||||
branch=branch,
|
branch=_branch,
|
||||||
when='@%s+functions' % vers,
|
when='@%s+functions' % _vers,
|
||||||
)
|
)
|
||||||
|
|
||||||
resource(
|
resource(
|
||||||
name='dune-typetree',
|
name='dune-typetree',
|
||||||
git='https://gitlab.dune-project.org/staging/dune-typetree.git',
|
git='https://gitlab.dune-project.org/staging/dune-typetree.git',
|
||||||
branch=branch,
|
branch=_branch,
|
||||||
when='@%s+typetree' % vers,
|
when='@%s+typetree' % _vers,
|
||||||
)
|
)
|
||||||
|
|
||||||
resource(
|
resource(
|
||||||
name='dune-alugrid',
|
name='dune-alugrid',
|
||||||
git='https://gitlab.dune-project.org/extensions/dune-alugrid.git',
|
git='https://gitlab.dune-project.org/extensions/dune-alugrid.git',
|
||||||
branch=branch,
|
branch=_branch,
|
||||||
when='@%s+alugrid' % vers,
|
when='@%s+alugrid' % _vers,
|
||||||
)
|
)
|
||||||
|
|
||||||
resource(
|
resource(
|
||||||
name='dune-uggrid',
|
name='dune-uggrid',
|
||||||
git='https://gitlab.dune-project.org/staging/dune-uggrid.git',
|
git='https://gitlab.dune-project.org/staging/dune-uggrid.git',
|
||||||
branch='releases/2.7',
|
branch=_branch,
|
||||||
when='@%s+uggrid' % vers,
|
when='@%s+uggrid' % _vers,
|
||||||
)
|
)
|
||||||
|
|
||||||
resource(
|
resource(
|
||||||
name='dune-spgrid',
|
name='dune-spgrid',
|
||||||
git='https://gitlab.dune-project.org/extensions/dune-spgrid.git',
|
git='https://gitlab.dune-project.org/extensions/dune-spgrid.git',
|
||||||
branch=branch,
|
branch=_branch,
|
||||||
when='@%s+spgrid' % vers,
|
when='@%s+spgrid' % _vers,
|
||||||
)
|
)
|
||||||
|
|
||||||
resource(
|
resource(
|
||||||
name='dune-testtools',
|
name='dune-testtools',
|
||||||
git='https://gitlab.dune-project.org/quality/dune-testtools.git',
|
git='https://gitlab.dune-project.org/quality/dune-testtools.git',
|
||||||
branch=branch,
|
branch=_branch,
|
||||||
when='@%s+testtools' % vers,
|
when='@%s+testtools' % _vers,
|
||||||
)
|
)
|
||||||
|
|
||||||
resource(
|
resource(
|
||||||
name='dune-polygongrid',
|
name='dune-polygongrid',
|
||||||
git='https://gitlab.dune-project.org/extensions/dune-polygongrid.git',
|
git='https://gitlab.dune-project.org/extensions/dune-polygongrid.git',
|
||||||
branch=branch,
|
branch=_branch,
|
||||||
when='@%s+polygongrid' % vers,
|
when='@%s+polygongrid' % _vers,
|
||||||
)
|
)
|
||||||
|
|
||||||
resource(
|
resource(
|
||||||
name='dune-foamgrid',
|
name='dune-foamgrid',
|
||||||
git='https://gitlab.dune-project.org/extensions/dune-foamgrid.git',
|
git='https://gitlab.dune-project.org/extensions/dune-foamgrid.git',
|
||||||
branch=branch,
|
branch=_branch,
|
||||||
when='@%s+foamgrid' % vers,
|
when='@%s+foamgrid' % _vers,
|
||||||
)
|
)
|
||||||
|
|
||||||
resource(
|
resource(
|
||||||
name='dune-multidomaingrid',
|
name='dune-multidomaingrid',
|
||||||
git='https://gitlab.dune-project.org/extensions/dune-multidomaingrid.git',
|
git='https://gitlab.dune-project.org/extensions/dune-multidomaingrid.git',
|
||||||
branch=branch,
|
branch=_branch,
|
||||||
when='@%s+multidomaingrid' % vers,
|
when='@%s+multidomaingrid' % _vers,
|
||||||
)
|
)
|
||||||
|
|
||||||
resource(
|
resource(
|
||||||
name='dune-fem',
|
name='dune-fem',
|
||||||
git='https://gitlab.dune-project.org/dune-fem/dune-fem.git',
|
git='https://gitlab.dune-project.org/dune-fem/dune-fem.git',
|
||||||
branch=branch,
|
branch=_branch,
|
||||||
when='@%s+fem' % vers,
|
when='@%s+fem' % _vers,
|
||||||
)
|
)
|
||||||
|
|
||||||
resource(
|
resource(
|
||||||
name='dune-fempy',
|
name='dune-fempy',
|
||||||
git='https://gitlab.dune-project.org/dune-fem/dune-fempy.git',
|
git='https://gitlab.dune-project.org/dune-fem/dune-fempy.git',
|
||||||
branch=branch,
|
branch=_branch,
|
||||||
when='@%s+fem+python' % vers,
|
when='@%s+fem+python' % _vers,
|
||||||
)
|
)
|
||||||
|
|
||||||
# The dune-grid-glue package does not yet have a 2.7-compatible release
|
# The dune-grid-glue package does not yet have a 2.7-compatible release
|
||||||
|
@ -304,9 +308,6 @@ class Dune(CMakePackage):
|
||||||
# Apply patches
|
# Apply patches
|
||||||
patch('virtualenv_from_envvariable.patch', when='+testtools')
|
patch('virtualenv_from_envvariable.patch', when='+testtools')
|
||||||
|
|
||||||
# Some additional variant conflicts of Dune modules and upstream dependencies
|
|
||||||
conflicts('dune~superlu', when='+codegen')
|
|
||||||
|
|
||||||
def setup_build_environment(self, env):
|
def setup_build_environment(self, env):
|
||||||
# We reset the DUNE_CONTROL_PATH here because any entries in this
|
# We reset the DUNE_CONTROL_PATH here because any entries in this
|
||||||
# path that contain Dune modules will break the Spack build process.
|
# path that contain Dune modules will break the Spack build process.
|
||||||
|
|
Loading…
Reference in New Issue