Bug 1340594 - Make sure Cargo version check can fail. r?froydnj draft
authorJan Beich <jbeich@FreeBSD.org>
Sat, 25 Feb 2017 04:11:26 +0000
changeset 489594 5d73f41fa7d9941104a86e7bd2b8bad470010346
parent 489583 f36062d04d165f6f6e781cf0633ffcbbebe6c273
child 547042 ef9cb313466c031f2891986e7c1c55fe45907ac8
push id46864
push userbmo:jbeich@FreeBSD.org
push dateSat, 25 Feb 2017 04:31:43 +0000
reviewersfroydnj
bugs1340594
milestone54.0a1
Bug 1340594 - Make sure Cargo version check can fail. r?froydnj MozReview-Commit-ID: 9ggzbuE42Wc
build/moz.configure/rust.configure
--- a/build/moz.configure/rust.configure
+++ b/build/moz.configure/rust.configure
@@ -38,20 +38,20 @@ def cargo_info(cargo):
         if not m:
             die('Could not determine cargo version from output: %s', out)
         version = m.group(1)
 
     return namespace(
         version=Version(version),
     )
 
-@depends(rustc, cargo, rustc_info)
+@depends(rustc_info, cargo_info)
 @imports(_from='textwrap', _import='dedent')
-def rust_compiler(rustc, cargo, rustc_info):
-    if not rustc:
+def rust_compiler(rustc_info, cargo_info):
+    if not rustc_info:
         die(dedent('''\
         Rust compiler not found.
         To compile rust language sources, you must have 'rustc' in your path.
         See https//www.rust-lang.org/ for more information.
 
         You can install rust by running './mach bootstrap'
         or by directly running the installer from https://rustup.rs/
         '''))
@@ -69,35 +69,37 @@ def rust_compiler(rustc, cargo, rustc_in
 
         You can verify this by typing 'rustc --version'.
 
         If you have the 'rustup' tool installed you can upgrade
         to the latest release by typing 'rustup update'. The
         installer is available from https://rustup.rs/
         '''.format(version, rustc_min_version)))
 
-        if not cargo:
-            die(dedent('''\
-            Cargo package manager not found.
-            To compile Rust language sources, you must have 'cargo' in your path.
-            See https://www.rust-lang.org/ for more information.
+    if not cargo_info:
+        die(dedent('''\
+        Cargo package manager not found.
+        To compile Rust language sources, you must have 'cargo' in your path.
+        See https://www.rust-lang.org/ for more information.
+
+        You can install cargo by running './mach bootstrap'
+        or by directly running the installer from https://rustup.rs/
+        '''))
 
-            You can install cargo by running './mach bootstrap'
-            or by directly running the installer from https://rustup.rs/
-            '''))
-        version = cargo_info.version
-        if version < cargo_min_version:
-            die(dedent('''\
-            Cargo package manager {} is too old.
+    version = cargo_info.version
+    if version < cargo_min_version:
+        die(dedent('''\
+        Cargo package manager {} is too old.
 
-            To compile Rust language sources please install at least
-            version {} of 'cargo' and make sure it is first in your path.
+        To compile Rust language sources please install at least
+        version {} of 'cargo' and make sure it is first in your path.
 
-            You can verify this by typing 'cargo --version'.
-            ''').format(version, cargo_min_version))
+        You can verify this by typing 'cargo --version'.
+        ''').format(version, cargo_min_version))
+
     return True
 
 set_config('MOZ_RUST', rust_compiler)
 
 @template
 def rust_triple_alias(host_or_target):
     """Template defining the alias used for rustc's --target flag.
     `host_or_target` is either `host` or `target` (the @depends functions