From 5c297d5a63ad6afacd52d90389bdd115e89c78f7 Mon Sep 17 00:00:00 2001 From: Silke Hofstra Date: Tue, 1 Jan 2019 14:51:05 +0100 Subject: [PATCH 1/6] Add systemd-python to optional dependencies Using systemd-python allows for logging to the systemd journal, as is documented in: `synapse/contrib/systemd/log_config.yaml`. Signed-off-by: Silke Hofstra --- changelog.d/4339.feature | 1 + docker/Dockerfile-dhvirtualenv | 2 ++ synapse/python_dependencies.py | 1 + 3 files changed, 4 insertions(+) create mode 100644 changelog.d/4339.feature diff --git a/changelog.d/4339.feature b/changelog.d/4339.feature new file mode 100644 index 000000000000..cecff97b80c0 --- /dev/null +++ b/changelog.d/4339.feature @@ -0,0 +1 @@ +Add systemd-python to the optional dependencies to enable logging to the systemd journal. Install with `pip install matrix-synapse[systemd]`. diff --git a/docker/Dockerfile-dhvirtualenv b/docker/Dockerfile-dhvirtualenv index ab28e49291dc..a30fa3ff0d9d 100644 --- a/docker/Dockerfile-dhvirtualenv +++ b/docker/Dockerfile-dhvirtualenv @@ -50,7 +50,9 @@ RUN apt-get update -qq -o Acquire::Languages=none \ debhelper \ devscripts \ dh-systemd \ + libsystemd-dev \ lsb-release \ + pkg-config \ python3-dev \ python3-pip \ python3-setuptools \ diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py index 69c5f9fe2e65..38ce5b4a5bbe 100644 --- a/synapse/python_dependencies.py +++ b/synapse/python_dependencies.py @@ -73,6 +73,7 @@ "resources.consent": ["Jinja2>=2.9"], "saml2": ["pysaml2>=4.5.0"], + "systemd": ["systemd-python>=231"], "url_preview": ["lxml>=3.5.0"], "test": ["mock>=2.0"], } From c7528e6ee7ddbb7ce0f3c1c3b18598661cd9ad03 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Wed, 27 Mar 2019 01:45:40 +1100 Subject: [PATCH 2/6] Exclude systemd from "all". --- synapse/python_dependencies.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py index 38ce5b4a5bbe..52fe577b88e4 100644 --- a/synapse/python_dependencies.py +++ b/synapse/python_dependencies.py @@ -81,8 +81,9 @@ def list_requirements(): deps = set(REQUIREMENTS) - for opt in CONDITIONAL_REQUIREMENTS.values(): - deps = set(opt) | deps + for name, opts in CONDITIONAL_REQUIREMENTS.items(): + if name not in ["systemd"]: + deps = set(opts) | deps return list(deps) From e0e8ecd36d869c4dc90cee11ad4237a4d17ce9ec Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Tue, 16 Apr 2019 19:45:27 +1000 Subject: [PATCH 3/6] remove broken change --- synapse/python_dependencies.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py index 52fe577b88e4..1568b6b4f6d2 100644 --- a/synapse/python_dependencies.py +++ b/synapse/python_dependencies.py @@ -81,9 +81,8 @@ def list_requirements(): deps = set(REQUIREMENTS) - for name, opts in CONDITIONAL_REQUIREMENTS.items(): - if name not in ["systemd"]: - deps = set(opts) | deps + for opts in CONDITIONAL_REQUIREMENTS.items(): + deps = set(opts) | deps return list(deps) From ee83d296b4c05065900da75397751dbb25eb19d9 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Tue, 16 Apr 2019 19:47:05 +1000 Subject: [PATCH 4/6] Exclude systemd from [all] --- setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 55b1b10a77e2..bcc644800c1a 100755 --- a/setup.py +++ b/setup.py @@ -90,8 +90,10 @@ def exec_file(path_segments): # Make `pip install matrix-synapse[all]` install all the optional dependencies. ALL_OPTIONAL_REQUIREMENTS = set() -for optional_deps in CONDITIONAL_REQUIREMENTS.values(): - ALL_OPTIONAL_REQUIREMENTS = set(optional_deps) | ALL_OPTIONAL_REQUIREMENTS +for name, optional_deps in CONDITIONAL_REQUIREMENTS.items(): + # Exclude systemd as it's a system-based requirement. + if name not in ["systemd"]: + ALL_OPTIONAL_REQUIREMENTS = set(optional_deps) | ALL_OPTIONAL_REQUIREMENTS CONDITIONAL_REQUIREMENTS["all"] = list(ALL_OPTIONAL_REQUIREMENTS) From fb6f267f8fd07b334a8ac2043f382487f425a0d8 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Tue, 16 Apr 2019 19:58:10 +1000 Subject: [PATCH 5/6] Update python_dependencies.py --- synapse/python_dependencies.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py index 4b48bb74f0c6..73fef3f9f1a3 100644 --- a/synapse/python_dependencies.py +++ b/synapse/python_dependencies.py @@ -95,8 +95,8 @@ def list_requirements(): deps = set(REQUIREMENTS) - for opts in CONDITIONAL_REQUIREMENTS.items(): - deps = set(opts) | deps + for opt in CONDITIONAL_REQUIREMENTS.values(): + deps = set(opt) | deps return list(deps) From fa1cf735c32b37ae577ac2b3fc04fbe5f3ec2282 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Tue, 16 Apr 2019 20:17:40 +1000 Subject: [PATCH 6/6] unify where this happens --- setup.py | 8 +------- synapse/python_dependencies.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index bcc644800c1a..55663e9cac28 100755 --- a/setup.py +++ b/setup.py @@ -86,15 +86,9 @@ def exec_file(path_segments): REQUIREMENTS = dependencies['REQUIREMENTS'] CONDITIONAL_REQUIREMENTS = dependencies['CONDITIONAL_REQUIREMENTS'] +ALL_OPTIONAL_REQUIREMENTS = dependencies['ALL_OPTIONAL_REQUIREMENTS'] # Make `pip install matrix-synapse[all]` install all the optional dependencies. -ALL_OPTIONAL_REQUIREMENTS = set() - -for name, optional_deps in CONDITIONAL_REQUIREMENTS.items(): - # Exclude systemd as it's a system-based requirement. - if name not in ["systemd"]: - ALL_OPTIONAL_REQUIREMENTS = set(optional_deps) | ALL_OPTIONAL_REQUIREMENTS - CONDITIONAL_REQUIREMENTS["all"] = list(ALL_OPTIONAL_REQUIREMENTS) diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py index 4b48bb74f0c6..779f36dbede4 100644 --- a/synapse/python_dependencies.py +++ b/synapse/python_dependencies.py @@ -92,13 +92,16 @@ "sentry": ["sentry-sdk>=0.7.2"], } +ALL_OPTIONAL_REQUIREMENTS = set() + +for name, optional_deps in CONDITIONAL_REQUIREMENTS.items(): + # Exclude systemd as it's a system-based requirement. + if name not in ["systemd"]: + ALL_OPTIONAL_REQUIREMENTS = set(optional_deps) | ALL_OPTIONAL_REQUIREMENTS -def list_requirements(): - deps = set(REQUIREMENTS) - for opts in CONDITIONAL_REQUIREMENTS.items(): - deps = set(opts) | deps - return list(deps) +def list_requirements(): + return list(set(REQUIREMENTS) | ALL_OPTIONAL_REQUIREMENTS) class DependencyException(Exception):