summaryrefslogtreecommitdiff
path: root/lib/spack/spack/projections.py
blob: 58f7b9bb7131a466939794b4d6a18b0ef9fac170 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)


def get_projection(projections, spec):
    """
    Get the projection for a spec from a projections dict.
    """
    all_projection = None
    for spec_like, projection in projections.items():
        if spec.satisfies(spec_like):
            return projection
        elif spec_like == "all":
            all_projection = projection
    return all_projection