diff options
author | David Robertson <davidr@element.io> | 2022-03-01 17:44:41 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-01 17:44:41 +0000 |
commit | 313581e4e9bc2ec3d59ccff86e3a0c02661f71c4 (patch) | |
tree | e7cca1740f8fb1011201a3e05a973e6c9f513654 /synapse/app/__init__.py | |
parent | Fix rare error in `ReadWriteLock` when writers complete immediately (#12105) (diff) | |
download | synapse-313581e4e9bc2ec3d59ccff86e3a0c02661f71c4.tar.xz |
Use importlib.metadata to read requirements (#12088)
* Pull runtime dep checks into their own module * Reimplement `check_requirements` using `importlib` I've tried to make this clearer. We start by working out which of Synapse's requirements we need to be installed here and now. I was surprised that there wasn't an easier way to see which packages were installed by a given extra. I've pulled out the error messages into functions that deal with "is this for an extra or not". And I've rearranged the loop over two different sets of requirements into one loop with a "must be instaled" flag. I hope you agree that this is clearer. * Test cases
Diffstat (limited to 'synapse/app/__init__.py')
-rw-r--r-- | synapse/app/__init__.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/app/__init__.py b/synapse/app/__init__.py index ee51480a9e..334c3d2c17 100644 --- a/synapse/app/__init__.py +++ b/synapse/app/__init__.py @@ -15,13 +15,13 @@ import logging import sys from typing import Container -from synapse import python_dependencies # noqa: E402 +from synapse.util import check_dependencies logger = logging.getLogger(__name__) try: - python_dependencies.check_requirements() -except python_dependencies.DependencyException as e: + check_dependencies.check_requirements() +except check_dependencies.DependencyException as e: sys.stderr.writelines( e.message # noqa: B306, DependencyException.message is a property ) |