diff options
author | David Robertson <davidr@element.io> | 2022-04-27 15:37:59 +0100 |
---|---|---|
committer | David Robertson <davidr@element.io> | 2022-04-27 15:37:59 +0100 |
commit | bdb00ee73b1ff2346c864a4dec175d9bbd37d116 (patch) | |
tree | e4222066e0cfa88aadc4b74cd775b043d4825da7 | |
parent | Add some type hints to datastore (#12485) (diff) | |
download | synapse-dmr/warn-missing-metadata.tar.xz |
Wrap metadata check in try-except github/dmr/warn-missing-metadata dmr/warn-missing-metadata
Not sure if this is a good idea, but here is a proposed change
-rw-r--r-- | synapse/util/check_dependencies.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/synapse/util/check_dependencies.py b/synapse/util/check_dependencies.py index 66f1da7502..7a17ebbc61 100644 --- a/synapse/util/check_dependencies.py +++ b/synapse/util/check_dependencies.py @@ -54,10 +54,16 @@ class DependencyException(Exception): DEV_EXTRAS = {"lint", "mypy", "test", "dev"} -RUNTIME_EXTRAS = ( - set(metadata.metadata(DISTRIBUTION_NAME).get_all("Provides-Extra")) - DEV_EXTRAS -) -VERSION = metadata.version(DISTRIBUTION_NAME) +try: + RUNTIME_EXTRAS = ( + set(metadata.metadata(DISTRIBUTION_NAME).get_all("Provides-Extra")) - DEV_EXTRAS + ) + VERSION = metadata.version(DISTRIBUTION_NAME) +except Exception as e: + raise RuntimeError( + "Unable to read Synapse's package installation metadata. " + "This may be a problem with how Synapse has been packaged." + ) from e def _is_dev_dependency(req: Requirement) -> bool: |