from urllib.request import urlopen
from mach.site import PythonVirtualenv
from mach.util import get_state_dir
MINIMUM_RUST_VERSION = "1.82.0"
def get_tools_dir(srcdir=False):
if os.environ.get("MOZ_AUTOMATION") and "MOZ_FETCHES_DIR" in os.environ:
return os.environ["MOZ_FETCHES_DIR"]
return get_state_dir(srcdir)
def get_mach_virtualenv_root():
return Path(get_state_dir(specific_to_topsrcdir=True)) / "_virtualenvs" / "mach"
def get_mach_virtualenv_binary():
root = get_mach_virtualenv_root()
return Path(PythonVirtualenv(str(root)).python_path)
def http_download_and_save(url, dest: Path, hexhash, digest="sha256"):
"""Download the given url and save it to dest. hexhash is a checksum
that will be used to validate the downloaded file using the given
digest algorithm. The value of digest can be any value accepted by
hashlib.new. The default digest used is 'sha256'."""
ssl_context = ssl.create_default_context(cafile=certifi.where())
f = urlopen(url, context=ssl_context)
with open(dest, "wb") as out:
if h.hexdigest() != hexhash:
raise ValueError("Hash of downloaded file does not match expected hash")
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4