Skip to content

Commit

Permalink
rust: return "rustup run" tool even if rustup from machine file has n…
Browse files Browse the repository at this point in the history
…o path

Always go through find_external_program; otherwise, a naked "rustup"
from the machine file will not pass the "os.path.isfile(tool) and
os.access(tool, os.X_OK)" check.

Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
bonzini committed Nov 21, 2024
1 parent e4f2170 commit 6a5c50c
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions mesonbuild/compilers/rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,19 +304,18 @@ def get_rust_tool(self, name: str, env: Environment) -> T.List[str]:
# do not use extend so that exelist is copied
exelist = rustup_exelist + [name]
else:
from ..programs import find_external_program
for prog in find_external_program(env, self.for_machine, name, name,
[name], allow_default_for_cross=False):
exelist = [prog.path]
args = self.get_exe_args()
break
else:
return []
exelist = [name]
args = self.get_exe_args()

from ..programs import find_external_program
for prog in find_external_program(env, self.for_machine, exelist[0], exelist[0],
[exelist[0]], allow_default_for_cross=False):
exelist[0] = prog.path
break
else:
return []

tool = exelist[0]
if os.path.isfile(tool) and os.access(tool, os.X_OK):
return exelist + args
return []
return exelist + args

@functools.lru_cache(maxsize=None)
def get_rustdoc(self, env: 'Environment') -> T.Optional[RustdocTestCompiler]:
Expand Down

0 comments on commit 6a5c50c

Please sign in to comment.