[!21] Change iteration variable names to avoid clashes with the rest of Spack
Merge branch 'bugfix/iteration-variables' into 'master' ref:spack/dune-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\... See merge request [spack/dune-spack!21] [spack/dune-spack!21]: gitlab.dune-project.org/spack/dune-spack/merge_requests/21
This commit is contained in:
commit
ba1a1010bd
|
@ -65,7 +65,7 @@ class Dune(CMakePackage):
|
|||
# Dependencies between modules - not necessarily the full set
|
||||
# as the closure of module dependencies is built later on.
|
||||
# dune-common does not need to be named.
|
||||
module_dependencies = {
|
||||
dune_module_dependencies = {
|
||||
'dune-alugrid': ['dune-grid'],
|
||||
'dune-codegen': ['dune-pdelab', 'dune-testtools', 'dune-alugrid'],
|
||||
'dune-fem': ['dune-grid'],
|
||||
|
@ -80,18 +80,22 @@ class Dune(CMakePackage):
|
|||
'dune-polygongrid': ['dune-grid'],
|
||||
}
|
||||
|
||||
# Build the closure of above module dependency list
|
||||
for module in module_dependencies:
|
||||
closure = set(module_dependencies[module])
|
||||
old_closure = set()
|
||||
while (len(closure) > len(old_closure)):
|
||||
old_closure = closure.copy()
|
||||
# Build the closure of above module dependency list.
|
||||
# We need to use cryptic variable names here because
|
||||
# Spack behaves in weird ways if we accidentally use
|
||||
# names (like 'module') that are used in seemingly
|
||||
# unrelated places.
|
||||
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 mod in module_dependencies.get(res, []):
|
||||
closure.add(mod)
|
||||
for _res in _old_closure:
|
||||
for _m in dune_module_dependencies.get(_res, []):
|
||||
_closure.add(_m)
|
||||
|
||||
module_dependencies[module] = list(closure)
|
||||
dune_module_dependencies[_mod] = list(_closure)
|
||||
|
||||
# Variants for the general build process
|
||||
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:
|
||||
# conflicts('dune~functions', when='+pdelab') -> dune-pdelab cannot be built without dune-functions
|
||||
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:
|
||||
conflicts('dune~%s' % dune_resources_to_variants[dep], when='+%s' % var)
|
||||
|
||||
# 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
|
||||
# merged into dune-common post-2.7), define the resource outside of this loop.
|
||||
for vers, branch in dune_versions_to_branch:
|
||||
version(vers, branch=branch)
|
||||
for _vers, _branch in dune_versions_to_branch:
|
||||
version(_vers, branch=_branch)
|
||||
|
||||
resource(
|
||||
name='dune-geometry',
|
||||
git='https://gitlab.dune-project.org/core/dune-geometry.git',
|
||||
branch=branch,
|
||||
when='@%s' % vers,
|
||||
branch=_branch,
|
||||
when='@%s' % _vers,
|
||||
)
|
||||
|
||||
resource(
|
||||
name='dune-grid',
|
||||
git='https://gitlab.dune-project.org/core/dune-grid.git',
|
||||
branch=branch,
|
||||
when='@%s' % vers,
|
||||
branch=_branch,
|
||||
when='@%s' % _vers,
|
||||
)
|
||||
|
||||
resource(
|
||||
name='dune-istl',
|
||||
git='https://gitlab.dune-project.org/core/dune-istl.git',
|
||||
branch=branch,
|
||||
when='@%s' % vers,
|
||||
branch=_branch,
|
||||
when='@%s' % _vers,
|
||||
)
|
||||
|
||||
resource(
|
||||
name='dune-localfunctions',
|
||||
git='https://gitlab.dune-project.org/core/dune-localfunctions.git',
|
||||
branch=branch,
|
||||
when='@%s' % vers,
|
||||
branch=_branch,
|
||||
when='@%s' % _vers,
|
||||
)
|
||||
|
||||
resource(
|
||||
name='dune-functions',
|
||||
git='https://gitlab.dune-project.org/staging/dune-functions.git',
|
||||
branch=branch,
|
||||
when='@%s+functions' % vers,
|
||||
branch=_branch,
|
||||
when='@%s+functions' % _vers,
|
||||
)
|
||||
|
||||
resource(
|
||||
name='dune-typetree',
|
||||
git='https://gitlab.dune-project.org/staging/dune-typetree.git',
|
||||
branch=branch,
|
||||
when='@%s+typetree' % vers,
|
||||
branch=_branch,
|
||||
when='@%s+typetree' % _vers,
|
||||
)
|
||||
|
||||
resource(
|
||||
name='dune-alugrid',
|
||||
git='https://gitlab.dune-project.org/extensions/dune-alugrid.git',
|
||||
branch=branch,
|
||||
when='@%s+alugrid' % vers,
|
||||
branch=_branch,
|
||||
when='@%s+alugrid' % _vers,
|
||||
)
|
||||
|
||||
resource(
|
||||
name='dune-uggrid',
|
||||
git='https://gitlab.dune-project.org/staging/dune-uggrid.git',
|
||||
branch='releases/2.7',
|
||||
when='@%s+uggrid' % vers,
|
||||
branch=_branch,
|
||||
when='@%s+uggrid' % _vers,
|
||||
)
|
||||
|
||||
resource(
|
||||
name='dune-spgrid',
|
||||
git='https://gitlab.dune-project.org/extensions/dune-spgrid.git',
|
||||
branch=branch,
|
||||
when='@%s+spgrid' % vers,
|
||||
branch=_branch,
|
||||
when='@%s+spgrid' % _vers,
|
||||
)
|
||||
|
||||
resource(
|
||||
name='dune-testtools',
|
||||
git='https://gitlab.dune-project.org/quality/dune-testtools.git',
|
||||
branch=branch,
|
||||
when='@%s+testtools' % vers,
|
||||
branch=_branch,
|
||||
when='@%s+testtools' % _vers,
|
||||
)
|
||||
|
||||
resource(
|
||||
name='dune-polygongrid',
|
||||
git='https://gitlab.dune-project.org/extensions/dune-polygongrid.git',
|
||||
branch=branch,
|
||||
when='@%s+polygongrid' % vers,
|
||||
branch=_branch,
|
||||
when='@%s+polygongrid' % _vers,
|
||||
)
|
||||
|
||||
resource(
|
||||
name='dune-foamgrid',
|
||||
git='https://gitlab.dune-project.org/extensions/dune-foamgrid.git',
|
||||
branch=branch,
|
||||
when='@%s+foamgrid' % vers,
|
||||
branch=_branch,
|
||||
when='@%s+foamgrid' % _vers,
|
||||
)
|
||||
|
||||
resource(
|
||||
name='dune-multidomaingrid',
|
||||
git='https://gitlab.dune-project.org/extensions/dune-multidomaingrid.git',
|
||||
branch=branch,
|
||||
when='@%s+multidomaingrid' % vers,
|
||||
branch=_branch,
|
||||
when='@%s+multidomaingrid' % _vers,
|
||||
)
|
||||
|
||||
resource(
|
||||
name='dune-fem',
|
||||
git='https://gitlab.dune-project.org/dune-fem/dune-fem.git',
|
||||
branch=branch,
|
||||
when='@%s+fem' % vers,
|
||||
branch=_branch,
|
||||
when='@%s+fem' % _vers,
|
||||
)
|
||||
|
||||
resource(
|
||||
name='dune-fempy',
|
||||
git='https://gitlab.dune-project.org/dune-fem/dune-fempy.git',
|
||||
branch=branch,
|
||||
when='@%s+fem+python' % vers,
|
||||
branch=_branch,
|
||||
when='@%s+fem+python' % _vers,
|
||||
)
|
||||
|
||||
# The dune-grid-glue package does not yet have a 2.7-compatible release
|
||||
|
@ -304,9 +308,6 @@ class Dune(CMakePackage):
|
|||
# Apply patches
|
||||
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):
|
||||
# We reset the DUNE_CONTROL_PATH here because any entries in this
|
||||
# path that contain Dune modules will break the Spack build process.
|
||||
|
|
Loading…
Reference in New Issue