From bcecb661e03bc3e95d184e4439b48d441af9ce8c Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Tue, 19 May 2020 14:54:15 +0200 Subject: [PATCH] Make iteration order of versions deterministic to ensure default version --- packages/dune/package.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/dune/package.py b/packages/dune/package.py index 83b766a..8c12511 100644 --- a/packages/dune/package.py +++ b/packages/dune/package.py @@ -33,11 +33,13 @@ class Dune(CMakePackage): git = "https://gitlab.dune-project.org/core/dune-common.git" # This defines a mapping of available versions of the dune Spack package - # and the branch name in the Dune repositories this refers to. - dune_versions_to_branch = { - "master" : "master", - "2.7" : "releases/2.7", - } + # and the branch name in the Dune repositories this refers to. This is a + # list instead of a dictionary to ensure iteration order (first entry is + # the default version) in Python3. + dune_versions_to_branch = [ + ("2.7", "releases/2.7"), + ("master" , "master"), + ] # Variants for the general build process variant('shared', default=True, description='Enables the build of shared libraries.') @@ -89,7 +91,7 @@ class Dune(CMakePackage): # 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.items(): + for vers, branch in dune_versions_to_branch: version(vers, branch=branch) resource(