# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this, # file, You can obtain one at http://mozilla.org/MPL/2.0/.
def rustup_url(host, version=RUSTUP_VERSION): """Download url for a particular version of the installer.""" return"%(base)s/archive/%(version)s/%(host)s/rustup-init%(ext)s" % { "base": RUSTUP_URL_BASE, "version": version, "host": host, "ext": exe_suffix(host),
}
def rustup_hash(host): """Look up the checksum for the given installer.""" return RUSTUP_HASHES.get(host, None)
def platform(): """Determine the appropriate rust platform string for the current host""" if sys.platform.startswith("darwin"): if platform_mod.machine() == "arm64": return"aarch64-apple-darwin" return"x86_64-apple-darwin" elif sys.platform.startswith(("win32", "msys")): # Bravely assume we'll be building 64-bit Firefox. return"x86_64-pc-windows-msvc" elif sys.platform.startswith("linux"): if platform_mod.machine() == "aarch64": return"aarch64-unknown-linux-gnu" return"x86_64-unknown-linux-gnu" elif sys.platform.startswith("freebsd"): return"x86_64-unknown-freebsd" elif sys.platform.startswith("netbsd"): return"x86_64-unknown-netbsd"
Pass the --update option print info for the latest release of rustup-init.
When invoked without the --update option, it queries the latest version and verifies the current stored checksums against the distribution server,
but doesn't update the version installed by `mach bootstrap`. """
def unquote(s): """Strip outer quotation marks from a string.""" return s.strip("'").strip('"')
def rustup_latest_version(): """Query the latest version of the rustup installer.""" import requests
r = requests.get(RUSTUP_MANIFEST) # The manifest is toml, but we might not have the toml4 python module # available, so use ad-hoc parsing to obtain the current release version. # # The manifest looks like: # # schema-version = '1' # version = '0.6.5' # for line in r.iter_lines():
line = line.decode("utf-8")
key, value = map(str.strip, line.split("=", 2)) if key == "schema-version":
schema = int(unquote(value)) if schema != 1:
print("ERROR: Unknown manifest schema %s" % value)
sys.exit(1) elif key == "version": return unquote(value) returnNone
def http_download_and_hash(url): import hashlib
import requests
h = hashlib.sha256()
r = requests.get(url, stream=True) for data in r.iter_content(4096):
h.update(data) return h.hexdigest()
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.