summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Cloke <patrickc@matrix.org>2023-09-27 13:14:51 -0400
committerPatrick Cloke <patrickc@matrix.org>2023-09-27 13:14:51 -0400
commit590861211ccad0dd7b6f1e2d24a65310bf4db9a0 (patch)
tree0edb54c4cb1e46435360caeef8fe0dd9d9e13b70
parentMerge branch 'master' into develop (diff)
downloadsynapse-github/clokep/setuptools-rust-pyproject.tar.xz
-rw-r--r--build_rust.py23
-rw-r--r--pyproject.toml15
2 files changed, 10 insertions, 28 deletions
diff --git a/build_rust.py b/build_rust.py
deleted file mode 100644

index 662474dcb4..0000000000 --- a/build_rust.py +++ /dev/null
@@ -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 diff --git a/pyproject.toml b/pyproject.toml
index bf51276f4a..5cc77b5b0e 100644 --- a/pyproject.toml +++ b/pyproject.toml
@@ -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).