Merge branch 'master' of https://github.com/tulir/mautrix-telegram into anoa/group_id_example
* 'master' of https://github.com/tulir/mautrix-telegram: Add hack for Riot iOS being dumb about thumbnails Update to mautrix-python 0.5.0 Optimize dockerfile a bit Move dependency versions to requirements.txt
This commit is contained in:
+21
-19
@@ -20,21 +20,7 @@ RUN apk add --no-cache libpng libpng-dev zlib zlib-dev \
|
||||
|
||||
FROM docker.io/alpine:3.11
|
||||
|
||||
ENV UID=1337 \
|
||||
GID=1337 \
|
||||
FFMPEG_BINARY=/usr/bin/ffmpeg
|
||||
|
||||
COPY --from=lottieconverter /usr/lib/librlottie* /usr/lib/
|
||||
COPY --from=lottieconverter /build/LottieConverter/dist/Debug/GNU-Linux/lottieconverter /usr/local/bin/lottieconverter
|
||||
|
||||
COPY . /opt/mautrix-telegram
|
||||
WORKDIR /opt/mautrix-telegram
|
||||
RUN apk add --no-cache --virtual .build-deps \
|
||||
python3-dev \
|
||||
libffi-dev \
|
||||
build-base \
|
||||
git \
|
||||
&& apk add --no-cache \
|
||||
RUN apk add --no-cache \
|
||||
py3-virtualenv \
|
||||
py3-pillow \
|
||||
py3-aiohttp \
|
||||
@@ -60,18 +46,34 @@ RUN apk add --no-cache --virtual .build-deps \
|
||||
py3-rsa \
|
||||
# cryptg
|
||||
py3-cffi \
|
||||
py3-brotli \
|
||||
# Other dependencies
|
||||
ffmpeg \
|
||||
ca-certificates \
|
||||
su-exec \
|
||||
netcat-openbsd \
|
||||
# lottieconverter
|
||||
zlib libpng \
|
||||
&& pip3 install .[speedups,hq_thumbnails,metrics] \
|
||||
# pip installs the sources to /usr/lib/python3.8/site-packages, so we don't need them here
|
||||
&& rm -rf /opt/mautrix-telegram/mautrix_telegram \
|
||||
zlib libpng
|
||||
|
||||
COPY requirements.txt /opt/mautrix-telegram/requirements.txt
|
||||
COPY optional-requirements.txt /opt/mautrix-telegram/optional-requirements.txt
|
||||
WORKDIR /opt/mautrix-telegram
|
||||
RUN apk add --virtual .build-deps \
|
||||
python3-dev \
|
||||
libffi-dev \
|
||||
build-base \
|
||||
&& sed -Ei 's/psycopg2-binary.+//' optional-requirements.txt \
|
||||
&& pip3 install -r requirements.txt -r optional-requirements.txt \
|
||||
&& apk del .build-deps
|
||||
|
||||
COPY . /opt/mautrix-telegram
|
||||
RUN apk add git && pip3 install .[speedups,hq_thumbnails,metrics] && apk del git
|
||||
|
||||
COPY --from=lottieconverter /usr/lib/librlottie* /usr/lib/
|
||||
COPY --from=lottieconverter /build/LottieConverter/dist/Debug/GNU-Linux/lottieconverter /usr/local/bin/lottieconverter
|
||||
|
||||
VOLUME /data
|
||||
ENV UID=1337 GID=1337 \
|
||||
FFMPEG_BINARY=/usr/bin/ffmpeg
|
||||
|
||||
CMD ["/opt/mautrix-telegram/docker-run.sh"]
|
||||
|
||||
@@ -44,6 +44,7 @@ except ImportError:
|
||||
|
||||
|
||||
class TelegramBridge(Bridge):
|
||||
module = "mautrix_telegram"
|
||||
name = "mautrix-telegram"
|
||||
command = "python -m mautrix-telegram"
|
||||
description = "A Matrix-Telegram puppeting bridge."
|
||||
|
||||
@@ -152,6 +152,9 @@ class PortalTelegram(BasePortal, ABC):
|
||||
height=file.thumbnail.height or thumb_size.h,
|
||||
width=file.thumbnail.width or thumb_size.w,
|
||||
size=file.thumbnail.size)
|
||||
else:
|
||||
info.thumbnail_url = file.mxc
|
||||
info.thumbnail_info = ImageInfo.deserialize(info.serialize())
|
||||
|
||||
return info, name
|
||||
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
cryptg
|
||||
Pillow
|
||||
moviepy
|
||||
prometheus_client
|
||||
psycopg2-binary
|
||||
# Format: #/name defines a new extras_require group called name
|
||||
# Uncommented lines after the group definition insert things into that group.
|
||||
|
||||
#/speedups
|
||||
cryptg>=0.1,<0.3
|
||||
cchardet
|
||||
aiodns
|
||||
brotli
|
||||
|
||||
#/webp_convert
|
||||
pillow>=4.3,<8
|
||||
|
||||
#/hq_thumbnails
|
||||
moviepy>=1,<2
|
||||
|
||||
#/metrics
|
||||
prometheus_client>=0.6,<0.8
|
||||
|
||||
#/postgres
|
||||
psycopg2-binary>=2,<3
|
||||
|
||||
+9
-9
@@ -1,9 +1,9 @@
|
||||
aiohttp
|
||||
mautrix
|
||||
ruamel.yaml
|
||||
python-magic
|
||||
SQLAlchemy
|
||||
alembic
|
||||
commonmark
|
||||
telethon
|
||||
telethon-session-sqlalchemy
|
||||
SQLAlchemy>=1.2,<2
|
||||
alembic>=1,<2
|
||||
ruamel.yaml>=0.15.35,<0.17
|
||||
python-magic>=0.4,<0.5
|
||||
commonmark>=0.8,<0.10
|
||||
aiohttp>=3,<4
|
||||
mautrix==0.5.0.beta4
|
||||
telethon>=1.10,<1.12
|
||||
telethon-session-sqlalchemy>=0.2.14,<0.3
|
||||
|
||||
@@ -3,14 +3,21 @@ import glob
|
||||
|
||||
from mautrix_telegram.get_version import git_tag, git_revision, version, linkified_version
|
||||
|
||||
extras = {
|
||||
"speedups": ["cryptg>=0.1,<0.3", "cchardet", "aiodns", "Brotli"],
|
||||
"webp_convert": ["Pillow>=4.3.0,<7"],
|
||||
"hq_thumbnails": ["moviepy>=1.0,<2.0"],
|
||||
"metrics": ["prometheus_client>=0.6.0,<0.8.0"],
|
||||
"postgres": ["psycopg2-binary>=2,<3"],
|
||||
}
|
||||
extras["all"] = list({dep for deps in extras.values() for dep in deps})
|
||||
with open("requirements.txt") as reqs:
|
||||
install_requires = reqs.read().splitlines()
|
||||
|
||||
with open("optional-requirements.txt") as reqs:
|
||||
extras_require = {}
|
||||
current = []
|
||||
for line in reqs.read().splitlines():
|
||||
if line.startswith("#/"):
|
||||
extras_require[line[2:]] = current = []
|
||||
elif not line or line.startswith("#"):
|
||||
continue
|
||||
else:
|
||||
current.append(line)
|
||||
|
||||
extras_require["all"] = list({dep for deps in extras_require.values() for dep in deps})
|
||||
|
||||
try:
|
||||
long_desc = open("README.md").read()
|
||||
@@ -40,18 +47,8 @@ setuptools.setup(
|
||||
|
||||
packages=setuptools.find_packages(),
|
||||
|
||||
install_requires=[
|
||||
"aiohttp>=3.0.1,<4",
|
||||
"mautrix>=0.4.0,<0.5",
|
||||
"SQLAlchemy>=1.2.3,<2",
|
||||
"alembic>=1.0.0,<2",
|
||||
"commonmark>=0.8.1,<0.10",
|
||||
"ruamel.yaml>=0.15.35,<0.17",
|
||||
"python-magic>=0.4.15,<0.5",
|
||||
"telethon>=1.10,<1.11",
|
||||
"telethon-session-sqlalchemy>=0.2.14,<0.3",
|
||||
],
|
||||
extras_require=extras,
|
||||
install_requires=install_requires,
|
||||
extras_require=extras_require,
|
||||
python_requires="~=3.6",
|
||||
|
||||
setup_requires=["pytest-runner"],
|
||||
@@ -74,9 +71,10 @@ setuptools.setup(
|
||||
""",
|
||||
package_data={"mautrix_telegram": [
|
||||
"web/public/*.mako", "web/public/*.png", "web/public/*.css",
|
||||
"example-config.yaml",
|
||||
]},
|
||||
data_files=[
|
||||
(".", ["example-config.yaml", "alembic.ini"]),
|
||||
(".", ["alembic.ini"]),
|
||||
("alembic", ["alembic/env.py"]),
|
||||
("alembic/versions", glob.glob("alembic/versions/*.py"))
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user