mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-09-07 22:31:56 +00:00
Fix a bug introduced in 1.54.0rc1 which meant that Synapse would refuse to start if pre-release versions of dependencies were installed. (#12177)
* Add failing test to characterise the regression #12176 * Permit pre-release versions of specified packages * Newsfile (bugfix) Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
This commit is contained in:
parent
d2ef1a79cf
commit
2eef234ae3
1
changelog.d/12177.bugfix
Normal file
1
changelog.d/12177.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix a bug introduced in 1.54.0rc1 which meant that Synapse would refuse to start if pre-release versions of dependencies were installed.
|
@ -163,7 +163,8 @@ def check_requirements(extra: Optional[str] = None) -> None:
|
|||||||
deps_unfulfilled.append(requirement.name)
|
deps_unfulfilled.append(requirement.name)
|
||||||
errors.append(_not_installed(requirement, extra))
|
errors.append(_not_installed(requirement, extra))
|
||||||
else:
|
else:
|
||||||
if not requirement.specifier.contains(dist.version):
|
# We specify prereleases=True to allow prereleases such as RCs.
|
||||||
|
if not requirement.specifier.contains(dist.version, prereleases=True):
|
||||||
deps_unfulfilled.append(requirement.name)
|
deps_unfulfilled.append(requirement.name)
|
||||||
errors.append(_incorrect_version(requirement, dist.version, extra))
|
errors.append(_incorrect_version(requirement, dist.version, extra))
|
||||||
|
|
||||||
|
@ -27,7 +27,9 @@ class DummyDistribution(metadata.Distribution):
|
|||||||
|
|
||||||
|
|
||||||
old = DummyDistribution("0.1.2")
|
old = DummyDistribution("0.1.2")
|
||||||
|
old_release_candidate = DummyDistribution("0.1.2rc3")
|
||||||
new = DummyDistribution("1.2.3")
|
new = DummyDistribution("1.2.3")
|
||||||
|
new_release_candidate = DummyDistribution("1.2.3rc4")
|
||||||
|
|
||||||
# could probably use stdlib TestCase --- no need for twisted here
|
# could probably use stdlib TestCase --- no need for twisted here
|
||||||
|
|
||||||
@ -110,3 +112,20 @@ class TestDependencyChecker(TestCase):
|
|||||||
with self.mock_installed_package(new):
|
with self.mock_installed_package(new):
|
||||||
# should not raise
|
# should not raise
|
||||||
check_requirements("cool-extra")
|
check_requirements("cool-extra")
|
||||||
|
|
||||||
|
def test_release_candidates_satisfy_dependency(self) -> None:
|
||||||
|
"""
|
||||||
|
Tests that release candidates count as far as satisfying a dependency
|
||||||
|
is concerned.
|
||||||
|
(Regression test, see #12176.)
|
||||||
|
"""
|
||||||
|
with patch(
|
||||||
|
"synapse.util.check_dependencies.metadata.requires",
|
||||||
|
return_value=["dummypkg >= 1"],
|
||||||
|
):
|
||||||
|
with self.mock_installed_package(old_release_candidate):
|
||||||
|
self.assertRaises(DependencyException, check_requirements)
|
||||||
|
|
||||||
|
with self.mock_installed_package(new_release_candidate):
|
||||||
|
# should not raise
|
||||||
|
check_requirements()
|
||||||
|
Loading…
Reference in New Issue
Block a user