Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

programs: Store the project version when overriding find_program #13714

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mesonbuild/interpreter/mesonmain.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def override_find_program_method(self, args: T.Tuple[str, T.Union[mesonlib.File,
self.interpreter.environment.build_dir)
if not os.path.exists(abspath):
raise InterpreterException(f'Tried to override {name} with a file that does not exist.')
exe = OverrideProgram(name, [abspath])
exe = OverrideProgram(name, self.interpreter.project_version, command=[abspath])
self.interpreter.add_find_program_override(name, exe)

@typed_kwargs(
Expand Down
6 changes: 6 additions & 0 deletions mesonbuild/programs.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,12 @@ 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_dir: T.Optional[str] = None,
extra_search_dirs: T.Optional[T.List[str]] = None):
self.cached_version = version
super().__init__(name, command=command, silent=silent,
search_dir=search_dir, extra_search_dirs=extra_search_dirs)

def find_external_program(env: 'Environment', for_machine: MachineChoice, name: str,
display_name: str, default_names: T.List[str],
Expand Down
Loading