summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin.mock/packages/needs-relocation/package.py
blob: 8ac037876fe2c81461c304566fb687c32791efdd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 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)

from spack.package import *


def check(condition, msg):
    """Raise an install error if condition is False."""
    if not condition:
        raise InstallError(msg)


class NeedsRelocation(Package):
    """A dumy package that encodes its prefix."""

    homepage = "https://www.cmake.org"
    url = "https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz"

    version("0.0.0", md5="12345678qwertyuiasdfghjkzxcvbnm0")

    def install(self, spec, prefix):
        mkdirp(prefix.bin)

        exe = join_path(prefix.bin, "exe")
        with open(exe, "w") as f:
            f.write(prefix)
        set_executable(exe)