diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2021-10-22 16:59:34 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-10-22 16:59:34 +0300 |
commit | 8cf4f58ebf944103c31e4aa8a467857b79c3dfdc (patch) | |
tree | 538472ecba94c9824ce8c645fd1db03edca5fd99 /mesonbuild/envconfig.py | |
parent | 034b3a92d97bf688be2aba5e5acfcc1e774b83e3 (diff) | |
download | meson-sccache.zip meson-sccache.tar.gz meson-sccache.tar.bz2 |
Add sccache support.sccache
Diffstat (limited to 'mesonbuild/envconfig.py')
-rw-r--r-- | mesonbuild/envconfig.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py index 307aac3..2a112df 100644 --- a/mesonbuild/envconfig.py +++ b/mesonbuild/envconfig.py @@ -385,6 +385,14 @@ class BinaryTable: return [] return ['ccache'] + @staticmethod + def detect_sccache() -> T.List[str]: + try: + subprocess.check_call(['sccache', '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + except (OSError, subprocess.CalledProcessError): + return [] + return ['sccache'] + @classmethod def parse_entry(cls, entry: T.Union[str, T.List[str]]) -> T.Tuple[T.List[str], T.List[str]]: compiler = mesonlib.stringlistify(entry) @@ -392,6 +400,9 @@ class BinaryTable: if compiler[0] == 'ccache': compiler = compiler[1:] ccache = cls.detect_ccache() + elif compiler[0] == 'sccache': + compiler = compiler[1:] + ccache = cls.detect_sccache() else: ccache = [] # Return value has to be a list of compiler 'choices' |