diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-05-13 06:07:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-13 06:07:11 -0500 |
commit | d2fa2ae9343db8d958570a501ff9a7b7a203ceeb (patch) | |
tree | 3ba4c3b97b97042e68db605a0a38d1bdc83e8bdc | |
parent | e83e102736907a5905134aa129dd43debf5c216c (diff) | |
parent | 51f33d0a62cf8c6e3ef372a1954d3dc4e8b0e842 (diff) | |
download | servo-d2fa2ae9343db8d958570a501ff9a7b7a203ceeb.tar.gz servo-d2fa2ae9343db8d958570a501ff9a7b7a203ceeb.zip |
Auto merge of #16836 - servo:nightly, r=nox
Make `./mach rustup` use the latest nightly rather than master.
<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16836)
<!-- Reviewable:end -->
-rw-r--r-- | python/servo/devenv_commands.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/python/servo/devenv_commands.py b/python/servo/devenv_commands.py index 314c5c2b8c1..f7df09ce754 100644 --- a/python/servo/devenv_commands.py +++ b/python/servo/devenv_commands.py @@ -226,11 +226,23 @@ class MachCommands(CommandBase): env=self.build_env()) @Command('rustup', - description='Update the Rust version to latest master', + description='Update the Rust version to latest Nightly', category='devenv') - def rustup(self): - url = "https://api.github.com/repos/rust-lang/rust/git/refs/heads/master" - commit = json.load(urllib2.urlopen(url))["object"]["sha"] + @CommandArgument('--master', + action='store_true', + help='Use the latest commit of the "master" branch') + def rustup(self, master=False): + if master: + url = "https://api.github.com/repos/rust-lang/rust/git/refs/heads/master" + commit = json.load(urllib2.urlopen(url))["object"]["sha"] + else: + import toml + import re + url = "https://static.rust-lang.org/dist/channel-rust-nightly.toml" + version = toml.load(urllib2.urlopen(url))["pkg"]["rustc"]["version"] + short_commit = re.search("\(([0-9a-f]+) ", version).group(1) + url = "https://api.github.com/repos/rust-lang/rust/commits/" + short_commit + commit = json.load(urllib2.urlopen(url))["sha"] filename = path.join(self.context.topdir, "rust-commit-hash") with open(filename, "w") as f: f.write(commit + "\n") |