Merge branch 'develop' of github.com:matrix-org/synapse into state-chache

This commit is contained in:
Erik Johnston 2015-02-11 10:35:13 +00:00
commit 5758dafb4e
12 changed files with 43 additions and 54 deletions

View File

@ -1 +0,0 @@
0.6.1d

View File

@ -18,51 +18,42 @@ import os
from setuptools import setup, find_packages from setuptools import setup, find_packages
# Utility function to read the README file. here = os.path.abspath(os.path.dirname(__file__))
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ... def read_file(path_segments):
def read(fname): """Read a file from the package. Takes a list of strings to join to
return open(os.path.join(os.path.dirname(__file__), fname)).read() make the path"""
file_path = os.path.join(here, *path_segments)
with open(file_path) as f:
return f.read()
def exec_file(path_segments):
"""Execute a single python file to get the variables defined in it"""
result = {}
code = read_file(path_segments)
exec(code, result)
return result
version = exec_file(("synapse", "__init__.py"))["__version__"]
dependencies = exec_file(("synapse", "python_dependencies.py"))
long_description = read_file(("README.rst",))
setup( setup(
name="matrix-synapse", name="matrix-synapse",
version=read("VERSION").strip(), version=version,
packages=find_packages(exclude=["tests", "tests.*"]), packages=find_packages(exclude=["tests", "tests.*"]),
description="Reference Synapse Home Server", description="Reference Synapse Home Server",
install_requires=[ install_requires=dependencies["REQUIREMENTS"].keys(),
"syutil==0.0.2",
"matrix_angular_sdk>=0.6.1",
"Twisted==14.0.2",
"service_identity>=1.0.0",
"pyopenssl>=0.14",
"pyyaml",
"pyasn1",
"pynacl",
"daemonize",
"py-bcrypt",
"frozendict>=0.4",
"pillow",
"pydenticon",
],
dependency_links=[
"https://github.com/matrix-org/syutil/tarball/v0.0.2#egg=syutil-0.0.2",
"https://github.com/pyca/pynacl/tarball/d4d3175589b892f6ea7c22f466e0e223853516fa#egg=pynacl-0.3.0",
"https://github.com/matrix-org/matrix-angular-sdk/tarball/v0.6.1/#egg=matrix_angular_sdk-0.6.1",
],
setup_requires=[ setup_requires=[
"Twisted==14.0.2", # Here to override setuptools_trial's dependency on Twisted>=2.4.0 "Twisted==14.0.2", # Here to override setuptools_trial's dependency on Twisted>=2.4.0
"setuptools_trial", "setuptools_trial",
"setuptools>=1.0.0", # Needs setuptools that supports git+ssh.
# TODO: Do we need this now? we don't use git+ssh.
"mock" "mock"
], ],
dependency_links=dependencies["DEPENDENCY_LINKS"],
include_package_data=True, include_package_data=True,
zip_safe=False, zip_safe=False,
long_description=read("README.rst"), long_description=long_description,
entry_points=""" scripts=["synctl"],
[console_scripts]
synctl=synapse.app.synctl:main
synapse-homeserver=synapse.app.homeserver:main
"""
) )

View File

@ -16,4 +16,4 @@
""" This is a reference implementation of a Matrix home server. """ This is a reference implementation of a Matrix home server.
""" """
__version__ = "0.6.1d" __version__ = "0.6.1f"

View File

@ -134,7 +134,7 @@ class SynapseHomeServer(HomeServer):
logger.info("Attaching %s to path %s", resource, full_path) logger.info("Attaching %s to path %s", resource, full_path)
last_resource = self.root_resource last_resource = self.root_resource
for path_seg in full_path.split('/')[1:-1]: for path_seg in full_path.split('/')[1:-1]:
if not path_seg in last_resource.listNames(): if path_seg not in last_resource.listNames():
# resource doesn't exist, so make a "dummy resource" # resource doesn't exist, so make a "dummy resource"
child_resource = Resource() child_resource = Resource()
last_resource.putChild(path_seg, child_resource) last_resource.putChild(path_seg, child_resource)

View File

@ -75,7 +75,7 @@ class SynapseKeyClientProtocol(HTTPClient):
def handleStatus(self, version, status, message): def handleStatus(self, version, status, message):
if status != b"200": if status != b"200":
#logger.info("Non-200 response from %s: %s %s", # logger.info("Non-200 response from %s: %s %s",
# self.transport.getHost(), status, message) # self.transport.getHost(), status, message)
self.transport.abortConnection() self.transport.abortConnection()
@ -83,7 +83,7 @@ class SynapseKeyClientProtocol(HTTPClient):
try: try:
json_response = json.loads(response_body_bytes) json_response = json.loads(response_body_bytes)
except ValueError: except ValueError:
#logger.info("Invalid JSON response from %s", # logger.info("Invalid JSON response from %s",
# self.transport.getHost()) # self.transport.getHost())
self.transport.abortConnection() self.transport.abortConnection()
return return

View File

@ -457,9 +457,9 @@ class PresenceHandler(BaseHandler):
if state is None: if state is None:
state = yield self.store.get_presence_state(user.localpart) state = yield self.store.get_presence_state(user.localpart)
else: else:
# statuscache = self._get_or_make_usercache(user) # statuscache = self._get_or_make_usercache(user)
# self._user_cachemap_latest_serial += 1 # self._user_cachemap_latest_serial += 1
# statuscache.update(state, self._user_cachemap_latest_serial) # statuscache.update(state, self._user_cachemap_latest_serial)
pass pass
yield self.push_update_to_local_and_remote( yield self.push_update_to_local_and_remote(
@ -709,7 +709,7 @@ class PresenceHandler(BaseHandler):
# TODO(paul) permissions checks # TODO(paul) permissions checks
if not user in self._remote_sendmap: if user not in self._remote_sendmap:
self._remote_sendmap[user] = set() self._remote_sendmap[user] = set()
self._remote_sendmap[user].add(origin) self._remote_sendmap[user].add(origin)

View File

@ -114,7 +114,7 @@ class SyncHandler(BaseHandler):
if sync_config.gap: if sync_config.gap:
return self.incremental_sync_with_gap(sync_config, since_token) return self.incremental_sync_with_gap(sync_config, since_token)
else: else:
#TODO(mjark): Handle gapless sync # TODO(mjark): Handle gapless sync
raise NotImplementedError() raise NotImplementedError()
@defer.inlineCallbacks @defer.inlineCallbacks

View File

@ -113,6 +113,7 @@ class JsonResource(HttpServer, resource.Resource):
path. path.
""" """
code = None code = None
start = self.clock.time_msec()
try: try:
# Just say yes to OPTIONS. # Just say yes to OPTIONS.
if request.method == "OPTIONS": if request.method == "OPTIONS":
@ -137,8 +138,6 @@ class JsonResource(HttpServer, resource.Resource):
request.method, request.path request.method, request.path
) )
start = self.clock.time_msec()
code, response = yield path_entry.callback( code, response = yield path_entry.callback(
request, request,
*args *args

View File

@ -5,7 +5,7 @@ logger = logging.getLogger(__name__)
REQUIREMENTS = { REQUIREMENTS = {
"syutil==0.0.2": ["syutil"], "syutil==0.0.2": ["syutil"],
"matrix_angular_sdk==0.6.0": ["syweb>=0.6.0"], "matrix_angular_sdk>=0.6.1": ["syweb>=0.6.1"],
"Twisted==14.0.2": ["twisted==14.0.2"], "Twisted==14.0.2": ["twisted==14.0.2"],
"service_identity>=1.0.0": ["service_identity>=1.0.0"], "service_identity>=1.0.0": ["service_identity>=1.0.0"],
"pyopenssl>=0.14": ["OpenSSL>=0.14"], "pyopenssl>=0.14": ["OpenSSL>=0.14"],
@ -31,8 +31,8 @@ DEPENDENCY_LINKS = [
), ),
github_link( github_link(
project="matrix-org/matrix-angular-sdk", project="matrix-org/matrix-angular-sdk",
version="v0.6.0", version="v0.6.1",
egg="matrix_angular_sdk-0.6.0", egg="matrix_angular_sdk-0.6.1",
), ),
github_link( github_link(
project="pyca/pynacl", project="pyca/pynacl",

View File

@ -48,7 +48,7 @@ class ClientDirectoryServer(ClientV1RestServlet):
user, client = yield self.auth.get_user_by_req(request) user, client = yield self.auth.get_user_by_req(request)
content = _parse_json(request) content = _parse_json(request)
if not "room_id" in content: if "room_id" not in content:
raise SynapseError(400, "Missing room_id key", raise SynapseError(400, "Missing room_id key",
errcode=Codes.BAD_JSON) errcode=Codes.BAD_JSON)

View File

@ -118,7 +118,7 @@ class SyncRestServlet(RestServlet):
except: except:
filter = Filter({}) filter = Filter({})
# filter = filter.apply_overrides(http_request) # filter = filter.apply_overrides(http_request)
#if filter.matches(event): # if filter.matches(event):
# # stuff # # stuff
sync_config = SyncConfig( sync_config = SyncConfig(

View File

@ -96,8 +96,8 @@ class UploadResource(BaseMediaResource):
code=400, code=400,
) )
#if headers.hasHeader("Content-Disposition"): # if headers.hasHeader("Content-Disposition"):
# disposition = headers.getRawHeaders("Content-Disposition")[0] # disposition = headers.getRawHeaders("Content-Disposition")[0]
# TODO(markjh): parse content-dispostion # TODO(markjh): parse content-dispostion
content_uri = yield self.create_content( content_uri = yield self.create_content(