Only import jinja2 when needed (#5514)

Fixes https://github.com/matrix-org/synapse/issues/5431

`jinja2` was being imported even when it wasn't strictly necessary. This made it required to run Synapse, even if the functionality that required it wasn't enabled. This was causing new Synapse installations to crash on startup.

Email modules are now required.
This commit is contained in:
Andrew Morgan 2019-06-21 16:52:09 +01:00 committed by GitHub
parent 0e8b35f7b0
commit 5d6644efe0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

1
changelog.d/5514.bugfix Normal file
View file

@ -0,0 +1 @@
Fix bug with `jinja2` preventing Synapse from starting. Users who had this problem should now simply need to run `pip install matrix-synapse`.

View file

@ -72,10 +72,11 @@ REQUIREMENTS = [
# Twisted 18.7.0 requires attrs>=17.4.0 # Twisted 18.7.0 requires attrs>=17.4.0
"attrs>=17.4.0", "attrs>=17.4.0",
"netaddr>=0.7.18", "netaddr>=0.7.18",
"Jinja2>=2.9",
"bleach>=1.4.3",
] ]
CONDITIONAL_REQUIREMENTS = { CONDITIONAL_REQUIREMENTS = {
"email": ["Jinja2>=2.9", "bleach>=1.4.3"],
"matrix-synapse-ldap3": ["matrix-synapse-ldap3>=0.1"], "matrix-synapse-ldap3": ["matrix-synapse-ldap3>=0.1"],
# we use execute_batch, which arrived in psycopg 2.7. # we use execute_batch, which arrived in psycopg 2.7.
"postgres": ["psycopg2>=2.7"], "postgres": ["psycopg2>=2.7"],