Skip to content

Commit 7636e7b

Browse files
authored
chore: vendor updates (#918)
From #917. Also fixing the docs job to use the correct scikit-build-core (local) version. Signed-off-by: Henry Schreiner <[email protected]>
1 parent f0ae319 commit 7636e7b

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,8 @@ jobs:
329329

330330
steps:
331331
- uses: actions/checkout@v4
332+
with:
333+
fetch-depth: 0
332334

333335
- uses: yezz123/setup-uv@v4
334336

noxfile.py

+26-14
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
from __future__ import annotations
88

99
import argparse
10+
import json
1011
import shutil
1112
import sys
13+
import urllib.request
1214
from pathlib import Path
1315
from typing import TYPE_CHECKING
1416

@@ -206,16 +208,18 @@ def build(session: nox.Session) -> None:
206208
@nox.parametrize("example", EXAMPLES, ids=EXAMPLES)
207209
def test_doc_examples(session: nox.Session, example: str) -> None:
208210
_prepare_cmake_ninja(session)
209-
session.install("-e.")
211+
session.install("-e.", "pip")
210212
session.chdir(f"docs/examples/{example}")
211213
reqs = nox.project.load_toml("pyproject.toml")["build-system"]["requires"]
212-
session.install(*reqs, "pytest")
214+
freqs = (r for r in reqs if "scikit-build-core" not in r.replace("_", "-"))
215+
session.install(*freqs, "pytest")
213216
session.install(
214217
".",
215218
"--no-build-isolation",
216219
"--config-settings=cmake.verbose=true",
217220
env={"PYTHONWARNINGS": "error"},
218221
)
222+
session.run("pip", "list")
219223
if Path("../test.py").is_file():
220224
session.run("python", "../test.py")
221225
else:
@@ -312,15 +316,23 @@ def vendor_pyproject_metadata(session: nox.Session) -> None:
312316
parser.add_argument("version", help="A tag or ref to vendor")
313317
args = parser.parse_args(session.posargs)
314318

315-
session.run(
316-
"curl",
317-
"-o",
318-
"src/scikit_build_core/_vendor/pyproject_metadata/__init__.py",
319-
f"https://raw.githubusercontent.com/pypa/pyproject-metadata/{args.version}/pyproject_metadata/__init__.py",
320-
)
321-
session.run(
322-
"curl",
323-
"-o",
324-
"src/scikit_build_core/_vendor/pyproject_metadata/LICENSE",
325-
f"https://raw.githubusercontent.com/pypa/pyproject-metadata/{args.version}/LICENSE",
326-
)
319+
repo = "pypa/pyproject-metadata"
320+
branch = args.version
321+
322+
with urllib.request.urlopen(
323+
f"https://api.github.com/repos/{repo}/git/trees/{branch}?recursive=1"
324+
) as response:
325+
info = json.loads(response.read().decode("utf-8"))
326+
327+
files = {
328+
y: y for x in info["tree"] if (y := x["path"]).startswith("pyproject_metadata/")
329+
}
330+
files["pyproject_metadata/LICENSE"] = "LICENSE"
331+
for tgt_path, remote_path in files.items():
332+
local_path = Path("src/scikit_build_core/_vendor").joinpath(tgt_path)
333+
print(f"Vendoring: {remote_path} -> {local_path}")
334+
with urllib.request.urlopen(
335+
f"https://raw.githubusercontent.com/{repo}/{branch}/{remote_path}"
336+
) as response:
337+
txt = response.read()
338+
local_path.write_bytes(txt)

0 commit comments

Comments
 (0)