Skip to content

chore: vendor updates #918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: yezz123/setup-uv@v4

Expand Down
40 changes: 26 additions & 14 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
from __future__ import annotations

import argparse
import json
import shutil
import sys
import urllib.request
from pathlib import Path
from typing import TYPE_CHECKING

Expand Down Expand Up @@ -206,16 +208,18 @@ def build(session: nox.Session) -> None:
@nox.parametrize("example", EXAMPLES, ids=EXAMPLES)
def test_doc_examples(session: nox.Session, example: str) -> None:
_prepare_cmake_ninja(session)
session.install("-e.")
session.install("-e.", "pip")
session.chdir(f"docs/examples/{example}")
reqs = nox.project.load_toml("pyproject.toml")["build-system"]["requires"]
session.install(*reqs, "pytest")
freqs = (r for r in reqs if "scikit-build-core" not in r.replace("_", "-"))
session.install(*freqs, "pytest")
session.install(
".",
"--no-build-isolation",
"--config-settings=cmake.verbose=true",
env={"PYTHONWARNINGS": "error"},
)
session.run("pip", "list")
if Path("../test.py").is_file():
session.run("python", "../test.py")
else:
Expand Down Expand Up @@ -312,15 +316,23 @@ def vendor_pyproject_metadata(session: nox.Session) -> None:
parser.add_argument("version", help="A tag or ref to vendor")
args = parser.parse_args(session.posargs)

session.run(
"curl",
"-o",
"src/scikit_build_core/_vendor/pyproject_metadata/__init__.py",
f"https://raw.githubusercontent.com/pypa/pyproject-metadata/{args.version}/pyproject_metadata/__init__.py",
)
session.run(
"curl",
"-o",
"src/scikit_build_core/_vendor/pyproject_metadata/LICENSE",
f"https://raw.githubusercontent.com/pypa/pyproject-metadata/{args.version}/LICENSE",
)
repo = "pypa/pyproject-metadata"
branch = args.version

with urllib.request.urlopen(
f"https://api.github.com/repos/{repo}/git/trees/{branch}?recursive=1"
) as response:
info = json.loads(response.read().decode("utf-8"))

files = {
y: y for x in info["tree"] if (y := x["path"]).startswith("pyproject_metadata/")
}
files["pyproject_metadata/LICENSE"] = "LICENSE"
for tgt_path, remote_path in files.items():
local_path = Path("src/scikit_build_core/_vendor").joinpath(tgt_path)
print(f"Vendoring: {remote_path} -> {local_path}")
with urllib.request.urlopen(
f"https://raw.githubusercontent.com/{repo}/{branch}/{remote_path}"
) as response:
txt = response.read()
local_path.write_bytes(txt)
Loading