summaryrefslogtreecommitdiff
path: root/lib/spack/spack/projections.py
blob: b11c9c2a6d426233bb0359e653d763e047a8b13b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Copyright 2013-2024 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