bug 1396993 - Look in ~/.cargo/bin for rustc+cargo even they're not in PATH. r?rillian
MozReview-Commit-ID: GZOcFdFmzA5
--- a/build/moz.configure/rust.configure
+++ b/build/moz.configure/rust.configure
@@ -1,18 +1,24 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+@imports(_from='os.path', _import='expanduser')
+def rustup_path(what):
+ # rustup installs rustc/cargo into ~/.cargo/bin by default,
+ # so look there if the binaries aren't in $PATH.
+ return [what, os.path.join(expanduser('~/.cargo/bin'), what)]
+
# Rust is required by `rust_compiler` below. We allow_missing here
# to propagate failures to the better error message there.
-rustc = check_prog('RUSTC', ['rustc'], allow_missing=True)
-cargo = check_prog('CARGO', ['cargo'], allow_missing=True)
+rustc = check_prog('RUSTC', rustup_path('rustc'), allow_missing=True)
+cargo = check_prog('CARGO', rustup_path('cargo'), allow_missing=True)
@depends_if(rustc)
@checking('rustc version', lambda info: info.version)
def rustc_info(rustc):
out = check_cmd_output(rustc, '--version', '--verbose').splitlines()
info = dict((s.strip() for s in line.split(':', 1)) for line in out[1:])
return namespace(
version=Version(info.get('release', '0')),