(tag, tarball_dir, *, org='python', verbose=False)
| 69 | |
| 70 | |
| 71 | def fetch_release(tag, tarball_dir, *, org='python', verbose=False): |
| 72 | arch = os.environ.get('PreferredToolArchitecture') |
| 73 | if not arch: |
| 74 | machine = platform.machine() |
| 75 | arch = 'ARM64' if machine == 'ARM64' else 'AMD64' |
| 76 | elif arch.lower() in ('x86', 'x64'): |
| 77 | arch = 'AMD64' |
| 78 | reporthook = None |
| 79 | if verbose: |
| 80 | reporthook = print |
| 81 | tarball_dir.mkdir(parents=True, exist_ok=True) |
| 82 | |
| 83 | arch_filename = f'{tag}-{arch}.tar.xz' |
| 84 | arch_url = f'https://github.com/{org}/cpython-bin-deps/releases/download/{tag}/{arch_filename}' |
| 85 | try: |
| 86 | output_path = tarball_dir / arch_filename |
| 87 | retrieve_with_retries(arch_url, output_path, reporthook) |
| 88 | return output_path |
| 89 | except OSError: |
| 90 | if verbose: |
| 91 | print(f'{arch_filename} not found, trying generic binary...') |
| 92 | |
| 93 | generic_filename = f'{tag}.tar.xz' |
| 94 | generic_url = f'https://github.com/{org}/cpython-bin-deps/releases/download/{tag}/{generic_filename}' |
| 95 | output_path = tarball_dir / generic_filename |
| 96 | retrieve_with_retries(generic_url, output_path, reporthook) |
| 97 | return output_path |
| 98 | |
| 99 | |
| 100 | def extract_tarball(externals_dir, tarball_path, tag): |
no test coverage detected
searching dependent graphs…