diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-09-01 16:47:26 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-09-01 16:47:26 +0100 |
commit | 3cdfd37d95484b9ebca012a8169b8d6613385656 (patch) | |
tree | 5f04080c6fe565e4fe49fdcbd5a1eae9ecb7f8d6 /synapse/app/homeserver.py | |
parent | Merge pull request #264 from matrix-org/markjh/syweb_on_pypi (diff) | |
download | synapse-3cdfd37d95484b9ebca012a8169b8d6613385656.tar.xz |
Print an example "pip install" line for a missing requirement
Diffstat (limited to 'synapse/app/homeserver.py')
-rwxr-xr-x | synapse/app/homeserver.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index ffc6299146..2a85932b86 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -16,10 +16,23 @@ import sys sys.dont_write_bytecode = True -from synapse.python_dependencies import check_requirements, DEPENDENCY_LINKS +from synapse.python_dependencies import ( + check_requirements, DEPENDENCY_LINKS, MissingRequirementError +) if __name__ == '__main__': - check_requirements() + try: + check_requirements() + except MissingRequirementError as e: + message = "\n".join([ + "Missing Requirement: %s" % (e.message,), + "To install run:", + " pip install --upgrade --force \"%s\"" % (e.dependency,), + "", + ]) + sys.stderr.writelines(message) + sys.exit(1) + from synapse.storage.engines import create_engine, IncorrectDatabaseSetup from synapse.storage import ( |