summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/virtest/package.py
blob: 3582aec20fe79e44c0437ce1dcc6869d542c82c5 (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
30
31
32
33
# 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)

import os

from spack.package import *


class Virtest(CMakePackage):
    """Header-only unit test framework, as easy as possible to use"""

    homepage = "https://github.com/mattkretz/virtest"
    git = "https://github.com/mattkretz/virtest.git"
    maintainers = ["bernhardkaindl"]

    version("master", branch="master")

    def patch(self):
        script = FileFilter("tests/CMakeLists.txt")
        script.filter(
            r" *\${CMAKE_CTEST_COMMAND} -V -R \${target}",
            '${CMAKE_CTEST_COMMAND} -V -R "^${target}$"',
        )

    def setup_run_environment(self, env):
        env.prepend_path("CPATH", self.prefix.include.vir)

    @run_after("install")
    def rename_include_for_vc_package(self):
        with working_dir(self.prefix.include):
            os.rename("vir", "virtest")