Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit d60aa65

Browse files
committed
Merge branch 'rav/room_invite_state' into rav/create_in_room_invite
2 parents e54ada4 + 2c6dd9d commit d60aa65

File tree

8 files changed

+63
-48
lines changed

8 files changed

+63
-48
lines changed

changelog.d/9610.docker

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Speed up Docker builds and make it nicer to test against Complement while developing (install all dependencies before copying the project).

changelog.d/9699.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a bug introduced in Synapse 1.30.1 which meant the suggested `pip` incantation to install an updated `cryptography` was incorrect.

changelog.d/9703.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix undetected mypy error when using Python 3.6.

changelog.d/9709.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix type-checking CI on develop.

docker/Dockerfile

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -25,42 +25,40 @@ LABEL org.opencontainers.image.licenses='Apache-2.0'
2525

2626
# install the OS build deps
2727
RUN apt-get update && apt-get install -y \
28-
build-essential \
29-
libffi-dev \
30-
libjpeg-dev \
31-
libpq-dev \
32-
libssl-dev \
33-
libwebp-dev \
34-
libxml++2.6-dev \
35-
libxslt1-dev \
36-
openssl \
37-
rustc \
38-
zlib1g-dev \
39-
&& rm -rf /var/lib/apt/lists/*
40-
41-
# Build dependencies that are not available as wheels, to speed up rebuilds
42-
RUN pip install --prefix="/install" --no-warn-script-location \
43-
cryptography \
44-
frozendict \
45-
jaeger-client \
46-
opentracing \
47-
# Match the version constraints of Synapse
48-
"prometheus_client>=0.4.0" \
49-
psycopg2 \
50-
pycparser \
51-
pyrsistent \
52-
pyyaml \
53-
simplejson \
54-
threadloop \
55-
thrift
56-
57-
# now install synapse and all of the python deps to /install.
58-
COPY synapse /synapse/synapse/
28+
build-essential \
29+
libffi-dev \
30+
libjpeg-dev \
31+
libpq-dev \
32+
libssl-dev \
33+
libwebp-dev \
34+
libxml++2.6-dev \
35+
libxslt1-dev \
36+
openssl \
37+
rustc \
38+
zlib1g-dev \
39+
&& rm -rf /var/lib/apt/lists/*
40+
41+
# Copy just what we need to pip install
5942
COPY scripts /synapse/scripts/
6043
COPY MANIFEST.in README.rst setup.py synctl /synapse/
44+
COPY synapse/__init__.py /synapse/synapse/__init__.py
45+
COPY synapse/python_dependencies.py /synapse/synapse/python_dependencies.py
6146

47+
# To speed up rebuilds, install all of the dependencies before we copy over
48+
# the whole synapse project so that we this layer in the Docker cache can be
49+
# used while you develop on the source
50+
#
51+
# This is aiming at installing the `install_requires` and `extras_require` from `setup.py`
6252
RUN pip install --prefix="/install" --no-warn-script-location \
63-
/synapse[all]
53+
/synapse[all]
54+
55+
# Copy over the rest of the project
56+
COPY synapse /synapse/synapse/
57+
58+
# Install the synapse package itself and all of its children packages.
59+
#
60+
# This is aiming at installing only the `packages=find_packages(...)` from `setup.py
61+
RUN pip install --prefix="/install" --no-deps --no-warn-script-location /synapse
6462

6563
###
6664
### Stage 1: runtime
@@ -69,16 +67,16 @@ RUN pip install --prefix="/install" --no-warn-script-location \
6967
FROM docker.io/python:${PYTHON_VERSION}-slim
7068

7169
RUN apt-get update && apt-get install -y \
72-
curl \
73-
gosu \
74-
libjpeg62-turbo \
75-
libpq5 \
76-
libwebp6 \
77-
xmlsec1 \
78-
libjemalloc2 \
79-
libssl-dev \
80-
openssl \
81-
&& rm -rf /var/lib/apt/lists/*
70+
curl \
71+
gosu \
72+
libjpeg62-turbo \
73+
libpq5 \
74+
libwebp6 \
75+
xmlsec1 \
76+
libjemalloc2 \
77+
libssl-dev \
78+
openssl \
79+
&& rm -rf /var/lib/apt/lists/*
8280

8381
COPY --from=builder /install /usr/local
8482
COPY ./docker/start.py /start.py
@@ -91,4 +89,4 @@ EXPOSE 8008/tcp 8009/tcp 8448/tcp
9189
ENTRYPOINT ["/start.py"]
9290

9391
HEALTHCHECK --interval=1m --timeout=5s \
94-
CMD curl -fSs http://localhost:8008/health || exit 1
92+
CMD curl -fSs http://localhost:8008/health || exit 1

synapse/logging/opentracing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def set_fates(clotho, lachesis, atropos, father="Zues", mother="Themis"):
169169
import logging
170170
import re
171171
from functools import wraps
172-
from typing import TYPE_CHECKING, Dict, Optional, Type
172+
from typing import TYPE_CHECKING, Dict, Optional, Pattern, Type
173173

174174
import attr
175175

@@ -262,7 +262,7 @@ def report_span(self, span):
262262
# Block everything by default
263263
# A regex which matches the server_names to expose traces for.
264264
# None means 'block everything'.
265-
_homeserver_whitelist = None # type: Optional[re.Pattern[str]]
265+
_homeserver_whitelist = None # type: Optional[Pattern[str]]
266266

267267
# Util methods
268268

synapse/python_dependencies.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717

18+
import itertools
1819
import logging
1920
from typing import List, Set
2021

@@ -101,7 +102,7 @@
101102
"txacme>=0.9.2",
102103
# txacme depends on eliot. Eliot 1.8.0 is incompatible with
103104
# python 3.5.2, as per https://github.com/itamarst/eliot/issues/418
104-
'eliot<1.8.0;python_version<"3.5.3"',
105+
"eliot<1.8.0;python_version<'3.5.3'",
105106
],
106107
"saml2": [
107108
# pysaml2 6.4.0 is incompatible with Python 3.5 (see https://github.com/IdentityPython/pysaml2/issues/749)
@@ -131,6 +132,18 @@
131132
ALL_OPTIONAL_REQUIREMENTS = set(optional_deps) | ALL_OPTIONAL_REQUIREMENTS
132133

133134

135+
# ensure there are no double-quote characters in any of the deps (otherwise the
136+
# 'pip install' incantation in DependencyException will break)
137+
for dep in itertools.chain(
138+
REQUIREMENTS,
139+
*CONDITIONAL_REQUIREMENTS.values(),
140+
):
141+
if '"' in dep:
142+
raise Exception(
143+
"Dependency `%s` contains double-quote; use single-quotes instead" % (dep,)
144+
)
145+
146+
134147
def list_requirements():
135148
return list(set(REQUIREMENTS) | ALL_OPTIONAL_REQUIREMENTS)
136149

@@ -150,7 +163,7 @@ def message(self):
150163
@property
151164
def dependencies(self):
152165
for i in self.args[0]:
153-
yield "'" + i + "'"
166+
yield '"' + i + '"'
154167

155168

156169
def check_requirements(for_feature=None):

tests/replication/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
try:
4545
import hiredis
4646
except ImportError:
47-
hiredis = None
47+
hiredis = None # type: ignore
4848

4949
logger = logging.getLogger(__name__)
5050

0 commit comments

Comments
 (0)