MCPcopy Index your code
hub / github.com/python/cpython / fetch_release

Function fetch_release

PCbuild/get_external.py:71–97  ·  view source on GitHub ↗
(tag, tarball_dir, *, org='python', verbose=False)

Source from the content-addressed store, hash-verified

69
70
71def 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
100def extract_tarball(externals_dir, tarball_path, tag):

Callers 1

mainFunction · 0.85

Calls 4

retrieve_with_retriesFunction · 0.85
getMethod · 0.45
lowerMethod · 0.45
mkdirMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…