summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/py-ninja/package.py
blob: 857ed32e1446edd6a33322c9d96dd3255b6372bb (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
34
35
36
37
# 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 PyNinja(PythonPackage):
    """Ninja is a small build system with a focus on speed."""

    homepage = "https://ninja-build.org"
    pypi = "ninja/ninja-1.10.2.tar.gz"

    license("Apache-2.0")

    version("1.10.2", sha256="bb5e54b9a7343b3a8fc6532ae2c169af387a45b0d4dd5b72c2803e21658c5791")

    depends_on("cmake@3.6:", type="build")
    depends_on("py-setuptools@42:", type="build")
    depends_on("py-scikit-build", type="build")
    depends_on("ninja@1.10.2", type=("build", "run"), when="@1.10.2")

    def patch(self):
        os.unlink(join_path(self.stage.source_path, "CMakeLists.txt"))

    @run_after("install")
    def installit(self):
        syntax_file = os.path.join(self.spec["ninja"].prefix.misc, "ninja_syntax.py")
        bin_file = os.path.join(self.spec["ninja"].prefix.bin, "ninja")
        dst = os.path.join(python_platlib, "ninja")
        dstbin = os.path.join(dst, "data", "bin")
        mkdirp(dstbin)
        os.symlink(bin_file, os.path.join(dstbin, "ninja"))
        os.symlink(syntax_file, os.path.join(dst, "ninja_syntax.py"))