From 8f40a0b292f1f4f7c1a28d54b0530a37add4de5a Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 6 Sep 2023 21:39:28 +0300 Subject: [PATCH] Update mautrix-python --- docker/run.sh | 2 +- maubot/config.py | 6 +++++- maubot/example-config.yaml | 4 ++-- maubot/instance.py | 2 +- maubot/standalone/example-config.yaml | 2 +- requirements.txt | 2 +- setup.py | 3 +-- 7 files changed, 12 insertions(+), 9 deletions(-) diff --git a/docker/run.sh b/docker/run.sh index ff9b54c..5447e27 100755 --- a/docker/run.sh +++ b/docker/run.sh @@ -13,7 +13,7 @@ function fixdefault { function fixconfig { # Change relative default paths to absolute paths in /data - fixdefault '.database' 'sqlite:///maubot.db' 'sqlite:////data/maubot.db' + fixdefault '.database' 'sqlite:maubot.db' 'sqlite:/data/maubot.db' fixdefault '.plugin_directories.upload' './plugins' '/data/plugins' fixdefault '.plugin_directories.load[0]' './plugins' '/data/plugins' fixdefault '.plugin_directories.trash' './trash' '/data/trash' diff --git a/maubot/config.py b/maubot/config.py index c5368cd..b8e42de 100644 --- a/maubot/config.py +++ b/maubot/config.py @@ -32,7 +32,11 @@ class Config(BaseFileConfig): def do_update(self, helper: ConfigUpdateHelper) -> None: base = helper.base copy = helper.copy - copy("database") + + if "database" in self and self["database"].startswith("sqlite:///"): + helper.base["database"] = self["database"].replace("sqlite:///", "sqlite:") + else: + copy("database") copy("database_opts") if isinstance(self["crypto_database"], dict): if self["crypto_database.type"] == "postgres": diff --git a/maubot/example-config.yaml b/maubot/example-config.yaml index 0181846..a16ea19 100644 --- a/maubot/example-config.yaml +++ b/maubot/example-config.yaml @@ -1,9 +1,9 @@ # The full URI to the database. SQLite and Postgres are fully supported. # Other DBMSes supported by SQLAlchemy may or may not work. # Format examples: -# SQLite: sqlite:///filename.db +# SQLite: sqlite:filename.db # Postgres: postgresql://username:password@hostname/dbname -database: sqlite:///maubot.db +database: sqlite:maubot.db # Separate database URL for the crypto database. "default" means use the same database as above. crypto_database: default diff --git a/maubot/instance.py b/maubot/instance.py index c63e5ab..2905d12 100644 --- a/maubot/instance.py +++ b/maubot/instance.py @@ -317,7 +317,7 @@ class PluginInstance(DBInstance): ) else: self.inst_db = Database.create( - f"sqlite:///{self._sqlite_db_path}", + f"sqlite:{self._sqlite_db_path}", upgrade_table=upgrade_table, log=instance_db_log, ) diff --git a/maubot/standalone/example-config.yaml b/maubot/standalone/example-config.yaml index 1884b78..457a5ca 100644 --- a/maubot/standalone/example-config.yaml +++ b/maubot/standalone/example-config.yaml @@ -35,7 +35,7 @@ server: # The database for the plugin. Used for plugin data, the sync token and e2ee data (if enabled). # SQLite and Postgres are supported. -database: sqlite:///bot.db +database: sqlite:bot.db # Additional arguments for asyncpg.create_pool() or sqlite3.connect() # https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool diff --git a/requirements.txt b/requirements.txt index 550d116..e5743ae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -mautrix>=0.19.8,<0.20 +mautrix>=0.20.1,<0.21 aiohttp>=3,<4 yarl>=1,<2 SQLAlchemy>=1,<1.4 diff --git a/setup.py b/setup.py index 2472222..24f9e00 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ setuptools.setup( install_requires=install_requires, extras_require=extras_require, - python_requires="~=3.8", + python_requires="~=3.9", classifiers=[ "Development Status :: 4 - Beta", @@ -50,7 +50,6 @@ setuptools.setup( "Framework :: AsyncIO", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11",