def _do_install(self, tag: str) -> None: rustup_path = self._get_rustup_path() downloader.download("https://sh.rustup.rs", rustup_path) utils.mark_executable(rustup_path) args = [rustup_path, "--verbose", "--default-toolchain", "nightly", "--profile", "minimal", "--target", "wasm32-unknown-unknown", "--no-modify-path", "-y"] myprocess.run_process_async(args, env=self.get_env())
def _download_if_old(self): CACHE_DURATION = 30 archive = self._get_archive_path() if path.isfile(archive): if time.time() - path.getmtime(archive) < CACHE_DURATION: return downloader.download(self.url, archive)
def download(self): archive = self._get_archive_path() downloader.download(self.url, archive) templates_folder = self.get_folder() try: shutil.rmtree(templates_folder) except FileNotFoundError: pass utils.unzip(archive, templates_folder)
def install(self, overwrite): logger.debug(f"install: name={self.name}, tag={self.tag}") if self._should_skip(overwrite): logger.debug("Already exists. Skip install.") return rustup_path = self._get_rustup_path() downloader.download("https://sh.rustup.rs", rustup_path) utils.mark_executable(rustup_path) args = [rustup_path, "--verbose", "--default-toolchain", "nightly", "--profile", "minimal", "--target", "wasm32-unknown-unknown", "--no-modify-path", "-y"] myprocess.run_process_async(args, env=self.get_env())
def _download(self, tag: str): url = self._get_download_url(tag) archive_path = self._get_archive_path(tag) downloader.download(url, archive_path)
def _download(self): url = self._get_download_url() archive_path = self._get_archive_path() downloader.download(url, archive_path)