Skip to content

Commit 71d2b14

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

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
import importlib.util
12
import setuptools
23

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

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

0 commit comments

Comments
 (0)