Update mautrix-python

This commit is contained in:
Tulir Asokan 2023-09-06 21:39:28 +03:00
parent 61f154876d
commit 8f40a0b292
7 changed files with 12 additions and 9 deletions

View file

@ -13,7 +13,7 @@ function fixdefault {
function fixconfig { function fixconfig {
# Change relative default paths to absolute paths in /data # 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.upload' './plugins' '/data/plugins'
fixdefault '.plugin_directories.load[0]' './plugins' '/data/plugins' fixdefault '.plugin_directories.load[0]' './plugins' '/data/plugins'
fixdefault '.plugin_directories.trash' './trash' '/data/trash' fixdefault '.plugin_directories.trash' './trash' '/data/trash'

View file

@ -32,6 +32,10 @@ class Config(BaseFileConfig):
def do_update(self, helper: ConfigUpdateHelper) -> None: def do_update(self, helper: ConfigUpdateHelper) -> None:
base = helper.base base = helper.base
copy = helper.copy copy = helper.copy
if "database" in self and self["database"].startswith("sqlite:///"):
helper.base["database"] = self["database"].replace("sqlite:///", "sqlite:")
else:
copy("database") copy("database")
copy("database_opts") copy("database_opts")
if isinstance(self["crypto_database"], dict): if isinstance(self["crypto_database"], dict):

View file

@ -1,9 +1,9 @@
# The full URI to the database. SQLite and Postgres are fully supported. # The full URI to the database. SQLite and Postgres are fully supported.
# Other DBMSes supported by SQLAlchemy may or may not work. # Other DBMSes supported by SQLAlchemy may or may not work.
# Format examples: # Format examples:
# SQLite: sqlite:///filename.db # SQLite: sqlite:filename.db
# Postgres: postgresql://username:password@hostname/dbname # 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. # Separate database URL for the crypto database. "default" means use the same database as above.
crypto_database: default crypto_database: default

View file

@ -317,7 +317,7 @@ class PluginInstance(DBInstance):
) )
else: else:
self.inst_db = Database.create( self.inst_db = Database.create(
f"sqlite:///{self._sqlite_db_path}", f"sqlite:{self._sqlite_db_path}",
upgrade_table=upgrade_table, upgrade_table=upgrade_table,
log=instance_db_log, log=instance_db_log,
) )

View file

@ -35,7 +35,7 @@ server:
# The database for the plugin. Used for plugin data, the sync token and e2ee data (if enabled). # The database for the plugin. Used for plugin data, the sync token and e2ee data (if enabled).
# SQLite and Postgres are supported. # SQLite and Postgres are supported.
database: sqlite:///bot.db database: sqlite:bot.db
# Additional arguments for asyncpg.create_pool() or sqlite3.connect() # Additional arguments for asyncpg.create_pool() or sqlite3.connect()
# https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool # https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool

View file

@ -1,4 +1,4 @@
mautrix>=0.19.8,<0.20 mautrix>=0.20.1,<0.21
aiohttp>=3,<4 aiohttp>=3,<4
yarl>=1,<2 yarl>=1,<2
SQLAlchemy>=1,<1.4 SQLAlchemy>=1,<1.4

View file

@ -41,7 +41,7 @@ setuptools.setup(
install_requires=install_requires, install_requires=install_requires,
extras_require=extras_require, extras_require=extras_require,
python_requires="~=3.8", python_requires="~=3.9",
classifiers=[ classifiers=[
"Development Status :: 4 - Beta", "Development Status :: 4 - Beta",
@ -50,7 +50,6 @@ setuptools.setup(
"Framework :: AsyncIO", "Framework :: AsyncIO",
"Programming Language :: Python", "Programming Language :: Python",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.11",