diff options
Diffstat (limited to 'mesonbuild/programs.py')
| -rw-r--r-- | mesonbuild/programs.py | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/mesonbuild/programs.py b/mesonbuild/programs.py index 16c12c85a..0abf09720 100644 --- a/mesonbuild/programs.py +++ b/mesonbuild/programs.py @@ -13,7 +13,6 @@ import sys import re import typing as T from pathlib import Path -from abc import ABCMeta, abstractmethod from . import mesonlib from . import mlog @@ -24,33 +23,7 @@ if T.TYPE_CHECKING: from .interpreter import Interpreter -class BaseProgram(mesonlib.HoldableObject, metaclass=ABCMeta): - ''' A base class for LocalProgram and ExternalProgram.''' - - name: str - - @abstractmethod - def found(self) -> bool: - pass - - @abstractmethod - def get_version(self, interpreter: T.Optional[Interpreter] = None) -> str: - pass - - @abstractmethod - def get_command(self) -> T.List[str]: - pass - - @abstractmethod - def get_path(self) -> T.Optional[str]: - pass - - @abstractmethod - def description(self) -> str: - '''Human friendly description of the command''' - - -class ExternalProgram(BaseProgram): +class ExternalProgram(mesonlib.HoldableObject): """A program that is found on the system. :param name: The name of the program @@ -384,6 +357,17 @@ class NonExistingExternalProgram(ExternalProgram): # lgtm [py/missing-call-to-i return False +class OverrideProgram(ExternalProgram): + + """A script overriding a program.""" + + def __init__(self, name: str, version: str, command: T.Optional[T.List[str]] = None, + silent: bool = False, search_dirs: T.Optional[T.List[T.Optional[str]]] = None, + exclude_paths: T.Optional[T.List[str]] = None): + super().__init__(name, command=command, silent=silent, + search_dirs=search_dirs, exclude_paths=exclude_paths) + self.cached_version = version + def find_external_program(env: 'Environment', for_machine: MachineChoice, name: str, display_name: str, default_names: T.List[str], allow_default_for_cross: bool = True, |
