From 71d2b14ba8ab43e842bf5ccafa1304716f09a526 Mon Sep 17 00:00:00 2001 From: Ivan Shapovalov Date: Sun, 4 Feb 2024 17:46:06 +0100 Subject: [PATCH] setup.py: support PEP 517 isolated builds when sourcing version --- setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b01c50a1..6bd98355 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,11 @@ +import importlib.util import setuptools -from mautrix import __version__ +# get mautrix.__version__ in a way that's compatible with PEP517 isolation +spec = importlib.util.spec_from_file_location("mautrix", "mautrix/__init__.py") +mautrix = importlib.util.module_from_spec(spec) +spec.loader.exec_module(mautrix) +__version__ = mautrix.__version__ encryption_dependencies = ["python-olm", "unpaddedbase64", "pycryptodome"] test_dependencies = ["aiosqlite", "asyncpg", "ruamel.yaml", *encryption_dependencies]