summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin.mock/packages/gnuconfig/package.py
blob: 5d8bd6358d464fc0c3a58147c861fa6c3cbb0bf0 (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
# 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 Gnuconfig(Package):
    """
    The GNU config.guess and config.sub scripts versioned by timestamp.
    This package can be used as a build dependency for autotools packages that
    ship a tarball with outdated config.guess and config.sub files.
    """

    has_code = False

    version("2021-08-14")

    def install(self, spec, prefix):
        config_sub = join_path(prefix, "config.sub")
        config_guess = join_path(prefix, "config.guess")

        # Create files
        with open(config_sub, "w") as f:
            f.write("#!/bin/sh\necho gnuconfig version of config.sub")

        with open(config_guess, "w") as f:
            f.write("#!/bin/sh\necho gnuconfig version of config.guess")

        # Make executable
        os.chmod(config_sub, 0o775)
        os.chmod(config_guess, 0o775)