Bug 1385131 - Use --version for checking version of cargo-vendor. r?ted
MozReview-Commit-ID: Cm6j0DBZdFG
--- a/python/mozbuild/mozbuild/vendor_rust.py
+++ b/python/mozbuild/mozbuild/vendor_rust.py
@@ -37,26 +37,20 @@ class VendorRust(MozbuildObject):
return False
return LooseVersion(out.split()[1]) >= b'0.13'
def check_cargo_vendor_version(self, cargo):
'''
Ensure that cargo-vendor is new enough. cargo-vendor 0.1.11 and newer
strips out .orig and .rej files which we want.
'''
- for l in subprocess.check_output([cargo, 'install', '--list']).splitlines():
- # The line looks like one of the following:
- # cargo-vendor v0.1.11:
- # cargo-vendor v0.1.11 (file:///path/to/local/build/cargo-vendor):
- # and we want to extract the version part of it
- m = re.match('cargo-vendor v((\d+\.)*\d+)', l)
- if m:
- version = m.group(1)
- return LooseVersion(version) >= b'0.1.11'
- return False
+ out = subprocess.check_output([cargo, 'vendor', '--version']).splitlines()[0]
+ if not out.startswith('cargo-vendor'):
+ return False
+ return LooseVersion(out.split()[1]) >= b'0.1.11'
def check_modified_files(self):
'''
Ensure that there aren't any uncommitted changes to files
in the working copy, since we're going to change some state
on the user. Allow changes to Cargo.{toml,lock} since that's
likely to be a common use case.
'''