Print the correct pip install line when failing due to lack of matrix-angular-sdk

pull/245/head
Erik Johnston 2015-08-25 15:33:23 +01:00
parent 37403ab06c
commit d33f31d741
2 changed files with 9 additions and 8 deletions

View File

@ -16,7 +16,7 @@
import sys import sys
sys.dont_write_bytecode = True sys.dont_write_bytecode = True
from synapse.python_dependencies import check_requirements from synapse.python_dependencies import check_requirements, DEPENDENCY_LINKS
if __name__ == '__main__': if __name__ == '__main__':
check_requirements() check_requirements()
@ -108,10 +108,11 @@ class SynapseHomeServer(HomeServer):
"the location of the source to serve via the configuration\n" "the location of the source to serve via the configuration\n"
"option `web_client_location`\n\n" "option `web_client_location`\n\n"
"To install the `matrix-angular-sdk` via pip, run:\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" "\n"
"You can also disable hosting of the webclient via the\n" "You can also disable hosting of the webclient via the\n"
"configuration option `web_client`\n" "configuration option `web_client`\n"
% {"dep": DEPENDENCY_LINKS["matrix-angular-sdk"]}
) )
syweb_path = os.path.dirname(syweb.__file__) syweb_path = os.path.dirname(syweb.__file__)
webclient_path = os.path.join(syweb_path, "webclient") webclient_path = os.path.join(syweb_path, "webclient")
@ -274,7 +275,7 @@ class SynapseHomeServer(HomeServer):
def quit_with_error(error_string): def quit_with_error(error_string):
message_lines = error_string.split("\n") 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') sys.stderr.write("*" * line_length + '\n')
for line in message_lines: for line in message_lines:
sys.stderr.write(" %s\n" % (line.rstrip(),)) sys.stderr.write(" %s\n" % (line.rstrip(),))

View File

@ -52,18 +52,18 @@ def requirements(config=None, include_conditional=False):
def github_link(project, version, egg): def github_link(project, version, egg):
return "https://github.com/%s/tarball/%s/#egg=%s" % (project, version, egg) return "https://github.com/%s/tarball/%s/#egg=%s" % (project, version, egg)
DEPENDENCY_LINKS = [ DEPENDENCY_LINKS = {
github_link( "syutil": github_link(
project="matrix-org/syutil", project="matrix-org/syutil",
version="v0.0.7", version="v0.0.7",
egg="syutil-0.0.7", egg="syutil-0.0.7",
), ),
github_link( "matrix-angular-sdk": github_link(
project="matrix-org/matrix-angular-sdk", project="matrix-org/matrix-angular-sdk",
version="v0.6.6", version="v0.6.6",
egg="matrix_angular_sdk-0.6.6", egg="matrix_angular_sdk-0.6.6",
), ),
] }
class MissingRequirementError(Exception): class MissingRequirementError(Exception):
@ -131,7 +131,7 @@ def check_requirements(config=None):
def list_requirements(): def list_requirements():
result = [] result = []
linked = [] linked = []
for link in DEPENDENCY_LINKS: for link in DEPENDENCY_LINKS.values():
egg = link.split("#egg=")[1] egg = link.split("#egg=")[1]
linked.append(egg.split('-')[0]) linked.append(egg.split('-')[0])
result.append(link) result.append(link)