diff options
| author | Eli Schwartz <eschwartz93@gmail.com> | 2025-10-15 21:49:10 -0400 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2025-10-15 23:01:36 -0400 |
| commit | 5c0aad57f92d2a6bebc1cb17655dd8a56f4bcd3f (patch) | |
| tree | 69a228a10f425b33392df576f79bd8b7c5402104 /mesonbuild/programs.py | |
| parent | 1177e77c2893891cb35144b8033786cb8f75c7cd (diff) | |
| download | meson-5c0aad57f92d2a6bebc1cb17655dd8a56f4bcd3f.tar.gz | |
revert local_program()
This reverts https://github.com/mesonbuild/meson/pull/15107
Explicit objections regarding the design were raised and not answered,
so it shouldn't have been merged. It needs to be discussed and
revisited.
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, |
