Skip to content

Commit 1bee928

Browse files
committed
setup.py: support PEP 517 isolated builds when sourcing version
1 parent 3e22e61 commit 1bee928

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

setup.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
import importlib.util
12
import setuptools
3+
from pathlib import Path
24

3-
from mautrix import __version__
5+
# get mautrix.__version__ in a way that's compatible with PEP517 isolation
6+
spec = importlib.util.spec_from_file_location("mautrix", Path(__file__).parent / "mautrix/__init__.py")
7+
mautrix = importlib.util.module_from_spec(spec)
8+
spec.loader.exec_module(mautrix)
9+
__version__ = mautrix.__version__
410

511
encryption_dependencies = ["python-olm", "unpaddedbase64", "pycryptodome"]
612
test_dependencies = ["aiosqlite", "asyncpg", "ruamel.yaml", *encryption_dependencies]

0 commit comments

Comments
 (0)