Auto merge of #8697 - Ms2ger:docs, r=SimonSapin

Ensure the bootstrap-rust-docs and doc mach commands agree on the location of the Rust documentation.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8697)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-11-27 14:49:01 +05:30
commit d552674ba2

View file

@ -174,9 +174,8 @@ class MachCommands(CommandBase):
help='Force download even if docs already exist')
def bootstrap_rustc_docs(self, force=False):
self.ensure_bootstrapped()
hash_dir = path.join(self.context.sharedir, "rust",
self.rust_snapshot_path().split("/")[0])
docs_dir = path.join(hash_dir, "doc")
rust_root = self.config["tools"]["rust-root"]
docs_dir = path.join(rust_root, "doc")
if not force and path.exists(docs_dir):
print("Snapshot Rust docs already downloaded.", end=" ")
print("Use |bootstrap-rust-docs --force| to download again.")
@ -187,12 +186,12 @@ class MachCommands(CommandBase):
docs_name = self.rust_snapshot_path().replace("rustc-", "rust-docs-")
snapshot_url = ("https://static-rust-lang-org.s3.amazonaws.com/dist/rust-docs-nightly-%s.tar.gz"
% host_triple())
tgz_file = path.join(hash_dir, 'doc.tar.gz')
tgz_file = path.join(rust_root, 'doc.tar.gz')
download_file("Rust docs", snapshot_url, tgz_file)
print("Extracting Rust docs...")
temp_dir = path.join(hash_dir, "temp_docs")
temp_dir = path.join(rust_root, "temp_docs")
if path.isdir(temp_dir):
shutil.rmtree(temp_dir)
extract(tgz_file, temp_dir)