From efe60d5e8c76cede325aa09a138f5033b90b8d90 Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Fri, 7 Aug 2015 16:36:42 +0100 Subject: Only print the pidfile path on startup if requested by a commandline flag --- synapse/app/homeserver.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'synapse/app') diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index 49e27c9e11..f04493f92a 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -657,7 +657,8 @@ def run(hs): if hs.config.daemonize: - print hs.config.pid_file + if hs.config.print_pidfile: + print hs.config.pid_file daemon = Daemonize( app="synapse-homeserver", -- cgit 1.4.1 From 86cef6a91b330d99b86cf2eacf75a446ce2e2955 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 25 Aug 2015 12:01:23 +0100 Subject: Allow specifying a directory to host a web client from --- synapse/app/homeserver.py | 8 +++++--- synapse/config/server.py | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'synapse/app') diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index f04493f92a..2c59457cda 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -97,9 +97,11 @@ class SynapseHomeServer(HomeServer): return JsonResource(self) def build_resource_for_web_client(self): - import syweb - syweb_path = os.path.dirname(syweb.__file__) - webclient_path = os.path.join(syweb_path, "webclient") + webclient_path = self.get_config().web_client_location + if not webclient_path: + import syweb + syweb_path = os.path.dirname(syweb.__file__) + webclient_path = os.path.join(syweb_path, "webclient") # GZip is disabled here due to # https://twistedmatrix.com/trac/ticket/7678 # (It can stay enabled for the API resources: they call diff --git a/synapse/config/server.py b/synapse/config/server.py index f9a3b5f15b..a03e55c223 100644 --- a/synapse/config/server.py +++ b/synapse/config/server.py @@ -22,6 +22,7 @@ class ServerConfig(Config): self.server_name = config["server_name"] self.pid_file = self.abspath(config.get("pid_file")) self.web_client = config["web_client"] + self.web_client_location = config.get("web_client_location", None) self.soft_file_limit = config["soft_file_limit"] self.daemonize = config.get("daemonize") self.print_pidfile = config.get("print_pidfile") -- cgit 1.4.1 From d9088c923f32fe1d2b6027320bb8fd5e46e1a428 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 25 Aug 2015 13:34:50 +0100 Subject: Remove dependency on matrix-angular-sdk --- synapse/app/homeserver.py | 9 ++++++++- synapse/python_dependencies.py | 6 +----- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'synapse/app') diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index 2c59457cda..6255e9676e 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -99,7 +99,14 @@ class SynapseHomeServer(HomeServer): def build_resource_for_web_client(self): webclient_path = self.get_config().web_client_location if not webclient_path: - import syweb + try: + import syweb + except ImportError: + quit_with_error( + "Could not find a webclient. Please either install syweb\n" + "or configure the location of the source to server via\n" + "the config option `web_client_location`" + ) syweb_path = os.path.dirname(syweb.__file__) webclient_path = os.path.join(syweb_path, "webclient") # GZip is disabled here due to diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py index fa06480ad1..61a362bb18 100644 --- a/synapse/python_dependencies.py +++ b/synapse/python_dependencies.py @@ -34,11 +34,7 @@ REQUIREMENTS = { "blist": ["blist"], "pysaml2": ["saml2"], } -CONDITIONAL_REQUIREMENTS = { - "web_client": { - "matrix_angular_sdk>=0.6.6": ["syweb>=0.6.6"], - } -} +CONDITIONAL_REQUIREMENTS = {} def requirements(config=None, include_conditional=False): -- cgit 1.4.1 From 37403ab06cd8c82c2910d44f1b78f2338c2dab9b Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 25 Aug 2015 14:19:09 +0100 Subject: Update the log message --- synapse/app/homeserver.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'synapse/app') diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index 6255e9676e..7f3e441723 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -103,9 +103,15 @@ class SynapseHomeServer(HomeServer): import syweb except ImportError: quit_with_error( - "Could not find a webclient. Please either install syweb\n" - "or configure the location of the source to server via\n" - "the config option `web_client_location`" + "Could not find a webclient.\n\n" + "Please either install the matrix-angular-sdk or configure\n" + "the location of the source to serve via the configuration\n" + "option `web_client_location`\n\n" + "To install the `matrix-angular-sdk` via pip, run:\n\n" + " pip install 'matrix-angular-sdk'\n" + "\n" + "You can also disable hosting of the webclient via the\n" + "configuration option `web_client`\n" ) syweb_path = os.path.dirname(syweb.__file__) webclient_path = os.path.join(syweb_path, "webclient") @@ -271,8 +277,7 @@ def quit_with_error(error_string): line_length = max([len(l) for l in message_lines]) + 2 sys.stderr.write("*" * line_length + '\n') for line in message_lines: - if line.strip(): - sys.stderr.write(" %s\n" % (line.strip(),)) + sys.stderr.write(" %s\n" % (line.rstrip(),)) sys.stderr.write("*" * line_length + '\n') sys.exit(1) -- cgit 1.4.1 From d33f31d741f703758c092e311bae263ff3c3ef64 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 25 Aug 2015 15:33:23 +0100 Subject: Print the correct pip install line when failing due to lack of matrix-angular-sdk --- synapse/app/homeserver.py | 7 ++++--- synapse/python_dependencies.py | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'synapse/app') diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index 7f3e441723..ff7807c2e6 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -16,7 +16,7 @@ import sys sys.dont_write_bytecode = True -from synapse.python_dependencies import check_requirements +from synapse.python_dependencies import check_requirements, DEPENDENCY_LINKS if __name__ == '__main__': check_requirements() @@ -108,10 +108,11 @@ class SynapseHomeServer(HomeServer): "the location of the source to serve via the configuration\n" "option `web_client_location`\n\n" "To install the `matrix-angular-sdk` via pip, run:\n\n" - " pip install 'matrix-angular-sdk'\n" + " pip install '%(dep)s'\n" "\n" "You can also disable hosting of the webclient via the\n" "configuration option `web_client`\n" + % {"dep": DEPENDENCY_LINKS["matrix-angular-sdk"]} ) syweb_path = os.path.dirname(syweb.__file__) webclient_path = os.path.join(syweb_path, "webclient") @@ -274,7 +275,7 @@ class SynapseHomeServer(HomeServer): def quit_with_error(error_string): message_lines = error_string.split("\n") - line_length = max([len(l) for l in message_lines]) + 2 + line_length = max([len(l) for l in message_lines if len(l) < 80]) + 2 sys.stderr.write("*" * line_length + '\n') for line in message_lines: sys.stderr.write(" %s\n" % (line.rstrip(),)) diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py index 82e28133e2..d7e3a686fa 100644 --- a/synapse/python_dependencies.py +++ b/synapse/python_dependencies.py @@ -52,18 +52,18 @@ def requirements(config=None, include_conditional=False): def github_link(project, version, egg): return "https://github.com/%s/tarball/%s/#egg=%s" % (project, version, egg) -DEPENDENCY_LINKS = [ - github_link( +DEPENDENCY_LINKS = { + "syutil": github_link( project="matrix-org/syutil", version="v0.0.7", egg="syutil-0.0.7", ), - github_link( + "matrix-angular-sdk": github_link( project="matrix-org/matrix-angular-sdk", version="v0.6.6", egg="matrix_angular_sdk-0.6.6", ), -] +} class MissingRequirementError(Exception): @@ -131,7 +131,7 @@ def check_requirements(config=None): def list_requirements(): result = [] linked = [] - for link in DEPENDENCY_LINKS: + for link in DEPENDENCY_LINKS.values(): egg = link.split("#egg=")[1] linked.append(egg.split('-')[0]) result.append(link) -- cgit 1.4.1 From 1002bbd7322e48c9ecbb1ea21b3fb8a44e4a4360 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 3 Sep 2015 09:51:01 +0100 Subject: Change log level to info --- synapse/app/homeserver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'synapse/app') diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index ff7807c2e6..fefefffb8f 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -341,7 +341,7 @@ def get_version_string(): ) ).encode("ascii") except Exception as e: - logger.warn("Failed to check for git repository: %s", e) + logger.info("Failed to check for git repository: %s", e) return ("Synapse/%s" % (synapse.__version__,)).encode("ascii") -- cgit 1.4.1