44 ## additional deps for tests
54 opencascade-occt = opencascade-occt_7_6;
56 buildPythonPackage rec {
57 pname = "ifcopenshell";
61 src = fetchFromGitHub {
62 owner = "IfcOpenShell";
63 repo = "IfcOpenShell";
64 tag = "ifcopenshell-python-${version}";
65 fetchSubmodules = true;
66 hash = "sha256-tnj14lBEkUZNDM9J1sRhNA7OkWTWa5JPTSF8hui3q7k=";
71 name = "ifcopenshell-boost-1.86-mt19937.patch";
72 url = "https://github.com/IfcOpenShell/IfcOpenShell/commit/1fe168d331123920eeb9a96e542fcc1453de57fe.patch";
73 hash = "sha256-oZDEL8cPcEu83lW+qSvCbmDGYpaNNRrptW9MLu2pN70=";
77 name = "ifcopenshell-boost-1.86-json.patch";
78 url = "https://github.com/IfcOpenShell/IfcOpenShell/commit/88b861737c7c206d0e7307f90d37467e9585515c.patch";
79 hash = "sha256-zMoQcBWRdtavL0xdsr53SqyG6CZoeon8/mmJhrw85lc=";
93 # ifcopenshell needs stdc++
94 (lib.getLib stdenv.cc.cc)
110 propagatedBuildInputs = [
119 # list taken from .github/workflows/ci.yml:49
120 nativeCheckInputs = [
132 pythonImportsCheck = [ "ifcopenshell" ];
134 PYTHONUSERBASE = ".";
136 # We still build with python to generate ifcopenshell_wrapper.py and ifcopenshell_wrapper.so
138 "-DUSERSPACE_PYTHON_PREFIX=ON"
139 "-DBUILD_SHARED_LIBS=ON"
140 "-DBUILD_IFCPYTHON=ON"
141 "-DCITYJSON_SUPPORT=OFF"
142 "-DEIGEN_DIR=${eigen}/include/eigen3"
143 "-DJSON_INCLUDE_DIR=${nlohmann_json}/include/"
144 "-DOCC_INCLUDE_DIR=${opencascade-occt}/include/opencascade"
145 "-DOCC_LIBRARY_DIR=${lib.getLib opencascade-occt}/lib"
146 "-DOPENCOLLADA_INCLUDE_DIR=${opencollada}/include/opencollada"
147 "-DOPENCOLLADA_LIBRARY_DIR=${lib.getLib opencollada}/lib/opencollada"
148 "-DSWIG_EXECUTABLE=${swig}/bin/swig"
149 "-DLIBXML2_INCLUDE_DIR=${libxml2.dev}/include/libxml2"
150 "-DLIBXML2_LIBRARIES=${lib.getLib libxml2}/lib/libxml2${stdenv.hostPlatform.extensions.sharedLibrary}"
151 "-DGMP_LIBRARY_DIR=${lib.getLib gmp}/lib/"
152 "-DMPFR_LIBRARY_DIR=${lib.getLib mpfr}/lib/"
153 # HDF5 support is currently not optional, see https://github.com/IfcOpenShell/IfcOpenShell/issues/1815
155 "-DHDF5_INCLUDE_DIR=${hdf5.dev}/include/"
156 "-DHDF5_LIBRARIES=${lib.getLib hdf5}/lib/libhdf5_cpp.so;${lib.getLib hdf5}/lib/libhdf5.so;${lib.getLib zlib}/lib/libz.so;${lib.getLib libaec}/lib/libaec.so;"
160 pushd src/ifcopenshell-python
161 # The build process is here: https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.8.0/src/ifcopenshell-python/Makefile#L131
162 # NOTE: it has changed a *lot* between 0.7.0 and 0.8.0, it *may* change again (look for mathutils and basically all the things this Makefile does manually)
163 substituteInPlace pyproject.toml --replace-fail "0.0.0" "${version}"
164 # NOTE: the following is directly inspired by https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.8.0/src/ifcopenshell-python/Makefile#L123
165 cp ../../README.md README.md
174 pushd ../../src/ifcopenshell-python
175 # let's test like done in .github/workflows/ci.yml
176 # installing the python wrapper and the .so, both are needed to be able to test
177 cp -v $out/${python.sitePackages}/ifcopenshell/ifcopenshell_wrapper.py ./ifcopenshell
178 cp $out/${python.sitePackages}/ifcopenshell/_ifcopenshell_wrapper.cpython-${
179 lib.versions.major python.version + lib.versions.minor python.version
180 }-${stdenv.targetPlatform.system}-gnu.so ./ifcopenshell
182 PYTHONPATH=../src/ifcopenshell-python/ python tests.py
187 "-p no:pytest-blender"
190 disabledTestPaths = [
199 updateScript = gitUpdater { rev-prefix = "ifcopenshell-python-"; };
201 version = testers.testVersion {
202 command = "IfcConvert --version";
203 package = ifcopenshell;
209 broken = stdenv.hostPlatform.isDarwin;
210 description = "Open source IFC library and geometry engine";
211 homepage = "http://ifcopenshell.org/";
212 license = licenses.lgpl3;
213 maintainers = with maintainers; [ autra ];