clokep/setuptools-rust-pyproject
Patrick Cloke 2023-09-27 13:14:51 -04:00
parent 11c6cc1115
commit 590861211c
2 changed files with 9 additions and 27 deletions

View File

@ -1,23 +0,0 @@
# A build script for poetry that adds the rust extension.
import os
from typing import Any, Dict
from setuptools_rust import Binding, RustExtension
def build(setup_kwargs: Dict[str, Any]) -> None:
original_project_dir = os.path.dirname(os.path.realpath(__file__))
cargo_toml_path = os.path.join(original_project_dir, "rust", "Cargo.toml")
extension = RustExtension(
target="synapse.synapse_rust",
path=cargo_toml_path,
binding=Binding.PyO3,
py_limited_api=True,
# We force always building in release mode, as we can't tell the
# difference between using `poetry` in development vs production.
debug=False,
)
setup_kwargs.setdefault("rust_extensions", []).append(extension)
setup_kwargs["zip_safe"] = False

View File

@ -133,10 +133,6 @@ exclude = [
{ path = "synapse/*.so", format = "sdist"}
]
[tool.poetry.build]
script = "build_rust.py"
generate-setup-file = true
[tool.poetry.scripts]
synapse_homeserver = "synapse.app.homeserver:main"
synapse_worker = "synapse.app.generic_worker:main"
@ -382,7 +378,16 @@ furo = ">=2022.12.7,<2024.0.0"
# provided we check that it's safe to do so (i.e. that CI passes).
requires = ["poetry-core>=1.1.0,<=1.7.0", "setuptools_rust>=1.3,<=1.7.0"]
build-backend = "poetry.core.masonry.api"
# Should this now be build-backend = "setuptools.build_meta"?
[[tool.setuptools-rust.ext-modules]]
target = "synapse.synapse_rust"
path = "rust/Cargo.toml"
binding = "PyO3"
py-limited-api = true
# We force always building in release mode, as we can't tell the
# difference between using `poetry` in development vs production.
debug = false
[tool.cibuildwheel]
# Skip unsupported platforms (by us or by Rust).