1
0

Fix a typo in check_dependencies.py which makes setuptools_rust a running dependency (#19417)

### Pull Request Checklist

<!-- Please read
https://element-hq.github.io/synapse/latest/development/contributing_guide.html
before submitting your pull request -->

* [x] Pull request is based on the develop branch
* [x] [Code
style](https://element-hq.github.io/synapse/latest/code_style.html) is
correct (run the
[linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))

There is a typo in check_dependencies.py which makes setuptools_rust a
runtime requirement, but there is no need for it at runtime. This patch
solves the typo. I tested starting 1.146.0 with this patch and without
setuptools_rust and it starts correctly
This commit is contained in:
Renaud Allard
2026-02-03 16:40:20 +01:00
committed by GitHub
parent 84d591934b
commit 98a540a41d
3 changed files with 6 additions and 4 deletions

1
changelog.d/19417.bugfix Normal file
View File

@@ -0,0 +1 @@
Fix a typo that incorrectly made `setuptools_rust` a runtime dependency.

View File

@@ -32,6 +32,7 @@ from typing import Any, Iterable, NamedTuple, Sequence, cast
from packaging.markers import Marker, Value, Variable, default_environment
from packaging.requirements import Requirement
from packaging.utils import canonicalize_name
DISTRIBUTION_NAME = "matrix-synapse"
@@ -96,7 +97,7 @@ def _should_ignore_runtime_requirement(req: Requirement) -> bool:
# In any case, workaround this by ignoring setuptools_rust here. (It might be
# slightly cleaner to put `setuptools_rust` in a `build` extra or similar, but for
# now let's do something quick and dirty.
if req.name == "setuptools_rust":
if canonicalize_name(req.name) == "setuptools-rust":
return True
return False

View File

@@ -201,13 +201,13 @@ class TestDependencyChecker(TestCase):
"""
with patch(
"synapse.util.check_dependencies.metadata.requires",
return_value=["setuptools_rust >= 1.3"],
return_value=["setuptools-rust >= 1.3"],
):
with self.mock_installed_package(None):
# should not raise, even if setuptools_rust is not installed
# should not raise, even if setuptools-rust is not installed
check_requirements()
with self.mock_installed_package(old):
# We also ignore old versions of setuptools_rust
# We also ignore old versions of setuptools-rust
check_requirements()
def test_python_version_markers_respected(self) -> None: