Skip to content

Commit 573655e

Browse files
committed
Add the possibility to bundle binary modules for different architectures with the python-ifcopenshell module
1 parent 2a7135f commit 573655e

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/ifcopenshell-python/ifcopenshell/__init__.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,25 @@
1818
###############################################################################
1919

2020
import os
21+
import sys
22+
import platform
2123
import functools
2224

2325
from functools import reduce
2426

2527
from . import guid
26-
from . import ifcopenshell_wrapper
28+
29+
python_distribution = os.path.join(platform.system().lower(),
30+
platform.architecture()[0],
31+
'python%s.%s' % platform.python_version_tuple()[:2])
32+
sys.path.append(os.path.abspath(os.path.join(
33+
os.path.dirname(__file__),
34+
'lib', python_distribution)))
35+
36+
try:
37+
from . import ifcopenshell_wrapper
38+
except:
39+
raise ImportError("IfcOpenShell not built for '%s'" % python_distribution)
2740

2841
class entity_instance(object):
2942
def __init__(self, e):

0 commit comments

Comments
 (0)