Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d145747
LLVM 20 bump
savannahostrowski Sep 18, 2025
d86b66e
Merge main
savannahostrowski Sep 19, 2025
9324b14
Add flags for testing
savannahostrowski Sep 19, 2025
f3bb6b9
Merge branch 'main' into llvm-20
savannahostrowski Sep 20, 2025
b6e7981
Merge main
savannahostrowski Oct 6, 2025
e867644
Fix windows
savannahostrowski Oct 6, 2025
13e9f5b
Merge main
savannahostrowski Oct 7, 2025
84781b4
Merge branch 'main' into llvm-20
savannahostrowski Oct 8, 2025
0034f14
Download binaries from GitHub releases
emmatyping Aug 6, 2025
cc98d30
Add hash checking
emmatyping Aug 7, 2025
76842eb
Apply Emma's commits for grabbing binaries from release artifacts
savannahostrowski Oct 8, 2025
a732cec
Merge branch 'main' into llvm-20
savannahostrowski Oct 11, 2025
e8395ce
Fix up LLVM via release artifacts
savannahostrowski Oct 11, 2025
d1e4363
Merge branch 'main' into llvm-20
savannahostrowski Oct 12, 2025
01aed67
Remove model flags for x86_64 darwin causing GOT relocation issues
savannahostrowski Oct 12, 2025
94f1a89
Clean up
savannahostrowski Oct 12, 2025
e6450de
Only patch x86_64 GOT relocations when relaxation succeeds
savannahostrowski Oct 13, 2025
1adf827
Revert "Only patch x86_64 GOT relocations when relaxation succeeds"
savannahostrowski Oct 13, 2025
b9bfacf
mcmodel=large
savannahostrowski Oct 14, 2025
57c44ee
Add macro to handle debug
savannahostrowski Oct 16, 2025
081ee86
fno-pic
savannahostrowski Oct 16, 2025
0b773f9
remove fno-pic
savannahostrowski Oct 16, 2025
c78af6f
remove hack
savannahostrowski Oct 18, 2025
d715cf2
Trampoline attempt
savannahostrowski Oct 18, 2025
38e11b9
Touch up and add better comments
savannahostrowski Oct 19, 2025
74eb9a4
Merge main
savannahostrowski Oct 19, 2025
ca95652
More clean up
savannahostrowski Oct 19, 2025
47153a5
📜🤖 Added by blurb_it.
blurb-it[bot] Oct 19, 2025
7b2df52
Redupe LLVM version reference from jit.yml
savannahostrowski Oct 21, 2025
3a5af39
Merge branch 'llvm-20' of https://github.com/savannahostrowski/cpytho…
savannahostrowski Oct 21, 2025
450dd09
Simplify fetching LLVM from bin-deps
savannahostrowski Oct 21, 2025
5da3349
Remove duplicate 20 reference in jit.yml
savannahostrowski Oct 21, 2025
620cd4f
Fix flags
savannahostrowski Oct 21, 2025
d1a68ab
Reduce DATA_ALIGN to 8 bytes
savannahostrowski Oct 21, 2025
f3d46bd
Merge branch 'main' into llvm-20
savannahostrowski Oct 21, 2025
4b35c2f
Update Devcontainer readme
savannahostrowski Oct 22, 2025
ffcb68e
Merge branch 'llvm-20' of https://github.com/savannahostrowski/cpytho…
savannahostrowski Oct 22, 2025
0540ba3
Merge branch 'main' into llvm-20
savannahostrowski Oct 30, 2025
618a4a6
Revert CI simplication and address comments for memcpy
savannahostrowski Oct 31, 2025
2e9ba92
Address comments about get_externals and trampoline helper
savannahostrowski Oct 31, 2025
a21cb31
Merge branch 'main' into llvm-20
savannahostrowski Oct 31, 2025
795f466
Restore get_externals
savannahostrowski Oct 31, 2025
b880f26
Fix spacing
savannahostrowski Oct 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Simplify fetching LLVM from bin-deps
  • Loading branch information
savannahostrowski committed Oct 21, 2025
commit 450dd092876cc5482b74137988f465231211cebf
59 changes: 8 additions & 51 deletions PCbuild/get_external.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/usr/bin/env python3

import argparse
import contextlib
import hashlib
import io
import json
import os
import pathlib
import shutil
Expand All @@ -15,10 +11,6 @@
import zipfile


# Mapping of binary dependency tag to GitHub release asset ID
TAG_TO_ASSET_ID = {
'llvm-20.1.8.0': 301710576,
}


def request_with_retry(request_func, *args, max_retries=7,
Expand Down Expand Up @@ -46,15 +38,6 @@ def retrieve_with_retries(download_location, output_path, reporthook):
)


def get_with_retries(url, headers):
req = urllib.request.Request(url=url, headers=headers, method='GET')
return request_with_retry(
urllib.request.urlopen,
req,
err_msg=f'Request to {url} failed.'
)


def fetch_zip(commit_hash, zip_dir, *, org='python', binary=False, verbose=False):
repo = 'cpython-bin-deps' if binary else 'cpython-source-deps'
url = f'https://github.com/{org}/{repo}/archive/{commit_hash}.zip'
Expand All @@ -70,42 +53,14 @@ def fetch_zip(commit_hash, zip_dir, *, org='python', binary=False, verbose=False
return filename


def fetch_release_asset(asset_id, output_path, org):
"""Download a GitHub release asset.

Release assets need the Content-Type header set to
application/octet-stream to download the binary, so we can't use
urlretrieve. Code here is based on urlretrieve.
"""
url = f'https://api.github.com/repos/{org}/cpython-bin-deps/releases/assets/{asset_id}'
metadata_resp = get_with_retries(url,
headers={'Accept': 'application/vnd.github+json'})
json_data = json.loads(metadata_resp.read())
hash_info = json_data.get('digest')
if not hash_info:
raise RuntimeError(f'Release asset {asset_id} missing digest field in metadata')
algorithm, hashsum = hash_info.split(':')
if algorithm != 'sha256':
raise RuntimeError(f'Unknown hash algorithm {algorithm} for asset {asset_id}')
with contextlib.closing(
get_with_retries(url, headers={'Accept': 'application/octet-stream'})
) as resp:
hasher = hashlib.sha256()
with open(output_path, 'wb') as fp:
while block := resp.read(io.DEFAULT_BUFFER_SIZE):
hasher.update(block)
fp.write(block)
if hasher.hexdigest() != hashsum:
raise RuntimeError('Downloaded content hash did not match!')


def fetch_release(tag, tarball_dir, *, org='python', verbose=False):
url = f'https://github.com/{org}/cpython-bin-deps/releases/download/{tag}/{tag}.tar.xz'
reporthook = None
if verbose:
reporthook = print
tarball_dir.mkdir(parents=True, exist_ok=True)
asset_id = TAG_TO_ASSET_ID.get(tag)
if asset_id is None:
raise ValueError(f'Unknown tag for binary dependencies {tag}')
output_path = tarball_dir / f'{tag}.tar.xz'
fetch_release_asset(asset_id, output_path, org)
retrieve_with_retries(url, output_path, reporthook)
return output_path


Expand All @@ -126,6 +81,8 @@ def parse_args():
p.add_argument('-v', '--verbose', action='store_true')
p.add_argument('-b', '--binary', action='store_true',
help='Is the dependency in the binary repo?')
p.add_argument('-r', '--release', action='store_true',
help='Download from GitHub release assets instead of branch')
p.add_argument('-O', '--organization',
help='Organization owning the deps repos', default='python')
p.add_argument('-e', '--externals-dir', type=pathlib.Path,
Expand All @@ -149,7 +106,7 @@ def main():

# Determine download method: release artifacts for large deps (like LLVM),
# otherwise zip download from GitHub branches
if args.tag in TAG_TO_ASSET_ID:
if args.release:
tarball_path = fetch_release(
args.tag,
args.externals_dir / 'tarballs',
Expand Down
4 changes: 3 additions & 1 deletion PCbuild/get_externals.bat
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ for %%b in (%binaries%) do (
git clone --depth 1 https://github.com/%ORG%/cpython-bin-deps --branch %%b "%EXTERNALS_DIR%\%%b"
) else (
echo.Fetching %%b...
%PYTHON% -E "%PCBUILD%\get_external.py" -b -O %ORG% -e "%EXTERNALS_DIR%" %%b
set "extra_flags=-b"
if "%%b"=="llvm-20.1.8.0" set "extra_flags=-r"
%PYTHON% -E "%PCBUILD%\get_external.py" %extra_flags% -O %ORG% -e "%EXTERNALS_DIR%" %%b
)
)

Expand Down
Loading