diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2019-12-03 22:05:07 -0500 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2019-12-05 16:52:22 -0500 |
commit | b87209946859a642f048391ca6cb6ef57edf0522 (patch) | |
tree | 6dea0d577b7c044a800f669c43db83a0cf8502ad /mesonbuild/dependencies/base.py | |
parent | 691a74aec2a34540cce8c1a86f4874bd0814a65c (diff) | |
download | meson-b87209946859a642f048391ca6cb6ef57edf0522.zip meson-b87209946859a642f048391ca6cb6ef57edf0522.tar.gz meson-b87209946859a642f048391ca6cb6ef57edf0522.tar.bz2 |
find_program(): Add 'dirs' keyword argument
Fixes: #1576
Diffstat (limited to 'mesonbuild/dependencies/base.py')
-rw-r--r-- | mesonbuild/dependencies/base.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index d11aebf..258a4fb 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -1699,12 +1699,19 @@ class ExternalProgram: for_machine = MachineChoice.BUILD def __init__(self, name: str, command: Optional[List[str]] = None, - silent: bool = False, search_dir: Optional[str] = None): + silent: bool = False, search_dir: Optional[str] = None, + extra_search_dirs: Optional[List[str]] = None): self.name = name if command is not None: self.command = listify(command) else: - self.command = self._search(name, search_dir) + all_search_dirs = [search_dir] + if extra_search_dirs: + all_search_dirs += extra_search_dirs + for d in all_search_dirs: + self.command = self._search(name, d) + if self.found(): + break # Set path to be the last item that is actually a file (in order to # skip options in something like ['python', '-u', 'file.py']. If we |