| except ModuleNotFoundError: | |
| return False | |
| return spec is not None | |
| def repo_dir(name): | |
| return os.path.join(script_path, dir_repos, name) | |
| def run_pip(command, desc=None, live=default_command_live): | |
| if args.skip_install: | |
| return | |
| index_url_line = f' --index-url {index_url}' if index_url != '' else '' | |
| return run(f'"{python}" -m pip {command} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}", live=live) | |
| def check_run_python(code: str) -> bool: | |
| result = subprocess.run([python, "-c", code], capture_output=True, shell=False) | |
| return result.returncode == 0 | |
| def git_fix_workspace(dir, name): | |
| run(f'"{git}" -C "{dir}" fetch --refetch --no-auto-gc', f"Fetching all contents for {name}", f"Couldn't fetch {name}", live=True) | |
| run(f'"{git}" -C "{dir}" gc --aggressive --prune=now', f"Pruning {name}", f"Couldn't prune {name}", live=True) | |
| return | |
| def run_git(dir, name, command, desc=None, errdesc=None, custom_env=None, live: bool = default_command_live, autofix=True): | |
| try: | |
| return run(f'"{git}" -C "{dir}" {command}', desc=desc, errdesc=errdesc, custom_env=custom_env, live=live) | |
| except RuntimeError: | |
| if not auto |