|
| 1 | +#!/bin/bash |
| 2 | +set -e |
| 3 | + |
| 4 | +function info() { |
| 5 | + echo -e "\033[1;36m$1\033[0m" |
| 6 | +} |
| 7 | + |
| 8 | +trap "info Exited!; exit;" SIGINT SIGTERM |
| 9 | + |
| 10 | +for python_version in '3.9' '3.10' '3.11' '3.12' |
| 11 | +do |
| 12 | + info "Building wheel for Python $python_version..." |
| 13 | + info "Removing temp files..." |
| 14 | + rm -rf -v ./build |
| 15 | + rm -rf -v ./cadquery_ocp.egg-info |
| 16 | + info "Conda Deps Setup..." |
| 17 | + conda create --yes -n ocp-build-system -c cadquery -c conda-forge \ |
| 18 | + python=$python_version \ |
| 19 | + pip |
| 20 | + info "DONE" |
| 21 | + info "Conda Arch Setup..." |
| 22 | + conda run -n ocp-build-system conda config --env --set subdir local-vtk-build |
| 23 | + info "Pip Deps Setup..." |
| 24 | + conda run -n ocp-build-system pip install \ |
| 25 | + build \ |
| 26 | + setuptools \ |
| 27 | + wheel \ |
| 28 | + requests \ |
| 29 | + delocate \ |
| 30 | + auditwheel \ |
| 31 | + delvewheel |
| 32 | + info "Conda-only Build..." |
| 33 | + conda run --live-stream -n ocp-build-system \ |
| 34 | + mkdir -p ./vtk/build; \ |
| 35 | + curl -L -O https://vtk.org/files/release/9.2/VTK-9.2.6.tar.gz; \ |
| 36 | + tar -zxf VTK-9.2.6.tar.gz --directory ./vtk/; \ |
| 37 | + cd ./vtk/build; \ |
| 38 | + cmake -GNinja -DVTK_WHEEL_BUILD=ON -DVTK_WRAP_PYTHON=ON -DCMAKE_BUILD_TYPE=Release ../VTK-9.2.6; \ |
| 39 | + ninja; \ |
| 40 | + python setup.py bdist_wheel; \ |
| 41 | + cd ../../; \ |
| 42 | + find ./ -iname *.whl; \ |
| 43 | + wheel_file=$(ls vtk/build/dist/*.whl | xargs -n 1 basename); \ |
| 44 | + echo $wheel_file; \ |
| 45 | + mkdir wheel_build/; \ |
| 46 | + unzip vtk/build/dist/${wheel_file} -d wheel_build/; \ |
| 47 | + sed -i 's/Name:.*$/Name: cadquery_vtk/' wheel_build/*.dist-info/METADATA; \ |
| 48 | + sed -i 's/Version:.9.2.6.dev0$/Version: 9.2.6/' wheel_build/*.dist-info/METADATA; \ |
| 49 | + mv wheel_build/*.dist-info wheel_build/cadquery_vtk-9.2.6.dist-info; \ |
| 50 | + cd wheel_build/; \ |
| 51 | + zip -r cadquery_${wheel_file} *; \ |
| 52 | + rm ../vtk/build/dist/*.whl; \ |
| 53 | + mv cadquery_${wheel_file} ../vtk/build/dist/; \ |
| 54 | + cd ../; \ |
| 55 | + pip install vtk/build/dist/*.whl; \ |
| 56 | + python -c "import vtk;print('vtk imported successfully')" |
| 57 | +done |
0 commit comments