summary refs log tree commit diff
path: root/synapse/util
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-04-27 15:37:59 +0100
committerDavid Robertson <davidr@element.io>2022-04-27 15:37:59 +0100
commitbdb00ee73b1ff2346c864a4dec175d9bbd37d116 (patch)
treee4222066e0cfa88aadc4b74cd775b043d4825da7 /synapse/util
parentAdd some type hints to datastore (#12485) (diff)
downloadsynapse-dmr/warn-missing-metadata.tar.xz
Not sure if this is a good idea, but here is a proposed change
Diffstat (limited to '')
-rw-r--r--synapse/util/check_dependencies.py14
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: