From 292346c1305382dde78b3ca9f44c80356fdaf641 Mon Sep 17 00:00:00 2001 From: vincentcasseau Date: Thu, 17 Oct 2024 18:25:49 +0200 Subject: [PATCH] PyPI: compiling Cassiopee in a manylinux2014 Docker image --- .github/workflows/publish-pypi.yml | 126 ++++++++++-------- .../Post/Stream2/unstructured_data_view_p.hpp | 13 +- pyproject.toml | 35 ++--- 3 files changed, 93 insertions(+), 81 deletions(-) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index a47860786..83311eacb 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -9,10 +9,7 @@ on: jobs: build: - runs-on: ubuntu-20.04 -# strategy: -# matrix: -# python-version: ["3.8", "3.12"] + runs-on: ubuntu-latest steps: - name: Checkout repository @@ -22,42 +19,77 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.8" -# python-version: ${{ matrix.python-version }} - - name: Install system dependencies - run: | - sudo apt-get update && sudo apt-get install -y \ - gcc \ - g++ \ - gfortran \ - libopenmpi-dev \ - libhdf5-openmpi-dev \ - python3-tk \ - mesa-common-dev \ - libgl1-mesa-dev \ - libglu1-mesa-dev \ - libosmesa6-dev \ - xorg-dev - - name: Install Python dependencies run: | python -m pip install --upgrade pip - pip install wheel twine auditwheel setuptools scons numpy mpi4py + pip install twine - - name: Verify Python and Installed Packages - run: | - python --version - python -m pip list - - - name: Build Cassiopee package + - name: Pull manylinux2014 image + run: docker pull quay.io/pypa/manylinux2014_x86_64 + + - name: Build Cassiopee in a Docker container run: | - export CASSIOPEE=$GITHUB_WORKSPACE - export MACHINE=azure - . $CASSIOPEE/Cassiopee/Envs/sh_Cassiopee_r8 - cd $CASSIOPEE/Cassiopee - echo -e "FREEMODULES='KCore XCore Converter Geom Transform Generator Post Initiator Connector Distributor2 Dist2Walls RigidMotion Compressor Modeler Intersector Apps CPlot'\nexport FREEMODULES\nFULLMODULES='KCore XCore Converter Geom Transform Generator Post Initiator Connector Distributor2 Dist2Walls RigidMotion Compressor Modeler Intersector Apps CPlot'\nexport FULLMODULES\nOTHERS=''" > $CASSIOPEE/Cassiopee/MODULES - ./install - + docker run --rm -v $GITHUB_WORKSPACE:/io quay.io/pypa/manylinux2014_x86_64:latest /bin/bash -c " + export PATH=/opt/python/cp312-cp312/bin:\$PATH && + yum update && yum install -y \ + gcc \ + gcc-c++ \ + gcc-gfortran \ + openmpi \ + openmpi-devel \ + hdf5 \ + hdf5-devel \ + tk \ + mesa-libGL \ + mesa-libGL-devel \ + mesa-libGLU \ + mesa-libGLU-devel \ + mesa-libOSMesa \ + mesa-libOSMesa-devel \ + libX11-devel \ + libXext-devel \ + libXmu-devel \ + libXi-devel \ + libXrender-devel \ + libpng-devel \ + zlib-devel \ + xorg-x11-server-devel \ + OCE-devel \ + OCE-draw \ + OCE-foundation \ + OCE-modeling \ + OCE-ocaf \ + OCE-visualization && + export CPATH=/usr/include/oce:\$CPATH && + export PATH=/usr/lib64/oce-0.17/bin:\$PATH && + export LD_LIBRARY_PATH=/usr/lib64/oce-0.17:\$LD_LIBRARY_PATH && + export OCCT_ROOT=/usr/include/oce && + export OCCT_INCLUDE_DIR=/usr/include/oce && + export OCCT_LIBRARY_DIR=/usr/lib64/oce-0.17 && + pip3 install \ + wheel \ + auditwheel \ + setuptools \ + scons \ + numpy && + export PATH=/usr/lib64/openmpi/bin:\$PATH && + export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:\$LD_LIBRARY_PATH && + export CFLAGS="-std=c99" && + pip3 install mpi4py && + export CFLAGS="-std=c11" && + python --version && python -m pip list && + export CASSIOPEE=/io && + export MACHINE=azure && + cd \$CASSIOPEE/Cassiopee && + . \$CASSIOPEE/Cassiopee/Envs/sh_Cassiopee_r8 && + sed -i "s/OCC//g" MODULES && + ./install && + cd \$CASSIOPEE/Dist/bin/\$ELSAPROD && + find . -type f -name '*-4.0-cp312-cp312-linux_x86_64.whl' -exec mv {} . \; + for wheel in \$(find . -maxdepth 1 -name '*.whl'); do auditwheel repair \$wheel; done + " + - name: Publish to PyPI env: TWINE_USERNAME: __token__ @@ -66,26 +98,6 @@ jobs: export CASSIOPEE=$GITHUB_WORKSPACE export MACHINE=azure . $CASSIOPEE/Cassiopee/Envs/sh_Cassiopee_r8 - for wheel in $(find $CASSIOPEE/Dist/bin/$ELSAPROD/pip-ephem-wheel-cache-* -type f -name "*.whl"); do - echo "$wheel" - auditwheel -v repair "$wheel" - done - find $CASSIOPEE/Dist/bin/$ELSAPROD/pip-ephem-wheel-cache-* -type f -name "*manylinux*.whl" -exec twine upload {} + - -# publish: -# runs-on: ubuntu-latest -# needs: build -# steps: -# - name: Checkout repository -# uses: actions/checkout@v3 -# -# - name: Set up Python -# uses: actions/setup-python@v4 -# with: -# python-version: "3.12" -# -# - name: Publish to PyPI -# env: -# TWINE_USERNAME: __token__ -# TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} -# run: find -name "*.whl" -exec twine upload {} + + ls $CASSIOPEE/Dist/bin/$ELSAPROD/wheelhouse/ + cd $CASSIOPEE/Dist/bin/$ELSAPROD/ + twine upload --verbose wheelhouse/*.whl diff --git a/Cassiopee/Post/Post/Stream2/unstructured_data_view_p.hpp b/Cassiopee/Post/Post/Stream2/unstructured_data_view_p.hpp index 46047a7b8..17fffba8b 100644 --- a/Cassiopee/Post/Post/Stream2/unstructured_data_view_p.hpp +++ b/Cassiopee/Post/Post/Stream2/unstructured_data_view_p.hpp @@ -35,28 +35,27 @@ namespace K_POST hexaedre , number_of_element_types }; - + static constexpr const std::array number_of_vertices_per_element = { - 4, 5, 6, 8 + {4, 5, 6, 8} }; static constexpr const std::array number_of_vertices_for_polyhedron = { - 4, 6, 9, 14 + {4, 6, 9, 14} }; static constexpr const std::array number_of_faces_per_element = { - 4, 5, 5, 6 + {4, 5, 5, 6} }; static constexpr const std::array total_nb_of_vertices_for_faces_per_element = { - 12, 16, 18, 24 + {12, 16, 18, 24} }; static constexpr const std::array number_of_triangles_per_element = { - 4, 8, 14, 24 + {4, 8, 14, 24} }; - static const std::array,number_of_element_types> number_of_vertices_per_face_per_element; static const std::array>,number_of_element_types> vertices_per_face_per_element; diff --git a/pyproject.toml b/pyproject.toml index a3e506bc5..aa9852a18 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,25 +27,26 @@ classifiers = [ numpy = ">=1.23.3" mpi4py = ">=3.1.3" scons = ">=4.4.0" -KCore = ">=4.0" -XCore = ">=4.0" -Converter = ">=4.0" -Geom = ">=4.0" -Transform = ">=4.0" -Generator = ">=4.0" -Post = ">=4.0" -Initiator = ">=4.0" -Connector = ">=4.0" -Distributor2 = ">=4.0" -Dist2Walls = ">=4.0" -RigidMotion = ">=4.0" -Compressor = ">=4.0" -Modeler = ">=4.0" -Intersector = ">=4.0" -Apps = ">=4.0" -CPlot = ">=4.0" +KCore = {path = "Cassiopee/KCore"} +XCore = {path = "Cassiopee/XCore"} +Converter = {path = "Cassiopee/Converter"} +Geom = {path = "Cassiopee/Geom"} +Transform = {path = "Cassiopee/Transform"} +Generator = {path = "Cassiopee/Generator"} +Post = {path = "Cassiopee/Post"} +Initiator = {path = "Cassiopee/Initiator"} +Connector = {path = "Cassiopee/Connector"} +Distributor2 = {path = "Cassiopee/Distributor2"} +Dist2Walls = {path = "Cassiopee/Dist2Walls"} +RigidMotion = {path = "Cassiopee/RigidMotion"} +Compressor = {path = "Cassiopee/Compressor"} +Modeler = {path = "Cassiopee/Modeler"} +Intersector = {path = "Cassiopee/Intersector"} +Apps = {path = "Cassiopee/Apps"} [project.optional-dependencies] +CPlot = {path = "Cassiopee/CPlot"} +OCC = {path = "Cassiopee/OCC"} [project.urls] Homepage = "https://github.com/onera/Cassiopee"