'APPLICATION.products.cmake' : 'native' # TTK requires cmake > 3.21
'APPLICATION.products.cftime' : 'native'
'APPLICATION.products.h5py' : 'native'
- 'APPLICATION.products.meshio' : 'native'
+ 'APPLICATION.products.meshio' : {tag: '5.3.5' , base: 'no', section: 'version_5_3_5_no_pip' }
'APPLICATION.products.netCDF4' : 'native'
'APPLICATION.products.rich' : 'native'
'APPLICATION.products.cminpack' : 'native'
'APPLICATION.products.h5py' : 'native'
'APPLICATION.products.markdown_it_py' : 'native'
'APPLICATION.products.mdurl' : 'native'
- 'APPLICATION.products.meshio' : 'native'
+ 'APPLICATION.products.meshio' : {tag: '5.3.5', base: 'no', section: 'version_5_3_5_no_pip'}
'APPLICATION.products.netCDF4' : 'native'
'APPLICATION.products.rich' : 'native'
'APPLICATION.products.opencv' : {tag: '3.2.0', base: 'no', section: 'version_3_2_0_DB12'}
'APPLICATION.products.h5py' : 'native'
'APPLICATION.products.markdown_it_py' : 'native'
'APPLICATION.products.mdurl' : 'native'
- 'APPLICATION.products.meshio' : 'native'
+ 'APPLICATION.products.meshio' : {tag: '5.3.4', base: 'no', section: 'version_5_3_4_no_pip'}
'APPLICATION.products.netCDF4' : 'native'
'APPLICATION.products.rich' : 'native'
'APPLICATION.products.opencv' : {tag: '3.2.0', base: 'no', section: 'version_3_2_0_DB12'}
export PYTHONPATH=${PRODUCT_INSTALL}/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
export PATH=${PRODUCT_INSTALL}/bin:$PATH
-WHEELS=('cached_property-1.5.2-py2.py3-none-any.whl' 'meshio-4.3.13-py3-none-any.whl')
+WHEELS=('cached_property-1.5.2-py2.py3-none-any.whl'
+ 'meshio-4.3.13-py3-none-any.whl'
+ )
for WHEEL in "${WHEELS[@]}"; do
${PYTHONBIN} -m pip install --cache-dir=$BUILD_DIR/cache/pip $SOURCE_DIR/$WHEEL --prefix=$PRODUCT_INSTALL
if [ $? -ne 0 ]; then
fi
done
+# bos #42618 - https://github.com/nschloe/meshio/issues/1484
+fPy=$PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/gmsh/main.py
+if [ -f $fPy ]; then
+ sed -i 's/"gmsh": lambda f, m, \*\*kwargs: write(f, m, "4.1", \*\*kwargs)/"gmsh40": lambda f, m, \*\*kwargs: write(f, m, "4.0", \*\*kwargs)/g' $fPy
+ if [ $? -ne 0 ]; then
+ echo "FATAL: could not apply fixes to GMSH MeshIO driver"
+ exit 1
+ fi
+else
+ echo "FATAL: could not find GMSH MeshIO driver!"
+ exit 1
+fi
+
+# spns #42665
+fPy=$PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/ansys/_ansys.py
+if [ -f $fPy ]; then
+ statusCode=0
+ # retrieve line number
+ l=$(grep -nA0 "raise KeyError" $fPy|cut -d':' -f1)
+ L=$(($l+2))
+ sed -i 's/raise KeyError(/warn(/g' $fPy
+ statusCode=$(($statusCode+$?))
+ sed -i "${L}s/)/)\n continue/g" $fPy
+ statusCode=$(($statusCode+$?))
+ sed -i 's/(legal: {legal_keys})/(legal: {legal_keys}). Cell will be skipped!/g' $fPy
+ statusCode=$(($statusCode+$?))
+ if [ $statusCode -ne 0 ]; then
+ echo "FATAL: could not apply fixes to ANSYS MeshIO driver"
+ exit 1
+ fi
+else
+ echo "FATAL: could not find ANSYS MeshIO driver!"
+ exit 1
+fi
+
echo
echo "########## END"
;;
esac
+pyVersionMajor=python$($PYTHONBIN -c 'import sys; print(".".join(map(str, sys.version_info[0:1])))')
+if [ $? -ne 0 ]; then
+ echo ERROR: Failed to extract major Python version - assuming Python version equal to 3...
+ pyVersionMajor=python3
+fi
+
+echo INFO: Python version major: ${pyVersionMajor}
+if [ -f $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/bin/meshio ]; then
+ sed -i "s%#\!.*python[0-9]*%#\!/usr/bin/env ${pyVersionMajor}%#g" $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/bin/meshio
+else
+ echo "FATAL: could not find meshio runner!"
+ exit 1
+fi
+
+# bos #42618 - https://github.com/nschloe/meshio/issues/1484
+fPy=$PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/gmsh/main.py
+if [ -f $fPy ]; then
+ sed -i 's/"gmsh": lambda f, m, \*\*kwargs: write(f, m, "4.1", \*\*kwargs)/"gmsh40": lambda f, m, \*\*kwargs: write(f, m, "4.0", \*\*kwargs)/g' $fPy
+ if [ $? -ne 0 ]; then
+ echo "FATAL: could not apply fixes to GMSH MeshIO driver"
+ exit 1
+ fi
+else
+ echo "FATAL: could not find GMSH MeshIO driver!"
+ exit 1
+fi
+
+# spns #42665
+fPy=$PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/ansys/_ansys.py
+if [ -f $fPy ]; then
+ statusCode=0
+ # retrieve line number
+ l=$(grep -nA0 "raise KeyError" $fPy|cut -d':' -f1)
+ L=$(($l+2))
+ sed -i 's/raise KeyError(/warn(/g' $fPy
+ statusCode=$(($statusCode+$?))
+ sed -i "${L}s/)/)\n continue/g" $fPy
+ statusCode=$(($statusCode+$?))
+ sed -i 's/(legal: {legal_keys})/(legal: {legal_keys}). Cell will be skipped!/g' $fPy
+ statusCode=$(($statusCode+$?))
+ if [ $statusCode -ne 0 ]; then
+ echo "FATAL: could not apply fixes to ANSYS MeshIO driver"
+ exit 1
+ fi
+else
+ echo "FATAL: could not find ANSYS MeshIO driver!"
+ exit 1
+fi
+
echo
echo "########## END"
pyVersionMajor=python$($PYTHONBIN -c 'import sys; print(".".join(map(str, sys.version_info[0:1])))')
if [ $? -ne 0 ]; then
- echo ERROR: Failed to extract major Python version - assuming Python version equal to 3...
- pyVersionMajor=python3
+ echo ERROR: Failed to extract major Python version - assuming Python version equal to 3...
+ pyVersionMajor=python3
fi
+
echo INFO: Python version major: ${pyVersionMajor}
if [ -f $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/bin/meshio ]; then
sed -i "s%#\!.*python[0-9]*%#\!/usr/bin/env ${pyVersionMajor}%#g" $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/bin/meshio
exit 1
fi
+# bos #42618 - https://github.com/nschloe/meshio/issues/1484
+fPy=$PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/gmsh/main.py
+if [ -f $fPy ]; then
+ sed -i 's/"gmsh": lambda f, m, \*\*kwargs: write(f, m, "4.1", \*\*kwargs)/"gmsh40": lambda f, m, \*\*kwargs: write(f, m, "4.0", \*\*kwargs)/g' $fPy
+ if [ $? -ne 0 ]; then
+ echo "FATAL: could not apply fixes to GMSH MeshIO driver"
+ exit 1
+ fi
+else
+ echo "FATAL: could not find GMSH MeshIO driver!"
+ exit 1
+fi
+
+# spns #42665
+fPy=$PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/ansys/_ansys.py
+if [ -f $fPy ]; then
+ statusCode=0
+ # retrieve line number
+ l=$(grep -nA0 "raise KeyError" $fPy|cut -d':' -f1)
+ L=$(($l+2))
+ sed -i 's/raise KeyError(/warn(/g' $fPy
+ statusCode=$(($statusCode+$?))
+ sed -i "${L}s/)/)\n continue/g" $fPy
+ statusCode=$(($statusCode+$?))
+ sed -i 's/(legal: {legal_keys})/(legal: {legal_keys}). Cell will be skipped!/g' $fPy
+ statusCode=$(($statusCode+$?))
+ if [ $statusCode -ne 0 ]; then
+ echo "FATAL: could not apply fixes to ANSYS MeshIO driver"
+ exit 1
+ fi
+else
+ echo "FATAL: could not find ANSYS MeshIO driver!"
+ exit 1
+fi
+
echo
echo "########## END"
{
compil_script: "meshio-5.3.5.bat"
archive_info : {archive_name : "meshio-5.3.5.tar.gz"}
+ patches : ['meshio-5.3.5.p01.gmsh_ansys.patch']
properties :
{
incremental : "yes"
--- /dev/null
+--- meshio-5.3.5_ref/src/meshio/gmsh/main.py 2023-06-26 21:18:18.000000000 +0200
++++ meshio-5.3.5_dev/src/meshio/gmsh/main.py 2024-08-02 10:20:16.667483402 +0200
+@@ -108,6 +108,6 @@
+ read,
+ {
+ "gmsh22": lambda f, m, **kwargs: write(f, m, "2.2", **kwargs),
+- "gmsh": lambda f, m, **kwargs: write(f, m, "4.1", **kwargs),
++ "gmsh40": lambda f, m, **kwargs: write(f, m, "4.0", **kwargs),
+ },
+ )
+--- meshio-5.3.5_ref/src/meshio/ansys/_ansys.py 2024-01-31 16:09:01.000000000 +0100
++++ meshio-5.3.5_dev/src/meshio/ansys/_ansys.py 2024-08-02 10:20:57.619917526 +0200
+@@ -446,9 +446,10 @@
+ ansys_cell_type = meshio_to_ansys_type[cell_type]
+ except KeyError:
+ legal_keys = ", ".join(meshio_to_ansys_type.keys())
+- raise KeyError(
+- f"Illegal ANSYS cell type '{cell_type}'. (legal: {legal_keys})"
++ warn(
++ f"Illegal ANSYS cell type '{cell_type}'. (legal: {legal_keys}). Skipping cell!"
+ )
++ continue
+ fh.write(
+ f"({key} (1 {first_index:x} {last_index:x} 1 {ansys_cell_type})(\n".encode()
+ )