mirror of
https://github.com/servo/servo.git
synced 2025-06-22 08:08:59 +01:00
Fix doc upload
This commit is contained in:
parent
755adf0dde
commit
a3cab14183
2 changed files with 37 additions and 2 deletions
|
@ -81,7 +81,7 @@ class MachCommands(CommandBase):
|
||||||
self.context.sharedir, "rust", *self.rust_snapshot_path().split("/"))
|
self.context.sharedir, "rust", *self.rust_snapshot_path().split("/"))
|
||||||
if not force and path.exists(path.join(rust_dir, "bin", "rustc")):
|
if not force and path.exists(path.join(rust_dir, "bin", "rustc")):
|
||||||
print("Snapshot Rust compiler already downloaded.", end=" ")
|
print("Snapshot Rust compiler already downloaded.", end=" ")
|
||||||
print("Use |bootstrap_rust --force| to download again.")
|
print("Use |bootstrap-rust --force| to download again.")
|
||||||
return
|
return
|
||||||
|
|
||||||
if path.isdir(rust_dir):
|
if path.isdir(rust_dir):
|
||||||
|
@ -100,6 +100,39 @@ class MachCommands(CommandBase):
|
||||||
extract(tgz_file, rust_dir, movedir=snap_dir)
|
extract(tgz_file, rust_dir, movedir=snap_dir)
|
||||||
print("Snapshot Rust ready.")
|
print("Snapshot Rust ready.")
|
||||||
|
|
||||||
|
@Command('bootstrap-rust-docs',
|
||||||
|
description='Download the Rust documentation',
|
||||||
|
category='bootstrap')
|
||||||
|
@CommandArgument('--force', '-f',
|
||||||
|
action='store_true',
|
||||||
|
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, self.rust_snapshot_path().split("/")[1], "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.")
|
||||||
|
return
|
||||||
|
|
||||||
|
if path.isdir(docs_dir):
|
||||||
|
shutil.rmtree(docs_dir)
|
||||||
|
docs_name = self.rust_snapshot_path().replace("rustc-", "rust-docs-")
|
||||||
|
snapshot_url = ("https://servo-rust.s3.amazonaws.com/%s.tar.gz"
|
||||||
|
% docs_name)
|
||||||
|
tgz_file = path.join(hash_dir, 'doc.tar.gz')
|
||||||
|
|
||||||
|
download("Rust docs", snapshot_url, tgz_file)
|
||||||
|
|
||||||
|
print("Extracting Rust docs...")
|
||||||
|
temp_dir = path.join(hash_dir, "temp_docs")
|
||||||
|
shutil.rmtree(temp_dir)
|
||||||
|
extract(tgz_file, temp_dir)
|
||||||
|
shutil.move(path.join(temp_dir, docs_name.split("/")[1], "share", "doc", "rust", "html"), docs_dir)
|
||||||
|
shutil.rmtree(temp_dir)
|
||||||
|
print("Rust docs ready.")
|
||||||
|
|
||||||
@Command('bootstrap-cargo',
|
@Command('bootstrap-cargo',
|
||||||
description='Download the Cargo build tool',
|
description='Download the Cargo build tool',
|
||||||
category='bootstrap')
|
category='bootstrap')
|
||||||
|
|
|
@ -78,7 +78,9 @@ class MachCommands(CommandBase):
|
||||||
help="Command-line arguments to be passed through to cargo doc")
|
help="Command-line arguments to be passed through to cargo doc")
|
||||||
def doc(self, params):
|
def doc(self, params):
|
||||||
self.ensure_bootstrapped()
|
self.ensure_bootstrapped()
|
||||||
|
if not path.exists(path.join(
|
||||||
|
self.config["tools"]["rust-root"], "doc")):
|
||||||
|
Registrar.dispatch("bootstrap-rust-docs", context=self.context)
|
||||||
rust_docs = path.join(self.config["tools"]["rust-root"], "doc")
|
rust_docs = path.join(self.config["tools"]["rust-root"], "doc")
|
||||||
docs = path.join(
|
docs = path.join(
|
||||||
self.context.topdir, "components", "servo", "target", "doc")
|
self.context.topdir, "components", "servo", "target", "doc")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue