Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2.3k
chore: use scikit-build-core for the build#5598
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
9f181985eb0b177b1b4e03de806aa5ba171ad07257787b0e4File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -7,6 +7,13 @@ | ||
| from __future__ import annotations | ||
| import argparse | ||
| import contextlib | ||
| import os | ||
| from pathlib import Path | ||
| from typing import TYPE_CHECKING | ||
| if TYPE_CHECKING: | ||
| from collections.abc import Generator | ||
| import nox | ||
| @@ -99,13 +106,46 @@ def make_changelog(session: nox.Session) -> None: | ||
| @nox.session(reuse_venv=True, default=False) | ||
| def build(session: nox.Session) -> None: | ||
| """ | ||
| Build SDists and wheels. | ||
| Build SDist and wheel. | ||
| """ | ||
| session.install("build") | ||
| session.log("Building normal files") | ||
| session.run("python", "-m", "build", *session.posargs) | ||
| session.log("Building pybind11-global files (PYBIND11_GLOBAL_SDIST=1)") | ||
| session.run( | ||
| "python", "-m", "build", *session.posargs, env={"PYBIND11_GLOBAL_SDIST": "1"} | ||
| ) | ||
| @contextlib.contextmanager | ||
| def preserve_file(filename: Path) -> Generator[str, None, None]: | ||
henryiii marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| """ | ||
| Causes a file to be stored and preserved when the context manager exits. | ||
| """ | ||
| old_stat = filename.stat() | ||
| old_file = filename.read_text(encoding="utf-8") | ||
| try: | ||
| yield old_file | ||
| finally: | ||
| filename.write_text(old_file, encoding="utf-8") | ||
| os.utime(filename, (old_stat.st_atime, old_stat.st_mtime)) | ||
| @nox.session(reuse_venv=True) | ||
| def build_global(session: nox.Session) -> None: | ||
| """ | ||
| Build global SDist and wheel. | ||
| """ | ||
| installer = ["--installer=uv"] if session.venv_backend == "uv" else [] | ||
| session.install("build", "tomlkit") | ||
| session.log("Building pybind11-global files") | ||
| pyproject = Path("pyproject.toml") | ||
| with preserve_file(pyproject): | ||
| newer_txt = session.run("python", "tools/make_global.py", silent=True) | ||
| assert isinstance(newer_txt, str) | ||
| pyproject.write_text(newer_txt, encoding="utf-8") | ||
| session.run( | ||
| "python", | ||
| "-m", | ||
| "build", | ||
| *installer, | ||
| *session.posargs, | ||
| ) | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.